Package com.azure.storage.file.share.sas
Class ShareFileSasPermission
- java.lang.Object
-
- com.azure.storage.file.share.sas.ShareFileSasPermission
-
public final class ShareFileSasPermission extends Object
Constructs a string representing the permissions granted by a Service SAS to a file. 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 withtoString()and set as the permissions field onShareServiceSasSignatureValues.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
Constructors Constructor Description ShareFileSasPermission()Initializes anShareFileSasPermissionobject with all fields set to false.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasCreatePermission()Gets the create permission status.booleanhasDeletePermission()Gets the delete permission status.booleanhasReadPermission()Gets the read permission status.booleanhasWritePermission()Gets the write permission status.static ShareFileSasPermissionparse(String permissionString)Creates anShareFileSasPermissionfrom the specified permissions string.ShareFileSasPermissionsetCreatePermission(boolean hasCreatePermission)Sets the create permission status.ShareFileSasPermissionsetDeletePermission(boolean hasDeletePermission)Sets the delete permission status.ShareFileSasPermissionsetReadPermission(boolean hasReadPermission)Sets the read permission status.ShareFileSasPermissionsetWritePermission(boolean hasWritePermission)Sets the write permission status.StringtoString()Converts the given permissions to aString.
-
-
-
Method Detail
-
parse
public static ShareFileSasPermission parse(String permissionString)
Creates anShareFileSasPermissionfrom the specified permissions string. This method will throw anIllegalArgumentExceptionif it encounters a character that does not correspond to a valid permission.- Parameters:
permissionString- AStringwhich represents theShareFileSasPermission.- Returns:
- A
ShareFileSasPermissiongenerated from the givenString. - Throws:
IllegalArgumentException- IfpermissionStringcontains a character other than r, c, w, or d.
-
hasReadPermission
public boolean hasReadPermission()
Gets the read permission status.- Returns:
trueif the SAS can read the content, properties, and metadata for a file. Can use the file as the source of a copy operation.false, otherwise.
-
setReadPermission
public ShareFileSasPermission setReadPermission(boolean hasReadPermission)
Sets the read permission status.- Parameters:
hasReadPermission-trueif the SAS can read the content, properties, and metadata for a file. Can use the file as the source of a copy operation.false, otherwise.- Returns:
- the updated ShareFileSasPermission object
-
hasCreatePermission
public boolean hasCreatePermission()
Gets the create permission status.- Returns:
trueif SAS can create a new file or copy a file to a new file.false, otherwise.
-
setCreatePermission
public ShareFileSasPermission setCreatePermission(boolean hasCreatePermission)
Sets the create permission status.- Parameters:
hasCreatePermission-trueif SAS can create a new file or copy a file to a new file.false, otherwise.- Returns:
- the updated ShareFileSasPermission object
-
hasWritePermission
public boolean hasWritePermission()
Gets the write permission status.- Returns:
trueif SAS can write content, properties, or metadata to the file. Or, use the file as the destination of a copy operation.false, otherwise.
-
setWritePermission
public ShareFileSasPermission setWritePermission(boolean hasWritePermission)
Sets the write permission status.- Parameters:
hasWritePermission-trueif SAS can write content, properties, or metadata to the file. Or, use the file as the destination of a copy operation.false, otherwise.- Returns:
- the updated ShareFileSasPermission object
-
hasDeletePermission
public boolean hasDeletePermission()
Gets the delete permission status.- Returns:
trueif SAS can delete a file.false, otherwise.
-
setDeletePermission
public ShareFileSasPermission setDeletePermission(boolean hasDeletePermission)
Sets the delete permission status.- Parameters:
hasDeletePermission-trueif SAS can delete a file.false, otherwise.- Returns:
- the updated ShareFileSasPermission object
-
-