Package com.azure.storage.queue.sas
Class QueueSasPermission
java.lang.Object
com.azure.storage.queue.sas.QueueSasPermission
Constructs a string representing the permissions granted by an Azure Service SAS to a queue. 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
QueueServiceSasSignatureValues.
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the add permission status.booleanGets the process permission status.booleanGets the read permissions status.booleanGets the update permission status.static QueueSasPermissionCreates aQueueSasPermissionfrom the specified permissions string.setAddPermission(boolean hasAddPermission) Sets the add permission status.setProcessPermission(boolean hasProcessPermission) 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
-
QueueSasPermission
public QueueSasPermission()Initializes aQueueSasPermissionobject with all fields set to false.
-
-
Method Details
-
parse
Creates aQueueSasPermissionfrom 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 theQueueSasPermission.- Returns:
- A
QueueSasPermissiongenerated from the givenString. - Throws:
IllegalArgumentException- IfpermissionStringcontains a character other than r, a, u, or p.
-
hasReadPermission
public boolean hasReadPermission()Gets the read permissions status.- Returns:
trueif SAS has permission to read metadata, properties, message count, peek at messages.false, otherwise.
-
setReadPermission
Sets the read permission status.- Parameters:
hasReadPermission-trueif SAS has permission to read metadata, properties, message count, peek at messages.false, otherwise.- Returns:
- The updated QueueSasPermission object.
-
hasAddPermission
public boolean hasAddPermission()Gets the add permission status.- Returns:
trueif SAS has permission to add messages to the queue.false, otherwise.
-
setAddPermission
Sets the add permission status.- Parameters:
hasAddPermission-trueif SAS has permission to add messages to the queue.false, otherwise.- Returns:
- the updated QueueSasPermission object.
-
hasUpdatePermission
public boolean hasUpdatePermission()Gets the update permission status.- Returns:
trueif SAS has permission to update messages in the queue.false, otherwise.
-
setUpdatePermission
Sets the update permission status.Note: Use
setProcessPermission(true)to get a particular message in the queue to update.- Parameters:
hasUpdatePermission-trueif SAS has permission to update messages in the queue.false, otherwise.- Returns:
- the updated QueueSasPermission object.
-
hasProcessPermission
public boolean hasProcessPermission()Gets the process permission status.- Returns:
trueif SAS has permission to get and delete messages from the queue.false, otherwise.
-
setProcessPermission
Sets the process permission status.- Parameters:
hasProcessPermission-trueif SAS has permission to get and delete messages from the queue.false, otherwise.- Returns:
- the updated QueueSasPermission object.
-
toString
Converts the given permissions to aString. Using this method will guarantee the permissions are in an order accepted by the service.- Overrides:
toStringin classObject- Returns:
- A
Stringwhich represents theQueueSasPermission.
-