public final class SpecializedBlobClientBuilder extends Object
AppendBlobClient
, AppendBlobAsyncClient
, BlockBlobClient
,
BlockBlobAsyncClient
, PageBlobClient
, and PageBlobAsyncClient
. These clients are used to
perform operations that are specific to the blob type.Constructor and Description |
---|
SpecializedBlobClientBuilder() |
Modifier and Type | Method and Description |
---|---|
SpecializedBlobClientBuilder |
addPolicy(HttpPipelinePolicy pipelinePolicy)
Adds a pipeline policy to apply on each request sent.
|
SpecializedBlobClientBuilder |
blobAsyncClient(BlobAsyncClientBase blobAsyncClient)
Configures the builder based on the
BlobAsyncClientBase . |
SpecializedBlobClientBuilder |
blobClient(BlobClientBase blobClient)
Configures the builder based on the
BlobClientBase . |
SpecializedBlobClientBuilder |
blobName(String blobName)
Sets the name of the blob.
|
AppendBlobAsyncClient |
buildAppendBlobAsyncClient()
Creates a
AppendBlobAsyncClient based on options set in the Builder. |
AppendBlobClient |
buildAppendBlobClient()
Creates a
AppendBlobClient based on options set in the Builder. |
BlockBlobAsyncClient |
buildBlockBlobAsyncClient()
Creates a
BlockBlobAsyncClient based on options set in the Builder. |
BlockBlobClient |
buildBlockBlobClient()
Creates a
BlockBlobClient based on options set in the Builder. |
PageBlobAsyncClient |
buildPageBlobAsyncClient()
Creates a
PageBlobAsyncClient based on options set in the Builder. |
PageBlobClient |
buildPageBlobClient()
Creates a
PageBlobClient based on options set in the Builder. |
SpecializedBlobClientBuilder |
configuration(Configuration configuration)
Sets the configuration object used to retrieve environment configuration values during building of the client.
|
SpecializedBlobClientBuilder |
connectionString(String connectionString)
Sets the connection string to connect to the service.
|
SpecializedBlobClientBuilder |
containerAsyncClient(BlobContainerAsyncClient blobContainerAsyncClient,
String blobName)
Configures the builder based on the
BlobContainerAsyncClient and appends the blob name to the container's
URL. |
SpecializedBlobClientBuilder |
containerClient(BlobContainerClient blobContainerClient,
String blobName)
Configures the builder based on the
BlobContainerClient and appends the blob name to the container's URL. |
SpecializedBlobClientBuilder |
containerName(String containerName)
Sets the name of the container that contains the blob.
|
SpecializedBlobClientBuilder |
credential(StorageSharedKeyCredential credential)
Sets the
StorageSharedKeyCredential used to authorize requests sent to the service. |
SpecializedBlobClientBuilder |
credential(TokenCredential credential)
Sets the
TokenCredential used to authorize requests sent to the service. |
SpecializedBlobClientBuilder |
customerProvidedKey(CustomerProvidedKey customerProvidedKey)
Sets the
customer provided key that is used to encrypt blob contents on the server. |
SpecializedBlobClientBuilder |
endpoint(String endpoint)
Sets the service endpoint, additionally parses it for information (SAS token, container name, blob name)
|
static HttpLogOptions |
getDefaultHttpLogOptions()
Gets the default Storage whitelist log headers and query parameters.
|
SpecializedBlobClientBuilder |
httpClient(HttpClient httpClient)
Sets the
HttpClient to use for sending a receiving requests to and from the service. |
SpecializedBlobClientBuilder |
httpLogOptions(HttpLogOptions logOptions)
Sets the
HttpLogOptions for service requests. |
SpecializedBlobClientBuilder |
pipeline(HttpPipeline httpPipeline)
Sets the
HttpPipeline to use for the service client. |
SpecializedBlobClientBuilder |
retryOptions(RequestRetryOptions retryOptions)
Sets the request retry options for all the requests made through the client.
|
SpecializedBlobClientBuilder |
sasToken(String sasToken)
Sets the SAS token used to authorize requests sent to the service.
|
SpecializedBlobClientBuilder |
serviceVersion(BlobServiceVersion version)
Sets the
BlobServiceVersion that is used when making API requests. |
SpecializedBlobClientBuilder |
setAnonymousAccess()
Clears the credential used to authorize the request.
|
SpecializedBlobClientBuilder |
snapshot(String snapshot)
Sets the snapshot identifier of the blob.
|
public AppendBlobClient buildAppendBlobClient()
AppendBlobClient
based on options set in the Builder. AppendBlobClients are used to perform
append blob specific operations such as append block
,
only use this when the blob is known to be an append blob.AppendBlobClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public AppendBlobAsyncClient buildAppendBlobAsyncClient()
AppendBlobAsyncClient
based on options set in the Builder. AppendBlobAsyncClients are used to
perform append blob specific operations such as append
blob
, only use this when the blob is known to be an append blob.AppendBlobAsyncClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public BlockBlobClient buildBlockBlobClient()
BlockBlobClient
based on options set in the Builder. BlockBlobClients are used to perform
generic upload operations such as upload from file
and block
blob specific operations such as stage block
and
BlockBlobClient.commitBlockList(List)
, only use this when the blob is known to be a block blob.BlockBlobClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public BlockBlobAsyncClient buildBlockBlobAsyncClient()
BlockBlobAsyncClient
based on options set in the Builder. BlockBlobAsyncClients are used to
perform generic upload operations such as upload from file
and block blob specific operations such as stage block
and commit block list
, only use
this when the blob is known to be a block blob.BlockBlobAsyncClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public PageBlobClient buildPageBlobClient()
PageBlobClient
based on options set in the Builder. PageBlobClients are used to perform page
blob specific operations such as upload pages
and
clear pages
, only use this when the blob is known to be a page
blob.PageBlobClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public PageBlobAsyncClient buildPageBlobAsyncClient()
PageBlobAsyncClient
based on options set in the Builder. PageBlobAsyncClients are used to
perform page blob specific operations such as upload
pages
and clear pages
, only use this when the blob is known to
be a page blob.PageBlobAsyncClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public SpecializedBlobClientBuilder blobClient(BlobClientBase blobClient)
BlobClientBase
.blobClient
- The BlobClientBase
used to configure this builder.public SpecializedBlobClientBuilder blobAsyncClient(BlobAsyncClientBase blobAsyncClient)
BlobAsyncClientBase
.blobAsyncClient
- The BlobAsyncClientBase
used to configure this builder.public SpecializedBlobClientBuilder containerClient(BlobContainerClient blobContainerClient, String blobName)
BlobContainerClient
and appends the blob name to the container's URL.blobContainerClient
- The ContainerClient
used to configure this builder.blobName
- Name of the blob.public SpecializedBlobClientBuilder containerAsyncClient(BlobContainerAsyncClient blobContainerAsyncClient, String blobName)
BlobContainerAsyncClient
and appends the blob name to the container's
URL.blobContainerAsyncClient
- The ContainerAsyncClient
used to configure this builder.blobName
- Name of the blob.public SpecializedBlobClientBuilder endpoint(String endpoint)
endpoint
- URL of the serviceIllegalArgumentException
- If endpoint
is null
or is a malformed URL.public SpecializedBlobClientBuilder 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 SpecializedBlobClientBuilder 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 SpecializedBlobClientBuilder 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 SpecializedBlobClientBuilder sasToken(String sasToken)
sasToken
- The SAS token to use for authenticating requests.NullPointerException
- If sasToken
is null
.public SpecializedBlobClientBuilder setAnonymousAccess()
This is for blobs that are publicly accessible.
public SpecializedBlobClientBuilder connectionString(String connectionString)
connectionString
- Connection string of the storage account.IllegalArgumentException
- If connectionString
in invalid.public SpecializedBlobClientBuilder containerName(String containerName)
Code Samples
BlobClient
client = newBlobClientBuilder
() .endpoint(endpoint) .containerName(containerName) .buildClient();
containerName
- Name of the container. If the value null
or empty the root container, $root
,
will be used.public SpecializedBlobClientBuilder blobName(String blobName)
blobName
- Name of the blob.NullPointerException
- If blobName
is null
public SpecializedBlobClientBuilder snapshot(String snapshot)
snapshot
- Snapshot identifier for the blob.public SpecializedBlobClientBuilder httpClient(HttpClient httpClient)
HttpClient
to use for sending a receiving requests to and from the service.httpClient
- HttpClient to use for requests.public SpecializedBlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy)
pipelinePolicy
- a pipeline policyNullPointerException
- If pipelinePolicy
is null
.public SpecializedBlobClientBuilder 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 SpecializedBlobClientBuilder configuration(Configuration configuration)
configuration
- Configuration store used to retrieve environment configurations.public SpecializedBlobClientBuilder retryOptions(RequestRetryOptions retryOptions)
retryOptions
- The options used to configure retry behavior.NullPointerException
- If retryOptions
is null
.public SpecializedBlobClientBuilder 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 SpecializedBlobClientBuilder 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.