Package com.azure.data.tables.sas
Class TableAccountSasPermission
- java.lang.Object
-
- com.azure.data.tables.sas.TableAccountSasPermission
-
public final class TableAccountSasPermission extends Object
This is a helper class to construct a string representing the permissions granted by an Account SAS. 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 on anTableAccountSasSignatureValuesobject.It is possible to construct the permissions string without this class, but the order of the permissions is particular and this class guarantees correctness.
- See Also:
TableAccountSasSignatureValues, Create account SAS
-
-
Constructor Summary
Constructors Constructor Description TableAccountSasPermission()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasAddPermission()Gets the add permission status.booleanhasCreatePermission()Gets the create permission status.booleanhasDeletePermission()Gets the delete permission status.booleanhasDeleteVersionPermission()Gets the delete version permission status.booleanhasFilterTagsPermission()booleanhasListPermission()Gets the list permission status.booleanhasProcessMessages()Gets the process messages permission.booleanhasReadPermission()Gets the read permission status.booleanhasTagsPermission()booleanhasUpdatePermission()Gets the update permission status.booleanhasWritePermission()Gets the write permission status.static TableAccountSasPermissionparse(String permissionsString)Creates anTableAccountSasPermissionfrom the specified permissions string.TableAccountSasPermissionsetAddPermission(boolean hasAddPermission)Sets the add permission status.TableAccountSasPermissionsetCreatePermission(boolean hasCreatePermission)Sets the create permission status.TableAccountSasPermissionsetDeletePermission(boolean hasDeletePermission)Sets the delete permission status.TableAccountSasPermissionsetDeleteVersionPermission(boolean hasDeleteVersionPermission)Sets the delete version permission status.TableAccountSasPermissionsetFilterTagsPermission(boolean filterTagsPermission)Sets the filter tags permission status.TableAccountSasPermissionsetListPermission(boolean hasListPermission)Sets the list permission status.TableAccountSasPermissionsetProcessMessages(boolean hasProcessMessagesPermission)Sets the process messages permission.TableAccountSasPermissionsetReadPermission(boolean hasReadPermission)Sets the read permission status.TableAccountSasPermissionsetTagsPermission(boolean tagsPermission)Sets the tags permission status.TableAccountSasPermissionsetUpdatePermission(boolean hasUpdatePermission)Sets the update permission status.TableAccountSasPermissionsetWritePermission(boolean hasWritePermission)Sets the write permission status.StringtoString()Converts the given permissions to aString.
-
-
-
Method Detail
-
parse
public static TableAccountSasPermission parse(String permissionsString)
Creates anTableAccountSasPermissionfrom the specified permissions string. This method will throw anIllegalArgumentExceptionif it encounters a character that does not correspond to a valid permission.- Parameters:
permissionsString- AStringwhich represents theaccount permissions.- Returns:
- An
TableAccountSasPermissionobject generated from the givenString. - Throws:
IllegalArgumentException- IfpermStringcontains a character other than r, w, d, x, l, a, c, u, p, t or f.
-
hasReadPermission
public boolean hasReadPermission()
Gets the read permission status. Valid for all signed resources types (Service, Container, and Object). Permits read permissions to the specified resource type.- Returns:
- The read permission status.
-
setReadPermission
public TableAccountSasPermission setReadPermission(boolean hasReadPermission)
Sets the read permission status. Valid for all signed resources types (Service, Container, and Object). Permits read permissions to the specified resource type.- Parameters:
hasReadPermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasAddPermission
public boolean hasAddPermission()
Gets the add permission status. Valid for the following Object resource types only: queue messages, table entities, and append blobs.- Returns:
- The add permission status.
-
setAddPermission
public TableAccountSasPermission setAddPermission(boolean hasAddPermission)
Sets the add permission status. Valid for the following Object resource types only: queue messages, table entities, and append blobs.- Parameters:
hasAddPermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasCreatePermission
public boolean hasCreatePermission()
Gets the create permission status. Valid for the following Object resource types only: blobs and files. Users can create new blobs or files, but may not overwrite existing blobs or files.- Returns:
- The create permission status.
-
setCreatePermission
public TableAccountSasPermission setCreatePermission(boolean hasCreatePermission)
Sets the create permission status. Valid for the following Object resource types only: blobs and files. Users can create new blobs or files, but may not overwrite existing blobs or files.- Parameters:
hasCreatePermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasWritePermission
public boolean hasWritePermission()
Gets the write permission status. Valid for all signed resources types (Service, Container, and Object). Permits write permissions to the specified resource type.- Returns:
- The write permission status.
-
setWritePermission
public TableAccountSasPermission setWritePermission(boolean hasWritePermission)
Sets the write permission status. Valid for all signed resources types (Service, Container, and Object). Permits write permissions to the specified resource type.- Parameters:
hasWritePermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasDeletePermission
public boolean hasDeletePermission()
Gets the delete permission status. Valid for Container and Object resource types, except for queue messages.- Returns:
- The delete permission status.
-
setDeletePermission
public TableAccountSasPermission setDeletePermission(boolean hasDeletePermission)
Sets the delete permission status. Valid for Container and Object resource types, except for queue messages.- Parameters:
hasDeletePermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasDeleteVersionPermission
public boolean hasDeleteVersionPermission()
Gets the delete version permission status. Used to delete a blob version- Returns:
- The delete version permission status.
-
setDeleteVersionPermission
public TableAccountSasPermission setDeleteVersionPermission(boolean hasDeleteVersionPermission)
Sets the delete version permission status. Used to delete a blob version- Parameters:
hasDeleteVersionPermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasListPermission
public boolean hasListPermission()
Gets the list permission status. Valid for Service and Container resource types only.- Returns:
- The list permission status.
-
setListPermission
public TableAccountSasPermission setListPermission(boolean hasListPermission)
Sets the list permission status. Valid for Service and Container resource types only.- Parameters:
hasListPermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasUpdatePermission
public boolean hasUpdatePermission()
Gets the update permission status. Valid for the following Object resource types only: queue messages and table entities.- Returns:
- The update permission status.
-
setUpdatePermission
public TableAccountSasPermission setUpdatePermission(boolean hasUpdatePermission)
Sets the update permission status. Valid for the following Object resource types only: queue messages and table entities.- Parameters:
hasUpdatePermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasProcessMessages
public boolean hasProcessMessages()
Gets the process messages permission. Valid for the following Object resource type only: queue messages.- Returns:
- The process messages permission status.
-
setProcessMessages
public TableAccountSasPermission setProcessMessages(boolean hasProcessMessagesPermission)
Sets the process messages permission. Valid for the following Object resource type only: queue messages.- Parameters:
hasProcessMessagesPermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasTagsPermission
public boolean hasTagsPermission()
- Returns:
- The tags permission status. Used to read or write the tags on a blob.
-
setTagsPermission
public TableAccountSasPermission setTagsPermission(boolean tagsPermission)
Sets the tags permission status.- Parameters:
tagsPermission- The permission status to set. Used to read or write the tags on a blob.- Returns:
- The updated
TableAccountSasPermissionobject.
-
hasFilterTagsPermission
public boolean hasFilterTagsPermission()
- Returns:
- The filter tags permission status. Used to filter blobs by their tags.
-
setFilterTagsPermission
public TableAccountSasPermission setFilterTagsPermission(boolean filterTagsPermission)
Sets the filter tags permission status. Used to filter blobs by their tags.- Parameters:
filterTagsPermission- The permission status to set.- Returns:
- The updated
TableAccountSasPermissionobject.
-
toString
public String toString()
Converts the given permissions to aString. Using this method will guarantee the permissions are in an order accepted by the service. If all permissions are set to false, an empty string is returned from this method.- Overrides:
toStringin classObject- Returns:
- A
Stringwhich represents theTableAccountSasPermission.
-
-