public final class BlobClientBuilder extends BaseBlobClientBuilder<BlobClientBuilder>
BlobClients
and BlobAsyncClients
when
buildClient
and buildAsyncClient
as called
respectively.
The following information must be provided on this builder:
.endpoint()
, including the container name and blob name, in the format of
https://{accountName}.blob.core.windows.net/{containerName}/{blobName}
.
.credential()
or .connectionString()
if the container is not publicly
accessible.
customerProvidedKey
accountName, endpoint
Constructor and Description |
---|
BlobClientBuilder()
Creates a builder instance that is able to configure and construct
BlobClients and
BlobAsyncClients . |
Modifier and Type | Method and Description |
---|---|
BlobClientBuilder |
blobName(String blobName)
Sets the name of the blob this client is connecting to.
|
BlobAsyncClient |
buildAsyncClient()
Creates a
BlobAsyncClient based on options set in the Builder. |
BlobClient |
buildClient()
Creates a
BlobClient based on options set in the Builder. |
BlobClientBuilder |
containerName(String containerName)
Sets the name of the container this client is connecting to.
|
BlobClientBuilder |
endpoint(String endpoint)
Sets the service endpoint, additionally parses it for information (SAS token, container name, blob name)
|
protected Class<BlobClientBuilder> |
getClazz() |
BlobClientBuilder |
snapshot(String snapshot)
Sets the snapshot of the blob this client is connecting to.
|
applyServiceSpecificValidations, customerProvidedKey, getServiceUrlMidfix, getUserAgentPolicy
addOptionalEncryptionPolicy, addPolicy, buildPipeline, configuration, connectionString, credential, credential, getConfiguration, getPipeline, hasCredential, httpClient, httpLogOptions, pipeline, retryOptions, sasToken, setAnonymousCredential
public BlobClientBuilder()
BlobClients
and
BlobAsyncClients
.public BlobClient buildClient()
BlobClient
based on options set in the Builder. BlobClients are used to perform generic blob
methods such as download
and get
properties
, use this when the blob type is unknown.
Code Samples
BlobClient
client = newBlobClientBuilder
() .connectionString(connectionString) .buildClient();
BlobClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public BlobAsyncClient buildAsyncClient()
BlobAsyncClient
based on options set in the Builder. BlobAsyncClients are used to perform
generic blob methods such as download
and BlobAsyncClientBase.getProperties()
, use this when the blob type is unknown.
Code Samples
BlobAsyncClient
client = newBlobClientBuilder
() .connectionString(connectionString) .buildAsyncClient();
BlobAsyncClient
created from the configurations in this builder.NullPointerException
- If endpoint
, containerName
, or blobName
is null
.public BlobClientBuilder endpoint(String endpoint)
If the endpoint is to a blob in the root container, this method will fail as it will interpret the blob name
as the container name. With only one path element, it is impossible to distinguish between a container name
and a blob in the root container, so it is assumed to be the container name as this is much more common. When
working with blobs in the root container, it is best to set the endpoint to the account url and specify the blob
name separately using the blobName
method.
Code Samples
BlobClient
client = newBlobClientBuilder
() .endpoint(endpoint) .credential(sharedKeyCredential) .buildClient();
endpoint
in class BaseClientBuilder<BlobClientBuilder>
endpoint
- URL of the serviceIllegalArgumentException
- If endpoint
is null
or is a malformed URL.public BlobClientBuilder containerName(String containerName)
Code Samples
BlobClient
client = newBlobClientBuilder
() .endpoint(endpoint) .containerName(containerName) .buildClient();
containerName
- the name of the container. If the value is set to null or empty, it will be interpreted as
the root container, and "$root" will be inserted as the container name.NullPointerException
- If containerName
is null
public BlobClientBuilder blobName(String blobName)
blobName
- the name of the blobNullPointerException
- If blobName
is null
public BlobClientBuilder snapshot(String snapshot)
snapshot
- the snapshot identifier for the blobprotected Class<BlobClientBuilder> getClazz()
getClazz
in class BaseClientBuilder<BlobClientBuilder>
Copyright © 2019 Microsoft Corporation. All rights reserved.