Package com.azure.data.tables.sas
Class TableSasPermission
- java.lang.Object
-
- com.azure.data.tables.sas.TableSasPermission
-
public final class TableSasPermission extends Object
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 withtoStringand set as the permissions field onTableSasSignatureValues.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.
- See Also:
-
Permissions for a table,
TableSasSignatureValues
-
-
Constructor Summary
Constructors Constructor Description TableSasPermission()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasAddPermission()Gets the add permission status.booleanhasDeletePermission()Gets the delete permission status.booleanhasReadPermission()Gets the read permissions status.booleanhasUpdatePermission()Gets the update permission status.static TableSasPermissionparse(String permString)Creates aTableSasPermissionfrom the specified permissions string.TableSasPermissionsetAddPermission(boolean hasAddPermission)Sets the add permission status.TableSasPermissionsetDeletePermission(boolean hasDeletePermission)Sets the process permission status.TableSasPermissionsetReadPermission(boolean hasReadPermission)Sets the read permission status.TableSasPermissionsetUpdatePermission(boolean hasUpdatePermission)Sets the update permission status.StringtoString()Converts the given permissions to aString.
-
-
-
Method Detail
-
parse
public static TableSasPermission parse(String permString)
Creates aTableSasPermissionfrom the specified permissions string. This method will throw anIllegalArgumentExceptionif it encounters a character that does not correspond to a valid permission.- Parameters:
permString- AStringwhich represents theTableSasPermission.- Returns:
- A
TableSasPermissiongenerated from the givenString. - Throws:
IllegalArgumentException- IfpermStringcontains a character other than r, a, u, or d.
-
hasReadPermission
public boolean hasReadPermission()
Gets the read permissions status.- Returns:
trueif the SAS has permission to get entities and query entities.false, otherwise.
-
setReadPermission
public TableSasPermission setReadPermission(boolean hasReadPermission)
Sets the read permission status.- Parameters:
hasReadPermission-trueif 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:
trueif the SAS has permission to add entities to the table.false, otherwise.
-
setAddPermission
public TableSasPermission setAddPermission(boolean hasAddPermission)
Sets the add permission status.- Parameters:
hasAddPermission-trueif the SAS has permission to add entities to the table.false, otherwise.Note: The
addandupdatepermissions are required for upsert operations.- Returns:
- The updated
TableSasPermissionobject.
-
hasUpdatePermission
public boolean hasUpdatePermission()
Gets the update permission status.- Returns:
trueif the SAS has permission to update entities in the table.false, otherwise.
-
setUpdatePermission
public TableSasPermission setUpdatePermission(boolean hasUpdatePermission)
Sets the update permission status.Note: The
addandupdatepermissions are required for upsert operations.- Parameters:
hasUpdatePermission-trueif the SAS has permission to update entities in the table.false, otherwise.- Returns:
- The updated
TableSasPermissionobject.
-
hasDeletePermission
public boolean hasDeletePermission()
Gets the delete permission status.- Returns:
trueif the SAS has permission to delete entities from the table.false, otherwise.
-
setDeletePermission
public TableSasPermission setDeletePermission(boolean hasDeletePermission)
Sets the process permission status.- Parameters:
hasDeletePermission-trueif the SAS has permission to delete entities from the table.false, otherwise.- Returns:
- The updated
TableSasPermissionobject.
-
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 theTableSasPermission.
-
-