/// <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); ClientDiagnostics = new ClientDiagnostics(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), options.Version); }
/// <summary> /// Initializes a new instance of the <see cref="DataLakeServiceClient"/> /// class. /// </summary> /// <param name="serviceUri"> /// A <see cref="Uri"/> referencing the Data Lake service. /// </param> /// <param name="authentication"> /// An optional authentication policy used to sign requests. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> /// <param name="clientDiagnostics"></param> internal DataLakeServiceClient( Uri serviceUri, HttpPipelinePolicy authentication, DataLakeClientOptions options, ClientDiagnostics clientDiagnostics) { options ??= new DataLakeClientOptions(); _pipeline = options.Build(authentication); _uri = serviceUri; _blobUri = new DataLakeUriBuilder(serviceUri).ToBlobUri(); _clientDiagnostics = clientDiagnostics ?? new ClientDiagnostics(options); _blobServiceClient = BlobServiceClientInternals.Create( _blobUri, _pipeline, authentication, _clientDiagnostics); }
/// <summary> /// Initializes a new instance of the <see cref="BlobBatchClient"/> /// class for container associated with the <see cref="BlobContainerClient"/>. /// The new <see cref="BlobBatchClient"/> uses the same request policy /// pipeline as the <see cref="BlobContainerClient"/>. /// </summary> /// <param name="client">The <see cref="BlobContainerClient"/>.</param> public BlobBatchClient(BlobContainerClient client) { Uri = client.Uri; BlobServiceClient blobServiceClient = client.GetParentBlobServiceClient(); Pipeline = BlobServiceClientInternals.GetHttpPipeline(blobServiceClient); BlobClientOptions options = BlobServiceClientInternals.GetClientOptions(blobServiceClient); Version = options.Version; ClientDiagnostics = new ClientDiagnostics(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(blobServiceClient), Version); _isContainerScoped = true; }
/// <summary> /// Initializes a new instance of the <see cref="DataLakeServiceClient"/> /// class. /// </summary> /// <param name="serviceUri"> /// A <see cref="Uri"/> referencing the Data Lake service. /// </param> /// <param name="authentication"> /// An optional authentication policy used to sign requests. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> /// <param name="clientDiagnostics"></param> /// <param name="storageSharedKeyCredential"> /// The shared key credential used to sign requests. /// </param> internal DataLakeServiceClient( Uri serviceUri, HttpPipelinePolicy authentication, DataLakeClientOptions options, ClientDiagnostics clientDiagnostics, StorageSharedKeyCredential storageSharedKeyCredential) { options ??= new DataLakeClientOptions(); _pipeline = options.Build(authentication); _uri = serviceUri; _blobUri = new DataLakeUriBuilder(serviceUri).ToBlobUri(); _version = options.Version; _clientDiagnostics = clientDiagnostics ?? new ClientDiagnostics(options); _storageSharedKeyCredential = storageSharedKeyCredential; _blobServiceClient = BlobServiceClientInternals.Create( _blobUri, _pipeline, authentication, Version.AsBlobsVersion(), _clientDiagnostics); }
/// <summary> /// Initializes a new instance of the <see cref="DataLakeServiceClient"/> /// class. /// </summary> /// <param name="connectionString"> /// A connection string includes the authentication information /// required for your application to access data in an Azure Storage /// account at runtime. /// /// For more information, <see href="https://docs.microsoft.com/azure/storage/common/storage-configure-connection-string">Configure Azure Storage connection strings</see>. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> public DataLakeServiceClient(string connectionString, DataLakeClientOptions options) { StorageConnectionString conn = StorageConnectionString.Parse(connectionString); StorageSharedKeyCredential sharedKeyCredential = conn.Credentials as StorageSharedKeyCredential; options ??= new DataLakeClientOptions(); HttpPipelinePolicy authPolicy = sharedKeyCredential.AsPolicy(); _pipeline = options.Build(authPolicy); _uri = conn.BlobEndpoint; _blobUri = new DataLakeUriBuilder(_uri).ToBlobUri(); _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); _storageSharedKeyCredential = sharedKeyCredential; _blobServiceClient = BlobServiceClientInternals.Create( _blobUri, _pipeline, authPolicy, Version.AsBlobsVersion(), _clientDiagnostics); }
/// <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; }