Package com.azure.data.tables.sas
Class TableSasPermission
java.lang.Object
com.azure.data.tables.sas.TableSasPermission
Constructs a string representing the permissions granted by an Azure Service SAS to a table. 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
TableSasSignatureValues.setPermissions(TableSasPermission)
TableSasSignatureValues}.
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the add permission status.boolean
Gets the delete permission status.boolean
Gets the read permissions status.boolean
Gets the update permission status.static TableSasPermission
Creates aTableSasPermission
from the specified permissions string.setAddPermission
(boolean hasAddPermission) Sets the add permission status.setDeletePermission
(boolean hasDeletePermission) Sets the process permission status.setReadPermission
(boolean hasReadPermission) Sets the read permission status.setUpdatePermission
(boolean hasUpdatePermission) Sets the update permission status.toString()
Converts the given permissions to aString
.
-
Constructor Details
-
TableSasPermission
public TableSasPermission()
-
-
Method Details
-
parse
Creates aTableSasPermission
from the specified permissions string. This method will throw anIllegalArgumentException
if it encounters a character that does not correspond to a valid permission.- Parameters:
permString
- AString
which represents theTableSasPermission
.- Returns:
- A
TableSasPermission
generated from the givenString
. - Throws:
IllegalArgumentException
- IfpermString
contains a character other than r, a, u, or d.
-
hasReadPermission
public boolean hasReadPermission()Gets the read permissions status.- Returns:
true
if the SAS has permission to get entities and query entities.false
, otherwise.
-
setReadPermission
Sets the read permission status.- Parameters:
hasReadPermission
-true
if the SAS has permission to get entities and query entities.false
, otherwise- Returns:
- The updated TableSasPermission object.
-
hasAddPermission
public boolean hasAddPermission()Gets the add permission status.- Returns:
true
if the SAS has permission to add entities to the table.false
, otherwise.
-
setAddPermission
Sets the add permission status.- Parameters:
hasAddPermission
-true
if the SAS has permission to add entities to the table.false
, otherwise.Note: The
add
andupdate
permissions are required for upsert operations.- Returns:
- The updated
TableSasPermission
object.
-
hasUpdatePermission
public boolean hasUpdatePermission()Gets the update permission status.- Returns:
true
if the SAS has permission to update entities in the table.false
, otherwise.
-
setUpdatePermission
Sets the update permission status.Note: The
add
andupdate
permissions are required for upsert operations.- Parameters:
hasUpdatePermission
-true
if the SAS has permission to update entities in the table.false
, otherwise.- Returns:
- The updated
TableSasPermission
object.
-
hasDeletePermission
public boolean hasDeletePermission()Gets the delete permission status.- Returns:
true
if the SAS has permission to delete entities from the table.false
, otherwise.
-
setDeletePermission
Sets the process permission status.- Parameters:
hasDeletePermission
-true
if the SAS has permission to delete entities from the table.false
, otherwise.- Returns:
- The updated
TableSasPermission
object.
-
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:
toString
in classObject
- Returns:
- A
String
which represents theTableSasPermission
.
-