共用方式為


ShareServiceSasSignatureValues Class

  • java.lang.Object
    • com.azure.storage.file.share.sas.ShareServiceSasSignatureValues

public final class ShareServiceSasSignatureValues

Used to initialize parameters for a Shared Access Signature (SAS) for an Azure File Storage service. Once all the values here are set, use the appropriate SAS generation method on the desired share/file/directory 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.

Constructor Summary

Constructor Description
ShareServiceSasSignatureValues()

Deprecated

Creates an object with empty values for all fields.

ShareServiceSasSignatureValues(String identifier)

Creates an object with the specified identifier.

ShareServiceSasSignatureValues(OffsetDateTime expiryTime, ShareFileSasPermission permissions)

Creates an object with the specified expiry time and permissions

ShareServiceSasSignatureValues(OffsetDateTime expiryTime, ShareSasPermission permissions)

Creates an object with the specified expiry time and permissions

Method Summary

Modifier and Type Method and Description
ShareServiceSasQueryParameters generateSasQueryParameters(StorageSharedKeyCredential storageSharedKeyCredentials)

Deprecated

Please use the generateSas(ShareServiceSasSignatureValues) method on the desired share/file/directory client after initializing ShareServiceSasSignatureValues.

Uses an account's shared key credential to sign these signature values to produce the proper SAS query parameters.

String getCacheControl()
String getContentDisposition()
String getContentEncoding()
String getContentLanguage()
String getContentType()
OffsetDateTime getExpiryTime()
String getFilePath()

Deprecated

File path is now auto-populated by the SAS generation methods provided on the desired file/directory client.

Gets the path of the file or directory being made accessible.

String getIdentifier()
String getPermissions()
SasProtocol getProtocol()
SasIpRange getSasIpRange()
String getShareName()

Deprecated

Share name is now auto-populated by the SAS generation methods provided on the desired share/file/directory client.

Gets the name of the share being made accessible.

OffsetDateTime getStartTime()
String getVersion()
ShareServiceSasSignatureValues setCacheControl(String cacheControl)

Sets the cache-control header for the SAS.

ShareServiceSasSignatureValues setContentDisposition(String contentDisposition)

Sets the content-disposition header for the SAS.

ShareServiceSasSignatureValues setContentEncoding(String contentEncoding)

Sets the content-encoding header for the SAS.

ShareServiceSasSignatureValues setContentLanguage(String contentLanguage)

Sets the content-language header for the SAS.

ShareServiceSasSignatureValues setContentType(String contentType)

Sets the content-type header for the SAS.

ShareServiceSasSignatureValues setExpiryTime(OffsetDateTime expiryTime)

Sets the time after which the SAS will no longer work.

ShareServiceSasSignatureValues setFilePath(String filePath)

Deprecated

Please use the generateSas methods provided on the desired file/directory client that will auto-populate the file path.

Sets the path of the file or directory being made accessible.

ShareServiceSasSignatureValues setIdentifier(String identifier)

Sets the name of the access policy on the share this SAS references if any.

ShareServiceSasSignatureValues setPermissions(ShareFileSasPermission permissions)

Sets the permissions allowed by the SAS.

ShareServiceSasSignatureValues setPermissions(ShareSasPermission permissions)

Sets the permissions allowed by the SAS.

ShareServiceSasSignatureValues setProtocol(SasProtocol protocol)

Sets the SasProtocol which determines the protocols allowed by the SAS.

ShareServiceSasSignatureValues setSasIpRange(SasIpRange sasIpRange)

Sets the SasIpRange which determines the IP ranges that are allowed to use the SAS.

ShareServiceSasSignatureValues setShareName(String shareName)

Deprecated

Please use the generateSas methods provided on the desired share/file/directory client that will auto-populate the share name.

Sets the name of the share being made accessible.

ShareServiceSasSignatureValues setStartTime(OffsetDateTime startTime)

Sets when the SAS will take effect.

ShareServiceSasSignatureValues 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 version of the service this SAS will target.

