public abstract class StorageCredentials extends Object
StorageCredentialsAccountAndKey
, StorageCredentialsToken
, 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. |
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.
|
static StorageCredentials |
tryParseCredentials(String connectionString)
Tries to determine the storage credentials from a connection 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 credentialspublic 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 © 2018. All Rights Reserved.