Package com.azure.storage.common.sas
Class AccountSasSignatureValues
- java.lang.Object
-
- com.azure.storage.common.sas.AccountSasSignatureValues
-
public final class AccountSasSignatureValues extends Object
Used to initialize parameters for a Shared Access Signature (SAS) for an Azure Storage account. Once all the values here are set, use the generateSas method on the desired service client to obtain a representation of the SAS which can then be applied to a new client using the .sasToken(String) method on the desired client builder.- See Also:
- Storage SAS overview, Create an account SAS
-
-
Constructor Summary
Constructors Constructor Description AccountSasSignatureValues()
AccountSasSignatureValues(OffsetDateTime expiryTime, AccountSasPermission permissions, AccountSasService services, AccountSasResourceType resourceTypes)
Initializes a newAccountSasSignatureValues
object.
-
Method Summary
-
-
-
Constructor Detail
-
AccountSasSignatureValues
@Deprecated public AccountSasSignatureValues()
Deprecated.Initializes a newAccountSasSignatureValues
object.
-
AccountSasSignatureValues
public AccountSasSignatureValues(OffsetDateTime expiryTime, AccountSasPermission permissions, AccountSasService services, AccountSasResourceType resourceTypes)
Initializes a newAccountSasSignatureValues
object.- Parameters:
expiryTime
- The time after which the SAS will no longer work.permissions
-AccountSasPermission
allowed by the SAS.services
-AccountSasService
targeted by the SAS.resourceTypes
-AccountSasResourceType
targeted by the SAS.
-
-
Method Detail
-
getVersion
public String getVersion()
- Returns:
- the service version that is targeted, if
null
or empty the latest service version targeted by the library will be used.
-
setVersion
@Deprecated public AccountSasSignatureValues setVersion(String version)
Deprecated.The version is set to the latest version of sas. Users should stop calling this API as it is now treated as a no-op.Sets the service version that is targeted. Leave thisnull
or empty to target the version used by the library.- Parameters:
version
- Target version to set- Returns:
- the updated AccountSasSignatureValues object.
-
getProtocol
public SasProtocol getProtocol()
- Returns:
- the
SasProtocol
which determines the HTTP protocol that will be used.
-
setProtocol
public AccountSasSignatureValues setProtocol(SasProtocol protocol)
Sets theSasProtocol
which determines the HTTP protocol that will be used.- Parameters:
protocol
- Protocol to set- Returns:
- the updated AccountSasSignatureValues object.
-
getStartTime
public OffsetDateTime getStartTime()
- Returns:
- when the SAS will take effect.
-
setStartTime
public AccountSasSignatureValues setStartTime(OffsetDateTime startTime)
Sets when the SAS will take effect.- Parameters:
startTime
- Start time to set- Returns:
- the updated AccountSasSignatureValues object.
-
getExpiryTime
public OffsetDateTime getExpiryTime()
- Returns:
- the time after which the SAS will no longer work.
-
setExpiryTime
@Deprecated public AccountSasSignatureValues setExpiryTime(OffsetDateTime expiryTime)
Deprecated.Please useAccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, AccountSasResourceType)
to specify the expiry time.Sets the time after which the SAS will no longer work.- Parameters:
expiryTime
- Expiry time to set- Returns:
- the updated AccountSasSignatureValues object.
-
getPermissions
public String getPermissions()
Gets the operations the SAS user may perform.- Returns:
- The operations the SAS user may perform. Please refer to
AccountSasPermission
to help determine which permissions are allowed.
-
setPermissions
@Deprecated public AccountSasSignatureValues setPermissions(AccountSasPermission permissions)
Deprecated.Please useAccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, AccountSasResourceType)
to specify the allowed permissions.Sets the operations the account SAS user may perform. Please refer toAccountSasPermission
for help constructing the permissions string.- Parameters:
permissions
- Permissions to set.- Returns:
- the updated AccountSasSignatureValues object.
- Throws:
NullPointerException
- ifpermissions
is null.
-
getSasIpRange
public SasIpRange getSasIpRange()
- Returns:
- the
SasIpRange
which determines the IP ranges that are allowed to use the SAS.
-
setSasIpRange
public AccountSasSignatureValues setSasIpRange(SasIpRange sasIpRange)
Sets theSasIpRange
which determines the IP ranges that are allowed to use the SAS.- Parameters:
sasIpRange
- Allowed IP range to set- Returns:
- the updated AccountSasSignatureValues object.
- See Also:
- Specifying IP Address or IP range
-
getServices
public String getServices()
- Returns:
- the services accessible with this SAS. Please refer to
AccountSasService
to help determine which services are accessible.
-
setServices
@Deprecated public AccountSasSignatureValues setServices(String services)
Deprecated.Please useAccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, AccountSasResourceType)
to specify the services being targeted.Sets the services accessible with this SAS. Please refer toAccountSasService
to construct this value.- Parameters:
services
- Allowed services string to set- Returns:
- the updated AccountSasSignatureValues object.
-
getResourceTypes
public String getResourceTypes()
- Returns:
- the resource types accessible with this SAS. Please refer to
AccountSasResourceType
to help determine the resource types that are accessible.
-
setResourceTypes
@Deprecated public AccountSasSignatureValues setResourceTypes(String resourceTypes)
Deprecated.Please useAccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, AccountSasResourceType)
to specify the resource types being targeted.Sets the resource types accessible with this SAS. Please refer toAccountSasResourceType
to construct this value.- Parameters:
resourceTypes
- Allowed resource types string to set- Returns:
- the updated AccountSasSignatureValues object.
-
getEncryptionScope
public String getEncryptionScope()
- Returns:
- An encryption scope that will be applied to any write operations performed with the sas
-
setEncryptionScope
public AccountSasSignatureValues setEncryptionScope(String encryptionScope)
Sets the encryption scope that will be applied to any write operations performed with the sas- Parameters:
encryptionScope
- the encryption scope to set- Returns:
- the updated AccountSasSignatureValues object.
-
generateSasQueryParameters
@Deprecated public AccountSasQueryParameters generateSasQueryParameters(StorageSharedKeyCredential storageSharedKeyCredentials)
Deprecated.Please use the generateAccountSas(AccountSasSignatureValues) method on the desired service client after initializingAccountSasSignatureValues
.Generates aAccountSasQueryParameters
object which contains all SAS query parameters for authenticating requests.Notes on SAS generation
- If
version
is not set, the latest service version is used. - The following parameters are required to generate a SAS:
For samples, see class level JavaDocs.
- Parameters:
storageSharedKeyCredentials
- Credentials for the storage account.- Returns:
- A new
AccountSasQueryParameters
used for authenticating requests. - Throws:
RuntimeException
- If the HMAC-SHA256 signature forstorageSharedKeyCredentials
fails to generate.NullPointerException
- If any ofstorageSharedKeyCredentials
,services
,resourceTypes
,expiryTime
, orpermissions
is null.- See Also:
- Create an account SAS
- If
-
-