Methods inherited from java.lang.Object

Constructor Details

ShareServiceSasSignatureValues

public ShareServiceSasSignatureValues(String identifier)

Creates an object with the specified identifier.

Parameters:

identifier - Name of the access policy.

ShareServiceSasSignatureValues

public ShareServiceSasSignatureValues(OffsetDateTime expiryTime, ShareFileSasPermission permissions)

Creates an object with the specified expiry time and permissions

Parameters:

expiryTime - The time after which the SAS will no longer work.
permissions - ShareFileSasPermission allowed by the SAS.

ShareServiceSasSignatureValues

public ShareServiceSasSignatureValues(OffsetDateTime expiryTime, ShareSasPermission permissions)

Creates an object with the specified expiry time and permissions

Parameters:

expiryTime - The time after which the SAS will no longer work.
permissions - ShareSasPermission allowed by the SAS.

Method Details

generateSasQueryParameters

@Deprecated
public ShareServiceSasQueryParameters generateSasQueryParameters(StorageSharedKeyCredential storageSharedKeyCredentials)

Deprecated

Please use the generateSas(ShareServiceSasSignatureValues) method on the desired share/file/directory client after initializing ShareServiceSasSignatureValues.

Uses an account's shared key credential to sign these signature values to produce the proper SAS query parameters.

Notes on SAS generation

The type of SAS query parameters returned depends on the following:

  1. If getFilePath() is not set, query parameters for a share SAS are returned.
  2. Otherwise, getShareName() and getFilePath() are used to create query parameters for a file SAS.

See class level JavaDocs for code snippets.

Parameters:

storageSharedKeyCredentials - A StorageSharedKeyCredential object used to sign the SAS values.

Returns:

getCacheControl

public String getCacheControl()

Returns:

the cache-control header for the SAS.

getContentDisposition

public String getContentDisposition()

Returns:

the content-disposition header for the SAS.

getContentEncoding

public String getContentEncoding()

Returns:

the content-encoding header for the SAS.

getContentLanguage

public String getContentLanguage()

Returns:

the content-language header for the SAS.

getContentType

public String getContentType()

Returns:

the content-type header for the SAS.

getExpiryTime

public OffsetDateTime getExpiryTime()

Returns:

the time after which the SAS will no longer work.

getFilePath

@Deprecated
public String getFilePath()

Deprecated

File path is now auto-populated by the SAS generation methods provided on the desired file/directory client.

Gets the path of the file or directory being made accessible. null or an empty string for a share SAS.

Returns:

The path of the file or directory being made accessible. null or an empty string for a share SAS.

getIdentifier

public String getIdentifier()

Returns:

the name of the access policy on the share this SAS references if any. Please see Establishing a stored access policy for more information.

getPermissions

public String getPermissions()

Returns:

the permissions string allowed by the SAS. Please refer to either ShareSasPermission or ShareFileSasPermission depending on the resource being accessed for help determining the permissions allowed.

getProtocol

public SasProtocol getProtocol()

Returns:

the SasProtocol which determines the protocols allowed by the SAS.

getSasIpRange

public SasIpRange getSasIpRange()

Returns:

the SasIpRange which determines the IP ranges that are allowed to use the SAS.

getShareName

@Deprecated
public String getShareName()

Deprecated

Share name is now auto-populated by the SAS generation methods provided on the desired share/file/directory client.

Gets the name of the share being made accessible.

Returns:

The name of the share being made accessible.

getStartTime

public OffsetDateTime getStartTime()

Returns:

when the SAS will take effect.

getVersion

public String getVersion()

Returns:

the version of the service this SAS will target. If not specified, it will default to the version targeted by the library.

setCacheControl

public ShareServiceSasSignatureValues setCacheControl(String cacheControl)

Sets the cache-control header for the SAS.

Parameters:

cacheControl - Cache-Control header value

Returns:

the updated FileServiceSasSignatureValues object

setContentDisposition

public ShareServiceSasSignatureValues setContentDisposition(String contentDisposition)

