public abstract class StorageCredentials extends Object
StorageCredentialsAccountAndKey
and StorageCredentialsSharedAccessSignature
classes.Constructor and Description |
---|
StorageCredentials() |
Modifier and Type | Method and Description |
---|---|
String |
getAccountName()
Returns the associated account name for the credentials.
|
boolean |
isHttpsOnly()
Gets whether this
StorageCredentials object only allows access via HTTPS. |
protected void |
setHttpsOnly(boolean httpsOnly)
Sets whether this
StorageCredentials object only allows access via HTTPS. |
abstract String |
toString(boolean exportSecrets)
Returns a
String that represents this instance. |
StorageUri |
transformUri(StorageUri resourceUri)
Transforms a resource URI into a shared access signature URI, by appending a shared access token.
|
abstract StorageUri |
transformUri(StorageUri resourceUri,
OperationContext opContext)
Transforms a resource URI into a shared access signature URI, by appending a shared access token and using the
specified operation context.
|
URI |
transformUri(URI resourceUri)
Transforms a resource URI into a shared access signature URI, by appending a shared access token.
|
abstract URI |
transformUri(URI resourceUri,
OperationContext opContext)
Transforms a resource URI into a shared access signature URI, by appending a shared access token and using the
specified operation context.
|
protected static StorageCredentials |
tryParseCredentials(Map<String,String> settings)
Tries to determine the storage credentials from a collection of name/value pairs.
|
static StorageCredentials |
tryParseCredentials(String connectionString)
Tries to determine the storage credentials from a connection string.
|
protected static StorageCredentials tryParseCredentials(Map<String,String> settings) throws InvalidKeyException
settings
- A Map
object of the name/value pairs that represent the settings to use to configure
the credentials.
Either include an account name with an account key (specifying values for
CloudStorageAccount.ACCOUNT_NAME_NAME
and CloudStorageAccount.ACCOUNT_KEY_NAME
), or a
shared access signature (specifying a value for
CloudStorageAccount.SHARED_ACCESS_SIGNATURE_NAME
). If you use an account name and account
key, do not include a shared access signature, and vice versa.
StorageCredentials
object representing the storage credentials determined from the name/value
pairs.InvalidKeyException
- If the key value specified for CloudStorageAccount.ACCOUNT_KEY_NAME
is not a valid
Base64-encoded string.public static StorageCredentials tryParseCredentials(String connectionString) throws InvalidKeyException, StorageException
The format for the connection string is in the pattern "keyname=value". Multiple key/value pairs can be separated by a semi-colon, for example, "keyname1=value1;keyname2=value2". Either include an account name with an account key or a shared access signature. If you use an account name and account key, do not include a shared access signature, and vice versa.
The same connection string can be used as for CloudStorageAccount.parse(String)
but here only the account
name, account key, and sas key/value pairs will be examined.
connectionString
- A String
that contains the key/value pairs that represent the storage credentials.StorageCredentials
object representing the storage credentials determined from the connection
string.InvalidKeyException
- If the account key specified in connectionString
is not valid.StorageException
public boolean isHttpsOnly()
StorageCredentials
object only allows access via HTTPS.boolean
representing whether this StorageCredentials
object only allows access via HTTPS.public String getAccountName()
String
that represents the associated account name for the credentialsprotected void setHttpsOnly(boolean httpsOnly)
StorageCredentials
object only allows access via HTTPS.httpsOnly
- A boolean
representing whether this StorageCredentials
object only allows access via HTTPS.public abstract String toString(boolean exportSecrets)
String
that represents this instance.exportSecrets
- true
to include sensitive data in the return string; otherwise, false
.String
that represents this object, optionally including sensitive data.public URI transformUri(URI resourceUri) throws URISyntaxException, StorageException
resourceUri
- A java.net.URI
object that represents the resource URI to be transformed.java.net.URI
object that represents the signature, including the resource URI and the
shared access token.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is not properly formatted.public StorageUri transformUri(StorageUri resourceUri) throws URISyntaxException, StorageException
resourceUri
- A StorageUri
object that represents the resource URI to be transformed.StorageUri
object that represents the signature, including the resource URI and the
shared access token.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is not properly formatted.public abstract URI transformUri(URI resourceUri, OperationContext opContext) throws URISyntaxException, StorageException
resourceUri
- A java.net.URI
object that represents the resource URI to be transformed.opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.java.net.URI
object that represents the signature, including the resource URI and the
shared access token.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is not properly formatted.public abstract StorageUri transformUri(StorageUri resourceUri, OperationContext opContext) throws URISyntaxException, StorageException
resourceUri
- A StorageUri
object that represents the resource URI to be transformed.opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageUri
object that represents the signature, including the resource URI and the
shared access token.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is not properly formatted.Copyright © 2019. All rights reserved.