Package com.azure.storage.file.share.sas
Class ShareSasPermission
java.lang.Object
com.azure.storage.file.share.sas.ShareSasPermission
This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a share. Setting
a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all
the values are set, this should be serialized with toString and set as the permissions field on a
ShareServiceSasSignatureValues
object. It is possible to construct the permissions string without this class, but
the order of the permissions is particular and this class guarantees correctness.-
Constructor Summary
ConstructorsConstructorDescriptionInitializes anShareSasPermission
object with all fields set to false. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
boolean
boolean
static ShareSasPermission
Creates anShareSasPermission
from the specified permissions string.setCreatePermission
(boolean hasCreatePermission) Sets the create permission status.setDeletePermission
(boolean hasDeletePermission) Sets the delete permission status.setListPermission
(boolean hasListPermission) Sets the list permission status.setReadPermission
(boolean hasReadPermission) Sets the read permission status.setWritePermission
(boolean hasWritePermission) Sets the write permission status.toString()
Converts the given permissions to aString
.
-
Constructor Details
-
ShareSasPermission
public ShareSasPermission()Initializes anShareSasPermission
object with all fields set to false.
-
-
Method Details
-
parse
Creates anShareSasPermission
from the specified permissions string. This method will throw anIllegalArgumentException
if it encounters a character that does not correspond to a valid permission.- Parameters:
permissionString
- AString
which represents theShareSasPermission
.- Returns:
- A
ShareSasPermission
generated from the givenString
. - Throws:
IllegalArgumentException
- IfpermissionString
contains a character other than r, c, w, d, or l.
-
hasReadPermission
public boolean hasReadPermission()- Returns:
- the read permission status
-
setReadPermission
Sets the read permission status.- Parameters:
hasReadPermission
- Permission status to set- Returns:
- the updated ShareSasPermission object
-
hasCreatePermission
public boolean hasCreatePermission()- Returns:
- the create permission status
-
setCreatePermission
Sets the create permission status.- Parameters:
hasCreatePermission
- Permission status to set- Returns:
- the updated ShareSasPermission object
-
hasWritePermission
public boolean hasWritePermission()- Returns:
- the write permission status
-
setWritePermission
Sets the write permission status.- Parameters:
hasWritePermission
- Permission status to set- Returns:
- the updated ShareSasPermission object
-
hasDeletePermission
public boolean hasDeletePermission()- Returns:
- the delete permission status
-
setDeletePermission
Sets the delete permission status.- Parameters:
hasDeletePermission
- Permission status to set- Returns:
- the updated ShareSasPermission object
-
hasListPermission
public boolean hasListPermission()- Returns:
- the list permission status
-
setListPermission
Sets the list permission status.- Parameters:
hasListPermission
- Permission status to set- Returns:
- the updated ShareSasPermission object
-
toString
Converts the given permissions to aString
. Using this method will guarantee the permissions are in an order accepted by the service.
-