/// <summary> /// Construct a blob storage client instance with hub name and cloud storage account /// </summary> /// <param name="hubName">The hub name</param> /// <param name="cloudStorageAccount">The Cloud Storage Account</param> public BlobStorageClient(string hubName, CloudStorageAccount cloudStorageAccount) { if (string.IsNullOrWhiteSpace(hubName)) { throw new ArgumentException("Invalid hub name", nameof(hubName)); } if (cloudStorageAccount == null) { throw new ArgumentException("Invalid cloud storage acount", nameof(cloudStorageAccount)); } this.blobClient = CreateBlobClient(cloudStorageAccount); // make the hub name lower case since it will be used as part of the prefix of the container name, // which only allows lower case letters this.containerNamePrefix = BlobStorageClientHelper.BuildContainerNamePrefix(hubName.ToLower()); }
/// <summary> /// Construct a blob storage client instance with hub name and connection string /// </summary> /// <param name="hubName">The hub name</param> /// <param name="connectionString">The connection string</param> public BlobStorageClient(string hubName, string connectionString) { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentException("Invalid connection string", nameof(connectionString)); } if (string.IsNullOrWhiteSpace(hubName)) { throw new ArgumentException("Invalid hub name", nameof(hubName)); } this.blobClient = CloudStorageAccount.Parse(connectionString).CreateCloudBlobClient(); this.blobClient.DefaultRequestOptions.RetryPolicy = new ExponentialRetry(DeltaBackOff, MaxRetries); this.blobClient.DefaultRequestOptions.MaximumExecutionTime = MaximumExecutionTime; // make the hub name lower case since it will be used as part of the prefix of the container name, // which only allows lower case letters this.containerNamePrefix = BlobStorageClientHelper.BuildContainerNamePrefix(hubName.ToLower()); }