CloudStorageAccount Class
- java.
lang. Object - com.
microsoft. azure. storage. CloudStorageAccount
- com.
public class CloudStorageAccount
Represents a Microsoft Azure storage account.
Field Summary
Modifier and Type | Field and Description |
---|---|
final String |
ACCOUNT_KEY_NAME
Represents the setting name for the account key. |
final String |
ACCOUNT_NAME_NAME
Represents the setting name for the account name. |
final String |
ACCOUNT_TOKEN_NAME
Represents the setting name for the token credential. |
final String |
BLOB_ENDPOINT_NAME
Represents the setting name for a custom blob storage endpoint. |
final String |
BLOB_SECONDARY_ENDPOINT_NAME
Represents the setting name for a custom blob storage secondary endpoint. |
final String |
QUEUE_ENDPOINT_NAME
Represents the setting name for a custom queue endpoint. |
final String |
QUEUE_SECONDARY_ENDPOINT_NAME
Represents the setting name for a custom queue secondary endpoint. |
final String |
SHARED_ACCESS_SIGNATURE_NAME
Represents the setting name for a shared access key. |
final String |
TABLE_ENDPOINT_NAME
Represents the setting name for a custom table storage endpoint. |
final String |
TABLE_SECONDARY_ENDPOINT_NAME
Represents the setting name for a custom table storage secondary endpoint. |
Constructor Summary
Constructor | Description |
---|---|
CloudStorageAccount(final StorageCredentials storageCredentials) |
Creates an instance of the class using the specified account credentials. With this constructor, the object is constructed using the default HTTP storage service endpoints. The default HTTP storage service endpoints are , , , and , where is the name of your storage account. The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final boolean useHttps) |
Creates an instance of the class using the specified account credentials and the default service endpoints, using HTTP or HTTPS as specified. With this constructor, the object is constructed using the default storage service endpoints. The default storage service endpoints are: ; ; ; and , where is the name of your storage account. Access to the cloud storage account may be via HTTP or HTTPS, as specified by the parameter. The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final boolean useHttps, final String endpointSuffix) |
Creates an instance of the class using the specified account credentials. With this constructor, the object is constructed using the given HTTP storage service endpoint suffix (if any, otherwise the default is used). The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final boolean useHttps, final String endpointSuffix, String accountName) |
Creates an instance of the class using the specified account credentials. With this constructor, the object is constructed using the given HTTP storage service endpoint suffix (if any, otherwise the default is used). The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final StorageUri blobStorageUri, final StorageUri queueStorageUri, final StorageUri tableStorageUri) |
Creates an instance of the class using the specified account credentials and service endpoints. Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account. The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final StorageUri blobStorageUri, final StorageUri queueStorageUri, final StorageUri tableStorageUri, final StorageUri fileStorageUri) |
Creates an instance of the class using the specified account credentials and service endpoints. Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account. The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final URI blobEndpoint, final URI queueEndpoint, final URI tableEndpoint) |
Creates an instance of the class using the specified account credentials and service endpoints. Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account. The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
CloudStorageAccount(final StorageCredentials storageCredentials, final URI blobEndpoint, final URI queueEndpoint, final URI tableEndpoint, final URI fileEndpoint) |
Creates an instance of the class using the specified account credentials and service endpoints. Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account. The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Cloud |
createCloudAnalyticsClient()
Creates a new Analytics service client. |
Cloud |
createCloudBlobClient()
Creates a new Blob service client. |
Cloud |
createCloudFileClient()
Creates a new File service client. |
Cloud |
createCloudQueueClient()
Creates a new Queue service client. |
Cloud |
createCloudTableClient()
Creates a new Table service client. |
String |
generateSharedAccessSignature(SharedAccessAccountPolicy policy)
Returns a shared access signature for the account. |
URI |
getBlobEndpoint()
Returns the endpoint for the Blob service for the storage account. This method is not supported when using shared access signature credentials. |
Storage |
getBlobStorageUri()
Returns the endpoint for the Blob service for the storage account. This method is not supported when using shared access signature credentials. |
Storage |
getCredentials()
Returns the credentials for the storage account. |
Cloud |
getDevelopmentStorageAccount()
Returns a CloudStorageAccount object that represents the development storage credentials. Secondary endpoints are enabled by default. |
Cloud |
getDevelopmentStorageAccount(final URI proxyUri)
Returns a CloudStorageAccount object that represents the development storage credentials, using the specified proxy URI. Secondary endpoints are enabled by default. |
String |
getEndpointSuffix()
If an endpoint suffix was specified, return it |
URI |
getFileEndpoint()
Returns the endpoint for the File service for the storage account. This method is not supported when using shared access signature credentials. |
Storage |
getFileStorageUri()
Returns the endpoint for the File service for the storage account. This method is not supported when using shared access signature credentials. |
URI |
getQueueEndpoint()
Returns the endpoint for the Queue service for the storage account. |
Storage |
getQueueStorageUri()
Returns the endpoint for the Queue service for the storage account. |
URI |
getTableEndpoint()
Returns the endpoint for the Table service for the storage account. |
Storage |
getTableStorageUri()
Returns the endpoint for the Table service for the storage account. |
Cloud |
parse(final String connectionString)
Parses a connection string and returns a cloud storage account created from the connection string. The connection string should be in the Azure connection string format. Note that while a connection string may include a SAS token, it is often easier to use the CloudBlobContainer(final URI uri), CloudQueue(final URI uri), CloudTable(final URI uri) constructors directly. To do this, create a StorageCredentialsSharedAccessSignature(final String token) object with your SAS token, use the transformUri(final URI resourceUri) method on the container, queue, or table URI, and then use that URI to construct the object. |
void |
setCredentials(final StorageCredentials credentials)
Sets the StorageCredentials to use with this account. Warning: for internal use only, as updating the credentials to a new account can invalidate pre-existing objects. |
String |
toString()
Returns a connection string for this storage account, without sensitive data. |
String |
toString(final boolean exportSecrets)
Returns a connection string for this storage account, optionally with sensitive data. |
Field Details
ACCOUNT_KEY_NAME
protected static final String ACCOUNT_KEY_NAME= "AccountKey"
Represents the setting name for the account key.
ACCOUNT_NAME_NAME
protected static final String ACCOUNT_NAME_NAME= "AccountName"
Represents the setting name for the account name.
ACCOUNT_TOKEN_NAME
protected static final String ACCOUNT_TOKEN_NAME= "AccountToken"
Represents the setting name for the token credential.
BLOB_ENDPOINT_NAME
protected static final String BLOB_ENDPOINT_NAME= "BlobEndpoint"
Represents the setting name for a custom blob storage endpoint.
BLOB_SECONDARY_ENDPOINT_NAME
protected static final String BLOB_SECONDARY_ENDPOINT_NAME= "BlobSecondaryEndpoint"
Represents the setting name for a custom blob storage secondary endpoint.
QUEUE_ENDPOINT_NAME
protected static final String QUEUE_ENDPOINT_NAME= "QueueEndpoint"
Represents the setting name for a custom queue endpoint.
QUEUE_SECONDARY_ENDPOINT_NAME
protected static final String QUEUE_SECONDARY_ENDPOINT_NAME= "QueueSecondaryEndpoint"
Represents the setting name for a custom queue secondary endpoint.
SHARED_ACCESS_SIGNATURE_NAME
protected static final String SHARED_ACCESS_SIGNATURE_NAME= "SharedAccessSignature"
Represents the setting name for a shared access key.
TABLE_ENDPOINT_NAME
protected static final String TABLE_ENDPOINT_NAME= "TableEndpoint"
Represents the setting name for a custom table storage endpoint.
TABLE_SECONDARY_ENDPOINT_NAME
protected static final String TABLE_SECONDARY_ENDPOINT_NAME= "TableSecondaryEndpoint"
Represents the setting name for a custom table storage secondary endpoint.
Constructor Details
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials)
Creates an instance of the class using the specified account credentials.
With this constructor, the object is constructed using the default HTTP storage service endpoints. The default HTTP storage service endpoints are , , , and , where is the name of your storage account.
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
Throws:
storageCredentials
specify an invalid account name.
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final boolean useHttps)
Creates an instance of the class using the specified account credentials and the default service endpoints, using HTTP or HTTPS as specified.
With this constructor, the object is constructed using the default storage service endpoints. The default storage service endpoints are: ; ; ; and , where is the name of your storage account. Access to the cloud storage account may be via HTTP or HTTPS, as specified by the parameter.
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
true
to use HTTPS to connect to the storage service endpoints; otherwise, false
.
Throws:
storageCredentials
specify an invalid account name.
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final boolean useHttps, final String endpointSuffix)
Creates an instance of the class using the specified account credentials.
With this constructor, the object is constructed using the given HTTP storage service endpoint suffix (if any, otherwise the default is used).
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
true
to use HTTPS to connect to the storage service endpoints; otherwise, false
.
Throws:
storageCredentials
specify an invalid account name.
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final boolean useHttps, final String endpointSuffix, String accountName)
Creates an instance of the class using the specified account credentials.
With this constructor, the object is constructed using the given HTTP storage service endpoint suffix (if any, otherwise the default is used).
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
true
to use HTTPS to connect to the storage service endpoints; otherwise, false
.
String
that contains the account name. This will be used in place of a null
getAccountName(), but the two must match if both are not null
.
Throws:
storageCredentials
specify an invalid account name.
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final StorageUri blobStorageUri, final StorageUri queueStorageUri, final StorageUri tableStorageUri)
Creates an instance of the class using the specified account credentials and service endpoints.
Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account.
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final StorageUri blobStorageUri, final StorageUri queueStorageUri, final StorageUri tableStorageUri, final StorageUri fileStorageUri)
Creates an instance of the class using the specified account credentials and service endpoints.
Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account.
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final URI blobEndpoint, final URI queueEndpoint, final URI tableEndpoint)
Creates an instance of the class using the specified account credentials and service endpoints.
Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account.
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
java.net.URI
object that represents the Blob service endpoint.
java.net.URI
object that represents the Queue service endpoint.
java.net.URI
object that represents the Table service endpoint.
CloudStorageAccount
public CloudStorageAccount(final StorageCredentials storageCredentials, final URI blobEndpoint, final URI queueEndpoint, final URI tableEndpoint, final URI fileEndpoint)
Creates an instance of the class using the specified account credentials and service endpoints.
Use this constructor to construct a object using custom endpoints, in the case where you've configured a custom domain name for your storage account.
The credentials provided when constructing the object are used to authenticate all further requests against resources that are accessed via the object or a client object created from it. A client object may be a CloudBlobClient object.
Parameters:
java.net.URI
object that represents the Blob service endpoint.
java.net.URI
object that represents the Queue service endpoint.
java.net.URI
object that represents the Table service endpoint.
java.net.URI
object that represents the File service endpoint.
Method Details
createCloudAnalyticsClient
public CloudAnalyticsClient createCloudAnalyticsClient()
Creates a new Analytics service client.
Returns:
createCloudBlobClient
public CloudBlobClient createCloudBlobClient()
Creates a new Blob service client.
Returns:
createCloudFileClient
public CloudFileClient createCloudFileClient()
Creates a new File service client.
Returns:
createCloudQueueClient
public CloudQueueClient createCloudQueueClient()
Creates a new Queue service client.
Returns:
createCloudTableClient
public CloudTableClient createCloudTableClient()
Creates a new Table service client.
Returns:
generateSharedAccessSignature
public String generateSharedAccessSignature(SharedAccessAccountPolicy policy)
Returns a shared access signature for the account.
Parameters:
Returns:
Throws:
getBlobEndpoint
public URI getBlobEndpoint()
Returns the endpoint for the Blob service for the storage account. This method is not supported when using shared access signature credentials.
Returns:
java.net.URI
object that represents the Blob endpoint associated with this account.getBlobStorageUri
public StorageUri getBlobStorageUri()
Returns the endpoint for the Blob service for the storage account. This method is not supported when using shared access signature credentials.
Returns:
getCredentials
public StorageCredentials getCredentials()
Returns the credentials for the storage account.
Returns:
getDevelopmentStorageAccount
public static CloudStorageAccount getDevelopmentStorageAccount()
Returns a CloudStorageAccount object that represents the development storage credentials. Secondary endpoints are enabled by default.
Returns:
getDevelopmentStorageAccount
public static CloudStorageAccount getDevelopmentStorageAccount(final URI proxyUri)
Returns a CloudStorageAccount object that represents the development storage credentials, using the specified proxy URI. Secondary endpoints are enabled by default.
Parameters:
java.net.URI
object that represents the proxy endpoint to use. Specifying null
will use the default http://127.0.0.1
.
Returns:
Throws:
getEndpointSuffix
public String getEndpointSuffix()
If an endpoint suffix was specified, return it
Returns:
getFileEndpoint
public URI getFileEndpoint()
Returns the endpoint for the File service for the storage account. This method is not supported when using shared access signature credentials.
Returns:
java.net.URI
object that represents the File endpoint associated with this account.getFileStorageUri
public StorageUri getFileStorageUri()
Returns the endpoint for the File service for the storage account. This method is not supported when using shared access signature credentials.
Returns:
getQueueEndpoint
public URI getQueueEndpoint()
Returns the endpoint for the Queue service for the storage account.
Returns:
java.net.URI
object that represents the queue endpoint associated with this account.getQueueStorageUri
public StorageUri getQueueStorageUri()
Returns the endpoint for the Queue service for the storage account.
Returns:
getTableEndpoint
public URI getTableEndpoint()
Returns the endpoint for the Table service for the storage account.
Returns:
getTableStorageUri
public StorageUri getTableStorageUri()
Returns the endpoint for the Table service for the storage account.
Returns:
java.net.URI
object that represents the Table endpoint associated with this account.parse
public static CloudStorageAccount parse(final String connectionString)
Parses a connection string and returns a cloud storage account created from the connection string.
The connection string should be in the Azure connection string format.
Note that while a connection string may include a SAS token, it is often easier to use the CloudBlobContainer(final URI uri), CloudQueue(final URI uri), CloudTable(final URI uri) constructors directly. To do this, create a StorageCredentialsSharedAccessSignature(final String token) object with your SAS token, use the transformUri(final URI resourceUri) method on the container, queue, or table URI, and then use that URI to construct the object.
Parameters:
String
that represents the connection string to parse.
Returns:
Throws:
setCredentials
protected void setCredentials(final StorageCredentials credentials)
Sets the StorageCredentials to use with this account. Warning: for internal use only, as updating the credentials to a new account can invalidate pre-existing objects.
Parameters:
toString
public String toString()
Returns a connection string for this storage account, without sensitive data.
Returns:
String
that represents the connection string for this storage account, without sensitive data.toString
public String toString(final boolean exportSecrets)
Returns a connection string for this storage account, optionally with sensitive data.
Parameters:
true
to include sensitive data in the string; otherwise, false
.
Returns:
String
that represents the connection string for this storage account, optionally with sensitive data.Applies to
Azure SDK for Java