public final class CloudStorageAccount extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
ACCOUNT_KEY_NAME
Represents the setting name for the account key.
|
protected static String |
ACCOUNT_NAME_NAME
Represents the setting name for the account name.
|
protected static String |
BLOB_ENDPOINT_NAME
Represents the setting name for a custom blob storage endpoint.
|
protected static String |
BLOB_SECONDARY_ENDPOINT_NAME
Represents the setting name for a custom blob storage secondary endpoint.
|
protected static String |
QUEUE_ENDPOINT_NAME
Represents the setting name for a custom queue endpoint.
|
protected static String |
QUEUE_SECONDARY_ENDPOINT_NAME
Represents the setting name for a custom queue secondary endpoint.
|
protected static String |
SHARED_ACCESS_SIGNATURE_NAME
Represents the setting name for a shared access key.
|
protected static String |
TABLE_ENDPOINT_NAME
Represents the setting name for a custom table storage endpoint.
|
protected static String |
TABLE_SECONDARY_ENDPOINT_NAME
Represents the setting name for a custom table storage secondary endpoint.
|
Constructor and Description |
---|
CloudStorageAccount(StorageCredentials storageCredentials)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials. |
CloudStorageAccount(StorageCredentials storageCredentials,
boolean useHttps)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials and the default service endpoints, using HTTP or HTTPS as specified. |
CloudStorageAccount(StorageCredentials storageCredentials,
boolean useHttps,
String endpointSuffix)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials. |
CloudStorageAccount(StorageCredentials storageCredentials,
boolean useHttps,
String endpointSuffix,
String accountName)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials. |
CloudStorageAccount(StorageCredentials storageCredentials,
StorageUri blobStorageUri,
StorageUri queueStorageUri,
StorageUri tableStorageUri)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials and service endpoints. |
CloudStorageAccount(StorageCredentials storageCredentials,
StorageUri blobStorageUri,
StorageUri queueStorageUri,
StorageUri tableStorageUri,
StorageUri fileStorageUri)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials and service endpoints. |
CloudStorageAccount(StorageCredentials storageCredentials,
URI blobEndpoint,
URI queueEndpoint,
URI tableEndpoint)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials and service endpoints. |
CloudStorageAccount(StorageCredentials storageCredentials,
URI blobEndpoint,
URI queueEndpoint,
URI tableEndpoint,
URI fileEndpoint)
Creates an instance of the
CloudStorageAccount class using the specified
account credentials and service endpoints. |
Modifier and Type | Method and Description |
---|---|
CloudAnalyticsClient |
createCloudAnalyticsClient()
Creates a new Analytics service client.
|
CloudBlobClient |
createCloudBlobClient()
Creates a new Blob service client.
|
CloudFileClient |
createCloudFileClient()
Creates a new File service client.
|
CloudQueueClient |
createCloudQueueClient()
Creates a new Queue service client.
|
CloudTableClient |
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.
|
StorageUri |
getBlobStorageUri()
Returns the endpoint for the Blob service for the storage account.
|
StorageCredentials |
getCredentials()
Returns the credentials for the storage account.
|
static CloudStorageAccount |
getDevelopmentStorageAccount()
Returns a
CloudStorageAccount object that represents the development storage credentials. |
static CloudStorageAccount |
getDevelopmentStorageAccount(URI proxyUri)
Returns a
CloudStorageAccount object that represents the development storage credentials, using the
specified proxy URI. |
String |
getEndpointSuffix()
If an endpoint suffix was specified, return it
|
URI |
getFileEndpoint()
Returns the endpoint for the File service for the storage account.
|
StorageUri |
getFileStorageUri()
Returns the endpoint for the File service for the storage account.
|
URI |
getQueueEndpoint()
Returns the endpoint for the Queue service for the storage account.
|
StorageUri |
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.
|
StorageUri |
getTableStorageUri()
Returns the endpoint for the Table service for the storage account.
|
static CloudStorageAccount |
parse(String connectionString)
Parses a connection string and returns a cloud storage account created from the connection string.
|
protected void |
setCredentials(StorageCredentials credentials)
Sets the StorageCredentials to use with this account.
|
String |
toString()
Returns a connection string for this storage account, without sensitive data.
|
String |
toString(boolean exportSecrets)
Returns a connection string for this storage account, optionally with sensitive data.
|
protected static final String ACCOUNT_KEY_NAME
protected static final String ACCOUNT_NAME_NAME
protected static final String BLOB_ENDPOINT_NAME
protected static final String BLOB_SECONDARY_ENDPOINT_NAME
protected static final String QUEUE_ENDPOINT_NAME
protected static final String QUEUE_SECONDARY_ENDPOINT_NAME
protected static final String SHARED_ACCESS_SIGNATURE_NAME
protected static final String TABLE_ENDPOINT_NAME
protected static final String TABLE_SECONDARY_ENDPOINT_NAME
public CloudStorageAccount(StorageCredentials storageCredentials) throws URISyntaxException
CloudStorageAccount
class using the specified
account credentials.
With this constructor, the CloudStorageAccount
object is constructed using the
default HTTP storage service endpoints. The default HTTP storage service endpoints are
http://myaccount.blob.core.windows.net
,
http://myaccount.queue.core.windows.net
,
http://myaccount.table.core.windows.net
, and
http://myaccount.file.core.windows.net
, where
myaccount
is the name of your storage account.
The credentials provided when constructing the CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it.
A client object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.URISyntaxException
- If storageCredentials
specify an invalid account name.public CloudStorageAccount(StorageCredentials storageCredentials, boolean useHttps) throws URISyntaxException
CloudStorageAccount
class using the specified
account credentials and the default service endpoints, using HTTP or HTTPS as specified.
With this constructor, the CloudStorageAccount
object is constructed using
the default storage service endpoints. The default storage service endpoints are:
[http|https]://myaccount.blob.core.windows.net
;
[http|https]://myaccount.queue.core.windows.net
;
[http|https]://myaccount.table.core.windows.net
; and
[http|https]://myaccount.file.core.windows.net
,
where myaccount
is the name of your storage account. Access to the cloud
storage account may be via HTTP or HTTPS, as specified by the useHttps
parameter.
The credentials provided when constructing the CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it. A client
object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.useHttps
- true
to use HTTPS to connect to the storage service endpoints;
otherwise, false
.URISyntaxException
- If storageCredentials
specify an invalid account name.public CloudStorageAccount(StorageCredentials storageCredentials, boolean useHttps, String endpointSuffix) throws URISyntaxException
CloudStorageAccount
class using the specified
account credentials.
With this constructor, the CloudStorageAccount
object is constructed using the
given HTTP storage service endpoint suffix (if any, otherwise the default is used).
The credentials provided when constructing the CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it.
A client object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.useHttps
- true
to use HTTPS to connect to the storage service endpoints;
otherwise, false
.endpointSuffix
- A String that represents the endpointSuffix to use, if any.URISyntaxException
- If storageCredentials
specify an invalid account name.public CloudStorageAccount(StorageCredentials storageCredentials, boolean useHttps, String endpointSuffix, String accountName) throws URISyntaxException
CloudStorageAccount
class using the specified
account credentials.
With this constructor, the CloudStorageAccount
object is constructed using the
given HTTP storage service endpoint suffix (if any, otherwise the default is used).
The credentials provided when constructing the CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it.
A client object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.useHttps
- true
to use HTTPS to connect to the storage service endpoints;
otherwise, false
.endpointSuffix
- A String that represents the endpointSuffix to use, if any.accountName
- A String
that contains the account name. This will be used in place of a
null
StorageCredentials.getAccountName()
, but the two must match if
both are not null
.URISyntaxException
- If storageCredentials
specify an invalid account name.public CloudStorageAccount(StorageCredentials storageCredentials, URI blobEndpoint, URI queueEndpoint, URI tableEndpoint)
CloudStorageAccount
class using the specified
account credentials and service endpoints.
Use this constructor to construct a CloudStorageAccount
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 CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it. A
client object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.blobEndpoint
- A java.net.URI
object that represents the Blob service endpoint.queueEndpoint
- A java.net.URI
object that represents the Queue service endpoint.tableEndpoint
- A java.net.URI
object that represents the Table service endpoint.public CloudStorageAccount(StorageCredentials storageCredentials, URI blobEndpoint, URI queueEndpoint, URI tableEndpoint, URI fileEndpoint)
CloudStorageAccount
class using the specified
account credentials and service endpoints.
Use this constructor to construct a CloudStorageAccount
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 CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it. A client
object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.blobEndpoint
- A java.net.URI
object that represents the Blob service endpoint.queueEndpoint
- A java.net.URI
object that represents the Queue service endpoint.tableEndpoint
- A java.net.URI
object that represents the Table service endpoint.fileEndpoint
- A java.net.URI
object that represents the File service endpoint.public CloudStorageAccount(StorageCredentials storageCredentials, StorageUri blobStorageUri, StorageUri queueStorageUri, StorageUri tableStorageUri)
CloudStorageAccount
class using the specified
account credentials and service endpoints.
Use this constructor to construct a CloudStorageAccount
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 CloudStorageAccount
object
are used to authenticate all further requests against resources that are accessed via
the CloudStorageAccount
object or a client object created from it. A client
object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.blobStorageUri
- A StorageUri
object that represents the Blob service endpoint.queueStorageUri
- A StorageUri
object that represents the Queue service endpoint.tableStorageUri
- A StorageUri
object that represents the Table service endpoint.public CloudStorageAccount(StorageCredentials storageCredentials, StorageUri blobStorageUri, StorageUri queueStorageUri, StorageUri tableStorageUri, StorageUri fileStorageUri)
CloudStorageAccount
class using the specified
account credentials and service endpoints.
Use this constructor to construct a CloudStorageAccount
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 CloudStorageAccount
object are
used to authenticate all further requests against resources that are accessed via the
CloudStorageAccount
object or a client object created from it.
A client object may be a CloudBlobClient
object.
storageCredentials
- A StorageCredentials
object that represents the storage credentials
to use to authenticate this account.blobStorageUri
- A StorageUri
object that represents the Blob service endpoint.queueStorageUri
- A StorageUri
object that represents the Queue service endpoint.tableStorageUri
- A StorageUri
object that represents the Table service endpoint.fileStorageUri
- A StorageUri
object that represents the File service endpoint.public static CloudStorageAccount getDevelopmentStorageAccount()
CloudStorageAccount
object that represents the development storage credentials. Secondary
endpoints are enabled by default.CloudStorageAccount
object for the development storage credentials.public static CloudStorageAccount getDevelopmentStorageAccount(URI proxyUri) throws URISyntaxException
CloudStorageAccount
object that represents the development storage credentials, using the
specified proxy URI. Secondary endpoints are enabled by default.proxyUri
- A java.net.URI
object that represents the proxy endpoint to use. Specifying
null
will use the default http://127.0.0.1
.CloudStorageAccount
object for the development storage credentials.URISyntaxException
- If the resource URI is invalid.public static CloudStorageAccount parse(String connectionString) throws URISyntaxException, InvalidKeyException
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.CloudBlobContainer(URI)
, CloudQueue.CloudQueue(URI)
,
CloudTable.CloudTable(URI)
constructors directly. To do this, create a
StorageCredentialsSharedAccessSignature.StorageCredentialsSharedAccessSignature(String)
object with your
SAS token, use the StorageCredentials.transformUri(URI)
method on the container,
queue, or table URI, and then use that URI to construct the object.
connectionString
- A String
that represents the connection string to parse.CloudStorageAccount
object that represents the cloud storage account constructed from the
values provided in the connection string.InvalidKeyException
- If credentials in the connection string contain an invalid key.URISyntaxException
- If the connection string specifies an invalid URI.public CloudAnalyticsClient createCloudAnalyticsClient()
public CloudBlobClient createCloudBlobClient()
CloudBlobClient
that represents the cloud Blob client.public CloudFileClient createCloudFileClient()
CloudFileClient
that represents the cloud File client.public CloudQueueClient createCloudQueueClient()
public CloudTableClient createCloudTableClient()
public URI getBlobEndpoint()
java.net.URI
object that represents the Blob endpoint associated with this account.public StorageUri getBlobStorageUri()
StorageUri
object that represents the Blob endpoint associated with this account.public StorageCredentials getCredentials()
StorageCredentials
object that represents the credentials for this storage account.public String getEndpointSuffix()
public URI getFileEndpoint()
java.net.URI
object that represents the File endpoint associated with this account.public StorageUri getFileStorageUri()
StorageUri
object that represents the File endpoint associated with this account.public URI getQueueEndpoint()
java.net.URI
object that represents the queue endpoint associated with this account.public StorageUri getQueueStorageUri()
StorageUri
object that represents the Queue endpoint associated with this account.public URI getTableEndpoint()
StorageUri
object that represents the Table endpoint associated with this account.public StorageUri getTableStorageUri()
java.net.URI
object that represents the Table endpoint associated with this account.public String generateSharedAccessSignature(SharedAccessAccountPolicy policy) throws InvalidKeyException, StorageException
policy
- A SharedAccessAccountPolicy
specifying the access policy for the shared access signature.StorageException
- If a storage service error occurred.InvalidKeyException
- If the key is invalid.public String toString()
public String toString(boolean exportSecrets)
exportSecrets
- true
to include sensitive data in the string;
otherwise, false
.String
that represents the connection string for this storage account,
optionally with sensitive data.protected void setCredentials(StorageCredentials credentials)
credentials
- the credentials to setCopyright © 2019. All rights reserved.