public final class BlobContainerClientBuilder extends Object
BlobContainerClients
and BlobContainerAsyncClients
, call
buildClient
and buildAsyncClient
respectively to construct an
instance of the desired client.
The following information must be provided on this builder:
.endpoint()
, including the container name, in the format of https://{accountName}.blob.core.windows.net/{containerName}
.
.credential()
or .connectionString()
if the container is not publicly
accessible.
Constructor and Description |
---|
BlobContainerClientBuilder()
Creates a builder instance that is able to configure and construct
ContainerClients
and ContainerAsyncClients . |
Modifier and Type | Method and Description |
---|---|
BlobContainerClientBuilder |
addPolicy(HttpPipelinePolicy pipelinePolicy)
Adds a pipeline policy to apply on each request sent.
|
BlobContainerAsyncClient |
buildAsyncClient()
Code Samples
|
BlobContainerClient |
buildClient()
Code Samples
|
BlobContainerClientBuilder |
configuration(Configuration configuration)
Sets the configuration object used to retrieve environment configuration values during building of the client.
|
BlobContainerClientBuilder |
connectionString(String connectionString)
Sets the connection string to connect to the service.
|
BlobContainerClientBuilder |
containerName(String containerName)
Sets the name of the container.
|
BlobContainerClientBuilder |
credential(StorageSharedKeyCredential credential)
Sets the
StorageSharedKeyCredential used to authorize requests sent to the service. |
BlobContainerClientBuilder |
credential(TokenCredential credential)
Sets the
TokenCredential used to authorize requests sent to the service. |
BlobContainerClientBuilder |
customerProvidedKey(CustomerProvidedKey customerProvidedKey)
Sets the
customer provided key that is used to encrypt blob contents on the server. |
BlobContainerClientBuilder |
endpoint(String endpoint)
Sets the service endpoint, additionally parses it for information (SAS token, container name)
|
static HttpLogOptions |
getDefaultHttpLogOptions()
Gets the default Storage whitelist log headers and query parameters.
|
BlobContainerClientBuilder |
httpClient(HttpClient httpClient)
Sets the
HttpClient to use for sending a receiving requests to and from the service. |
BlobContainerClientBuilder |
httpLogOptions(HttpLogOptions logOptions)
Sets the
HttpLogOptions for service requests. |
BlobContainerClientBuilder |
pipeline(HttpPipeline httpPipeline)
Sets the
HttpPipeline to use for the service client. |
BlobContainerClientBuilder |
retryOptions(RequestRetryOptions retryOptions)
Sets the request retry options for all the requests made through the client.
|
BlobContainerClientBuilder |
sasToken(String sasToken)
Sets the SAS token used to authorize requests sent to the service.
|
BlobContainerClientBuilder |
serviceVersion(BlobServiceVersion version)
Sets the
BlobServiceVersion that is used when making API requests. |
BlobContainerClientBuilder |
setAnonymousAccess()
Clears the credential used to authorize the request.
|
public BlobContainerClientBuilder()
ContainerClients
and ContainerAsyncClients
.public BlobContainerClient buildClient()
Code Samples
BlobContainerClient
client = newBlobContainerClientBuilder
() .connectionString(connectionString) .buildClient();
BlobContainerClient
created from the configurations in this builder.public BlobContainerAsyncClient buildAsyncClient()
Code Samples
BlobContainerAsyncClient
client = newBlobContainerClientBuilder
() .connectionString(connectionString) .buildAsyncClient();
BlobContainerAsyncClient
created from the configurations in this builder.public BlobContainerClientBuilder endpoint(String endpoint)
endpoint
- URL of the serviceIllegalArgumentException
- If endpoint
is null
or is a malformed URL.public BlobContainerClientBuilder customerProvidedKey(CustomerProvidedKey customerProvidedKey)
customer provided key
that is used to encrypt blob contents on the server.customerProvidedKey
- Customer provided key containing the encryption key information.public BlobContainerClientBuilder credential(StorageSharedKeyCredential credential)
StorageSharedKeyCredential
used to authorize requests sent to the service.credential
- The credential to use for authenticating request.NullPointerException
- If credential
is null
.public BlobContainerClientBuilder credential(TokenCredential credential)
TokenCredential
used to authorize requests sent to the service.credential
- The credential to use for authenticating request.NullPointerException
- If credential
is null
.public BlobContainerClientBuilder sasToken(String sasToken)
sasToken
- The SAS token to use for authenticating requests.NullPointerException
- If sasToken
is null
.public BlobContainerClientBuilder setAnonymousAccess()
This is for containers that are publicly accessible.
public BlobContainerClientBuilder connectionString(String connectionString)
connectionString
- Connection string of the storage account.IllegalArgumentException
- If connectionString
in invalid.public BlobContainerClientBuilder containerName(String containerName)
containerName
- Name of the container. If the value null
or empty the root container, $root
, will be used.public BlobContainerClientBuilder httpClient(HttpClient httpClient)
HttpClient
to use for sending a receiving requests to and from the service.httpClient
- HttpClient to use for requests.public BlobContainerClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy)
pipelinePolicy
- a pipeline policyNullPointerException
- If pipelinePolicy
is null
.public BlobContainerClientBuilder httpLogOptions(HttpLogOptions logOptions)
HttpLogOptions
for service requests.logOptions
- The logging configuration to use when sending and receiving HTTP requests/responses.NullPointerException
- If logOptions
is null
.public static HttpLogOptions getDefaultHttpLogOptions()
public BlobContainerClientBuilder configuration(Configuration configuration)
configuration
- Configuration store used to retrieve environment configurations.public BlobContainerClientBuilder retryOptions(RequestRetryOptions retryOptions)
retryOptions
- The options used to configure retry behavior.NullPointerException
- If retryOptions
is null
.public BlobContainerClientBuilder pipeline(HttpPipeline httpPipeline)
HttpPipeline
to use for the service client.
If pipeline
is set, all other settings are ignored, aside from endpoint
.httpPipeline
- HttpPipeline to use for sending service requests and receiving responses.public BlobContainerClientBuilder serviceVersion(BlobServiceVersion version)
BlobServiceVersion
that is used when making API requests.
If a service version is not provided, the service version that will be used will be the latest known service version based on the version of the client library being used. If no service version is specified, updating to a newer version the client library will have the result of potentially moving to a newer service version.
version
- BlobServiceVersion
of the service to be used when making requests.Copyright © 2019 Microsoft Corporation. All rights reserved.