Used to create an upload a blob to a specified container
Наследование: BlobCommand
Пример #1
0
 /// <summary>
 /// Creates an uploads a blob given a file path
 /// </summary>
 /// <param name="blobName">the name of the blob to create</param>
 /// <param name="filenamePath">The name of the file to read an copy to blob storage</param>
 public string CreateAndUploadBlob(string blobName, string filenamePath)
 {
     LoadKeyIfNotExists();
     var blobCommand = new CreateAndUploadBlobCommand(ContainerName, blobName, filenamePath)
     {
         AccountKey = AccountKey,
         AccountName = AccountName
     };
     blobCommand.Execute();
     return blobCommand.DeploymentPath;
 }
        /// <summary>
        /// This creates a blob container using the default container name "elastadeploy" and uploads the package
        /// </summary>
        private string UploadPackageBlob()
        {
            var blobContainer = new CreateBlobContainerCommand(Constants.DefaultBlobContainerName)
                                    {
                                        AccountKey = _manager.StorageAccountKey,
                                        AccountName = _manager.StorageAccountName
                                    };
            blobContainer.Execute();
            _manager.WriteComplete(EventPoint.StorageBlobContainerCreated,
                                   "Blob container " + Constants.DefaultBlobContainerName + " created");

            var blobCreate = new CreateAndUploadBlobCommand(Constants.DefaultBlobContainerName,
                                                            Path.GetFileName(_manager.LocalPackagePathName),
                                                            _manager.LocalPackagePathName)
                                 {
                                     AccountName = _manager.StorageAccountName,
                                     AccountKey = _manager.StorageAccountKey
                                 };
            blobCreate.Execute();
            _manager.WriteComplete(EventPoint.DeploymentPackageUploadComplete,
                                   "Uploaded package to default blob container");
            return blobCreate.DeploymentPath;
        }