public BlobBatchClientTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { // Batch delimiters are random so disable body comparison Matcher = new RecordMatcher(compareBodies: false); Sanitizer = new BatchStorageRecordedTestSanitizer(); }
public BlobBaseClientTransactionalHashingTests( bool async, BlobClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null) : base(async, _blobResourcePrefix, mode) { ClientBuilder = ClientBuilderExtensions.GetNewBlobsClientBuilder(Tenants, serviceVersion); }
public static string ToSasVersion(BlobClientOptions.ServiceVersion serviceVersion) { return(serviceVersion switch { BlobClientOptions.ServiceVersion.V2019_02_02 => "2019-02-02", BlobClientOptions.ServiceVersion.V2019_07_07 => "2019-07-07", BlobClientOptions.ServiceVersion.V2019_12_12 => "2019-12-12", _ => throw new ArgumentException("Invalid service version"), });
public BlobBaseClientOpenWriteTests( bool async, BlobClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null) : base(async, _blobResourcePrefix, mode) { ClientBuilder = ClientBuilderExtensions.GetNewBlobsClientBuilder(Tenants, serviceVersion); BlobConditions = new BlobAccessConditionConfigs(this); }
/// <summary> /// Initializes a new instance of the <see cref="BlobClient"/> /// class. /// </summary> /// <param name="blobUri"> /// A <see cref="Uri"/> referencing the blob that includes the /// name of the account, the name of the container, and the name of /// the blob. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}/{blob_name}". /// </param> /// <param name="pipeline"> /// The transport pipeline used to send every request. /// </param> /// <param name="version"> /// The version of the service to use when sending requests. /// </param> /// <param name="clientDiagnostics">Client diagnostics.</param> /// <param name="customerProvidedKey">Customer provided key.</param> /// <param name="encryptionScope">Encryption scope.</param> internal BlobClient( Uri blobUri, HttpPipeline pipeline, BlobClientOptions.ServiceVersion version, ClientDiagnostics clientDiagnostics, CustomerProvidedKey?customerProvidedKey, string encryptionScope) : base(blobUri, pipeline, version, clientDiagnostics, customerProvidedKey, encryptionScope) { }
public BlobClientOpenWriteTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { // Validate every test didn't accidentally use client-side encryption when writing a blob. AdditionalAssertions += async(client) => { IDictionary <string, string> metadata = (await client.GetPropertiesAsync()).Value.Metadata; Assert.IsFalse(metadata.ContainsKey(Constants.ClientSideEncryption.EncryptionDataKey)); }; }
public BlobClientConfiguration( HttpPipeline pipeline, StorageSharedKeyCredential sharedKeyCredential, ClientDiagnostics clientDiagnostics, BlobClientOptions.ServiceVersion version, CustomerProvidedKey?customerProvidedKey, string encryptionScope) : base(pipeline, sharedKeyCredential, clientDiagnostics) { Version = version; CustomerProvidedKey = customerProvidedKey; EncryptionScope = encryptionScope; }
private static string ToSasVersion(BlobClientOptions.ServiceVersion serviceVersion) { switch (serviceVersion) { case BlobClientOptions.ServiceVersion.V2019_02_02: return("2019-02-02"); case BlobClientOptions.ServiceVersion.V2019_07_07: return("2019-07-07"); default: throw new ArgumentException("Invalid service version"); } }
public static BlobServiceClient Create( Uri uri, HttpPipeline pipeline, HttpPipelinePolicy authentication, BlobClientOptions.ServiceVersion version, ClientDiagnostics diagnostics) { return(BlobServiceClient.CreateClient( uri, new BlobClientOptions(version) { Diagnostics = { IsDistributedTracingEnabled = diagnostics.IsActivityEnabled } }, authentication, pipeline)); }
/// <summary> /// Initializes a new instance of the <see cref="BlobBatchClient"/> /// class for the same account as the <see cref="BlobServiceClient"/>. /// The new <see cref="BlobBatchClient"/> uses the same request policy /// pipeline as the <see cref="BlobServiceClient"/>. /// </summary> /// <param name="client">The <see cref="BlobServiceClient"/>.</param> public BlobBatchClient(BlobServiceClient client) { _uri = client.Uri; _pipeline = BlobServiceClientInternals.GetHttpPipeline(client); BlobClientOptions options = BlobServiceClientInternals.GetClientOptions(client); _version = options.Version; _clientDiagnostics = new StorageClientDiagnostics(options); // Construct a dummy pipeline for processing batch sub-operations // if we don't have one cached on the service _batchOperationPipeline = CreateBatchPipeline( _pipeline, BlobServiceClientInternals.GetAuthenticationPolicy(client), _version); (ServiceRestClient serviceRestClient, ContainerRestClient containerRestClient) = BuildRestClients(_uri); _serviceRestClient = serviceRestClient; _containerRestClient = containerRestClient; _isContainerScoped = false; }
/// <summary> /// Creates a pipeline to use for processing sub-operations before they /// are combined into a single multipart request. /// </summary> /// <param name="pipeline"> /// The pipeline used to submit the live request. /// </param> /// <param name="authenticationPolicy"> /// An optional <see cref="HttpPipelinePolicy"/> used to authenticate /// the sub-operations. /// </param> /// <param name="serviceVersion"> /// The serviceVersion used when generating sub-requests. /// </param> /// <returns>A pipeline to use for processing sub-operations.</returns> private static HttpPipeline CreateBatchPipeline( HttpPipeline pipeline, HttpPipelinePolicy authenticationPolicy, BlobClientOptions.ServiceVersion serviceVersion) { // Configure the options to use minimal policies var options = new BlobClientOptions(serviceVersion); options.Diagnostics.IsLoggingEnabled = false; options.Diagnostics.IsTelemetryEnabled = false; options.Diagnostics.IsDistributedTracingEnabled = false; options.Retry.MaxRetries = 0; // Use an empty transport so requests aren't sent options.Transport = new BatchPipelineTransport(pipeline); // Use the same authentication mechanism return(HttpPipelineBuilder.Build( options, RemoveVersionHeaderPolicy.Shared, authenticationPolicy)); }
public ChangeFeedTestBase(bool async, BlobClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null) : base(async, mode) { _serviceVersion = serviceVersion; }
public CommonTestBase(bool async, BlobClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null) : base(async, mode /* RecordedTestMode.Record to re-record */) { _serviceVersion = serviceVersion; }
public AppendBlobClientOpenWriteTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public ProgressHandlingTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public LazyLoadingBlobStreamTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public StorageSharedKeyCredentialsTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record to re-record */) { }
public BlobChangeFeedExtensionsTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public ImmutableStorageWithVersioningTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public ManagedDiskTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public BlobTestBase(bool async, BlobClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null) : base(async, mode) { _serviceVersion = serviceVersion; BlobsClientBuilder = ClientBuilderExtensions.GetNewBlobsClientBuilder(Tenants, _serviceVersion); }
public EncryptedBlockBlobClientTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
/// <summary> /// Initializes a new instance of the <see cref="AppendBlobClient"/> /// class. /// </summary> /// <param name="blobUri"> /// A <see cref="Uri"/> referencing the append blob that includes the /// name of the account, the name of the container, and the name of /// the blob. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}/{blob_name}". /// </param> /// <param name="pipeline"> /// The transport pipeline used to send every request. /// </param> /// <param name="version"> /// The version of the service to use when sending requests. /// </param> /// <param name="clientDiagnostics">Client diagnostics.</param> /// <param name="customerProvidedKey">Customer provided key.</param> internal AppendBlobClient(Uri blobUri, HttpPipeline pipeline, BlobClientOptions.ServiceVersion version, ClientDiagnostics clientDiagnostics, CustomerProvidedKey?customerProvidedKey) : base(blobUri, pipeline, version, clientDiagnostics, customerProvidedKey) { }
public TenantDiscoveryBlobBaseClientTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion) { }
/// <summary> /// For derived classes to mimic <see cref="BlobClientOpenWriteTests(bool, BlobClientOptions.ServiceVersion)"/> /// and have a place to pass a <see cref="RecordedTestMode"/> through. /// </summary> /// <param name="async"></param> /// <param name="serviceVersion"></param> protected BlobClientOpenWriteTests(bool async, BlobClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode) : base(async, serviceVersion, mode) { }
public AppendBlobClientTransactionalHashingTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
public BlobQuickQueryTests(bool async, BlobClientOptions.ServiceVersion serviceVersion) : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */) { }
/// <summary> /// Creates a new <see cref="ClientBuilder{TServiceClient, TServiceClientOptions}"/> /// setup to generate <see cref="BlobServiceClient"/>s. /// </summary> /// <param name="tenants"><see cref="TenantConfigurationBuilder"/> powering this client builder.</param> /// <param name="serviceVersion">Service version for clients to target.</param> public static BlobsClientBuilder GetNewBlobsClientBuilder(TenantConfigurationBuilder tenants, BlobClientOptions.ServiceVersion serviceVersion) => new BlobsClientBuilder( ServiceEndpoint.Blob, tenants, (uri, clientOptions) => new BlobServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new BlobServiceClient(uri, sharedKeyCredential, clientOptions), (uri, tokenCredential, clientOptions) => new BlobServiceClient(uri, tokenCredential, clientOptions), (uri, azureSasCredential, clientOptions) => new BlobServiceClient(uri, azureSasCredential, clientOptions), () => new BlobClientOptions(serviceVersion));