Sets the content-disposition header for the SAS.

Parameters:

contentDisposition - Content-Disposition header value

Returns:

the updated FileServiceSasSignatureValues object

setContentEncoding

public ShareServiceSasSignatureValues setContentEncoding(String contentEncoding)

Sets the content-encoding header for the SAS.

Parameters:

contentEncoding - Content-Encoding header value

Returns:

the updated FileServiceSasSignatureValues object

setContentLanguage

public ShareServiceSasSignatureValues setContentLanguage(String contentLanguage)

Sets the content-language header for the SAS.

Parameters:

contentLanguage - Content-Language header value

Returns:

the updated FileServiceSasSignatureValues object

setContentType

public ShareServiceSasSignatureValues setContentType(String contentType)

Sets the content-type header for the SAS.

Parameters:

contentType - Content-Type header value

Returns:

the updated FileServiceSasSignatureValues object

setExpiryTime

public ShareServiceSasSignatureValues setExpiryTime(OffsetDateTime expiryTime)

Sets the time after which the SAS will no longer work.

Parameters:

expiryTime - When the SAS will no longer work

Returns:

the updated FileServiceSasSignatureValues object

setFilePath

@Deprecated
public ShareServiceSasSignatureValues setFilePath(String filePath)

Deprecated

Please use the generateSas methods provided on the desired file/directory client that will auto-populate the file path.

Sets the path of the file or directory being made accessible. Pass in null or an empty string for a share SAS.

Parameters:

filePath - The name of the share being made accessible.

Returns:

the updated FileServiceSasSignatureValues object

setIdentifier

public ShareServiceSasSignatureValues setIdentifier(String identifier)

Sets the name of the access policy on the share this SAS references if any. Please see Establishing a stored access policy for more information.

Parameters:

identifier - Name of the stored access policy

Returns:

the updated FileServiceSasSignatureValues object

setPermissions

public ShareServiceSasSignatureValues setPermissions(ShareFileSasPermission permissions)

Sets the permissions allowed by the SAS. Share file SASs are created when both a setShareName(String shareName) and setFilePath(String filePath) are set on the builder.

Parameters:

permissions - Permissions for the SAS.

Returns:

the updated FileServiceSasSignatureValues object

setPermissions

public ShareServiceSasSignatureValues setPermissions(ShareSasPermission permissions)

Sets the permissions allowed by the SAS. Share SASs are created when only setShareName(String shareName) is set on the builder.

Parameters:

permissions - Permissions for the share SAS.

Returns:

the updated FileServiceSasSignatureValues object.

setProtocol

public ShareServiceSasSignatureValues setProtocol(SasProtocol protocol)

Sets the SasProtocol which determines the protocols allowed by the SAS.

Parameters:

protocol - Protocol for the SAS

Returns:

the updated FileServiceSasSignatureValues object

setSasIpRange

public ShareServiceSasSignatureValues setSasIpRange(SasIpRange sasIpRange)

Sets the SasIpRange which determines the IP ranges that are allowed to use the SAS.

Parameters:

sasIpRange - Allowed IP range to set

Returns:

the updated FileServiceSasSignatureValues object

setShareName

@Deprecated
public ShareServiceSasSignatureValues setShareName(String shareName)

Deprecated

Please use the generateSas methods provided on the desired share/file/directory client that will auto-populate the share name.

Sets the name of the share being made accessible.

Parameters:

shareName - The name of the share being made accessible.

Returns:

the updated FileServiceSasSignatureValues object

setStartTime

public ShareServiceSasSignatureValues setStartTime(OffsetDateTime startTime)

Sets when the SAS will take effect.

Parameters:

startTime - When the SAS takes effect

Returns:

the updated FileServiceSasSignatureValues object

setVersion

@Deprecated
public ShareServiceSasSignatureValues 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 version of the service this SAS will target. If not specified, it will default to the version targeted by the library.

Parameters:

version - Version to target

Returns:

the updated FileServiceSasSignatureValues object

Applies to