Пример #1
0
        public static bool TryParseUri(Uri uri, out BlobUri blobUri)
        {
            blobUri = null;
            string storageAccountName;
            string storageDomainName;
            string blobContainerName;
            string blobName;
            string queryString;
            string secret;

            var result = TryParseUri(uri,
                                     out storageAccountName,
                                     out storageDomainName,
                                     out blobContainerName,
                                     out blobName,
                                     out queryString,
                                     out secret);

            if (!result)
            {
                return false;
            }
            blobUri = new BlobUri(uri, storageAccountName, storageDomainName, blobContainerName, blobName, queryString);
            return true;
        }
 public UploadParameters(BlobUri destinationUri, BlobUri baseImageUri, FileInfo localFilePath, bool overWrite, int numberOfUploaderThreads)
 {
     DestinationUri = destinationUri;
     BaseImageUri = baseImageUri;
     LocalFilePath = localFilePath;
     OverWrite = overWrite;
     NumberOfUploaderThreads = numberOfUploaderThreads;
 }
 public bool CreateContainer(BlobUri destination)
 {
     if (String.IsNullOrEmpty(destination.Uri.Query))
     {
         var destinationBlob = Create(destination);
         return destinationBlob.Container.CreateIfNotExists(this.CreateRequestOptions());
     }
     return true;
 }
Пример #4
0
        protected BlobCreatorBase(FileInfo localVhd, BlobUri blobDestination, ICloudPageBlobObjectFactory blobObjectFactory, bool overWrite)
        {
            this.localVhd = localVhd;
            this.blobObjectFactory = blobObjectFactory;
            this.destination = new Uri(blobDestination.BlobPath);
            this.blobDestination = blobDestination;
            this.overWrite = overWrite;

            this.destinationBlob = blobObjectFactory.Create(blobDestination);
            this.requestOptions = this.blobObjectFactory.CreateRequestOptions();
        }
Пример #5
0
 public Downloader(BlobUri blobUri, string storageAccountKey, string locaFilePath)
 {
     this.parameters = new DownloaderParameters
     {
         BlobUri                  = blobUri,
         LocalFilePath            = locaFilePath,
         ConnectionLimit          = DefaultConnectionLimit,
         StorageAccountKey        = storageAccountKey,
         ValidateFreeDiskSpace    = false,
         ProgressDownloadStatus   = Program.SyncOutput.ProgressDownloadStatus,
         ProgressDownloadComplete = Program.SyncOutput.ProgressDownloadComplete
     };
 }
Пример #6
0
 public Downloader(BlobUri blobUri, string storageAccountKey, string locaFilePath)
 {
     this.parameters = new DownloaderParameters
     {
         BlobUri = blobUri,
         LocalFilePath = locaFilePath,
         ConnectionLimit = DefaultConnectionLimit,
         StorageAccountKey = storageAccountKey,
         ValidateFreeDiskSpace = false,
         ProgressDownloadStatus = Program.SyncOutput.ProgressDownloadStatus,
         ProgressDownloadComplete = Program.SyncOutput.ProgressDownloadComplete
     };
 }
        public StorageCredentials Create(BlobUri destination)
        {
            if (IsChannelRequired(destination.Uri))
            {
                if (currentSubscription == null)
                {
                    throw new ArgumentException(Rsrc.StorageCredentialsFactoryCurrentSubscriptionNotSet, "SubscriptionId");
                }
                var storageKeys = this.client.StorageAccounts.ListKeys(this.resourceGroupName, destination.StorageAccountName);
                return new StorageCredentials(destination.StorageAccountName, storageKeys.StorageAccountKeys.Key1);
            }

            return new StorageCredentials(destination.Uri.Query);
        }
Пример #8
0
 public BlobHandle(BlobUri blobUri, string storageAccountKey)
 {
     this.blobUri = blobUri;
     this.storageAccountKey = storageAccountKey;
     var blobClient = new CloudBlobClient(new Uri(this.blobUri.BaseUri), new StorageCredentials(this.blobUri.StorageAccountName, this.storageAccountKey));
     this.container = blobClient.GetContainerReference(this.blobUri.BlobContainerName);
     this.container.FetchAttributes();
     this.pageBlob = this.container.GetPageBlobReference(blobUri.BlobName);
     this.blobRequestOptions = new BlobRequestOptions
                                   {
                                       ServerTimeout = TimeSpan.FromMinutes(5),
                                       RetryPolicy = new LinearRetry(TimeSpan.FromMinutes(1), 3)
                                   };
     this.pageBlob.FetchAttributes(new AccessCondition(), blobRequestOptions);
 }
Пример #9
0
        public BlobHandle(BlobUri blobUri, string storageAccountKey)
        {
            this.blobUri           = blobUri;
            this.storageAccountKey = storageAccountKey;
            var blobClient = new CloudBlobClient(new Uri(this.blobUri.BaseUri), new StorageCredentials(this.blobUri.StorageAccountName, this.storageAccountKey));

            this.container = blobClient.GetContainerReference(this.blobUri.BlobContainerName);
            this.container.FetchAttributes();
            this.pageBlob           = this.container.GetPageBlobReference(blobUri.BlobName);
            this.blobRequestOptions = new BlobRequestOptions
            {
                ServerTimeout = TimeSpan.FromMinutes(5),
                RetryPolicy   = new LinearRetry(TimeSpan.FromMinutes(1), 3)
            };
            this.pageBlob.FetchAttributes(new AccessCondition(), blobRequestOptions);
        }
 public CloudPageBlob Create(BlobUri destination)
 {
     return new CloudPageBlob(new Uri(destination.BlobPath), credentialsFactory.Create(destination));
 }
Пример #11
0
 public PatchingBlobCreator(FileInfo localVhd, BlobUri destination, BlobUri baseVhdBlob, ICloudPageBlobObjectFactory blobObjectFactory, bool overWrite) :
     base(localVhd, destination, blobObjectFactory, overWrite)
 {
     this.baseVhdBlob = baseVhdBlob.Uri;
     this.baseVhdBlobUri = baseVhdBlob;
 }
Пример #12
0
 public BlobCreator(FileInfo localVhd, BlobUri destination, ICloudPageBlobObjectFactory blobObjectFactory, bool overWrite) :
     base(localVhd, destination, blobObjectFactory, overWrite)
 {
 }