Package com.azure.storage.blob.sas
Class BlobSasPermission
- java.lang.Object
-
- com.azure.storage.blob.sas.BlobSasPermission
-
public final class BlobSasPermission extends Object
This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a blob. Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. 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 BlobSasPermission()Initializes aBlobSasPermissionobject with all fields set to false.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasAddPermission()booleanhasCreatePermission()booleanhasDeletePermission()booleanhasDeleteVersionPermission()booleanhasExecutePermission()booleanhasImmutabilityPolicyPermission()booleanhasListPermission()booleanhasMovePermission()booleanhasPermanentDeletePermission()booleanhasReadPermission()booleanhasTagsPermission()booleanhasWritePermission()static BlobSasPermissionparse(String permissionString)Creates aBlobSasPermissionfrom the specified permissions string.BlobSasPermissionsetAddPermission(boolean hasAddPermission)Sets the add permission status.BlobSasPermissionsetCreatePermission(boolean hasCreatePermission)Sets the create permission status.BlobSasPermissionsetDeletePermission(boolean hasDeletePermission)Sets the delete permission status.BlobSasPermissionsetDeleteVersionPermission(boolean hasDeleteVersionPermission)Sets the delete version permission status.BlobSasPermissionsetExecutePermission(boolean hasExecutePermission)Sets the execute permission status.BlobSasPermissionsetImmutabilityPolicyPermission(boolean immutabilityPolicyPermission)Sets the set immutability policy permission status.BlobSasPermissionsetListPermission(boolean hasListPermission)Sets the list permission status.BlobSasPermissionsetMovePermission(boolean hasMovePermission)Sets the move permission status.BlobSasPermissionsetPermanentDeletePermission(boolean permanentDeletePermission)Sets the permanent delete permission status.BlobSasPermissionsetReadPermission(boolean hasReadPermission)Sets the read permission status.BlobSasPermissionsetTagsPermission(boolean tagsPermission)Sets the tags permission status.BlobSasPermissionsetWritePermission(boolean hasWritePermission)Sets the write permission status.StringtoString()Converts the given permissions to aString.
-
-
-
Method Detail
-
parse
public static BlobSasPermission parse(String permissionString)
Creates aBlobSasPermissionfrom 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 theBlobSasPermission.- Returns:
- A
BlobSasPermissiongenerated from the givenString. - Throws:
IllegalArgumentException- IfpermStringcontains a character other than r, a, c, w, d, x, l, t, m, e or i.
-
hasReadPermission
public boolean hasReadPermission()
- Returns:
- the read permission status.
-
setReadPermission
public BlobSasPermission setReadPermission(boolean hasReadPermission)
Sets the read permission status.- Parameters:
hasReadPermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasAddPermission
public boolean hasAddPermission()
- Returns:
- the add permission status.
-
setAddPermission
public BlobSasPermission setAddPermission(boolean hasAddPermission)
Sets the add permission status.- Parameters:
hasAddPermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasCreatePermission
public boolean hasCreatePermission()
- Returns:
- the create permission status.
-
setCreatePermission
public BlobSasPermission setCreatePermission(boolean hasCreatePermission)
Sets the create permission status.- Parameters:
hasCreatePermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasWritePermission
public boolean hasWritePermission()
- Returns:
- the write permission status.
-
setWritePermission
public BlobSasPermission setWritePermission(boolean hasWritePermission)
Sets the write permission status.- Parameters:
hasWritePermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasDeletePermission
public boolean hasDeletePermission()
- Returns:
- the delete permission status.
-
setDeletePermission
public BlobSasPermission setDeletePermission(boolean hasDeletePermission)
Sets the delete permission status.- Parameters:
hasDeletePermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasDeleteVersionPermission
public boolean hasDeleteVersionPermission()
- Returns:
- the delete version permission status.
-
setDeleteVersionPermission
public BlobSasPermission setDeleteVersionPermission(boolean hasDeleteVersionPermission)
Sets the delete version permission status.- Parameters:
hasDeleteVersionPermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasPermanentDeletePermission
public boolean hasPermanentDeletePermission()
- Returns:
- the permanent delete permission status.
-
setPermanentDeletePermission
public BlobSasPermission setPermanentDeletePermission(boolean permanentDeletePermission)
Sets the permanent delete permission status.- Parameters:
permanentDeletePermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasTagsPermission
public boolean hasTagsPermission()
- Returns:
- the tags permission status.
-
setTagsPermission
public BlobSasPermission setTagsPermission(boolean tagsPermission)
Sets the tags permission status.- Parameters:
tagsPermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasListPermission
public boolean hasListPermission()
- Returns:
- the list permission status.
-
setListPermission
public BlobSasPermission setListPermission(boolean hasListPermission)
Sets the list permission status.- Parameters:
hasListPermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasMovePermission
public boolean hasMovePermission()
- Returns:
- the move permission status.
-
setMovePermission
public BlobSasPermission setMovePermission(boolean hasMovePermission)
Sets the move permission status.- Parameters:
hasMovePermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasExecutePermission
public boolean hasExecutePermission()
- Returns:
- the execute permission status.
-
setExecutePermission
public BlobSasPermission setExecutePermission(boolean hasExecutePermission)
Sets the execute permission status.- Parameters:
hasExecutePermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
hasImmutabilityPolicyPermission
public boolean hasImmutabilityPolicyPermission()
- Returns:
- the set immutability policy permission status.
-
setImmutabilityPolicyPermission
public BlobSasPermission setImmutabilityPolicyPermission(boolean immutabilityPolicyPermission)
Sets the set immutability policy permission status.- Parameters:
immutabilityPolicyPermission- Permission status to set- Returns:
- the updated BlobSasPermission object.
-
-