ShareFileSasPermission Class
- java.
lang. Object - com.
azure. storage. file. share. sas. ShareFileSasPermission
- com.
public final class ShareFileSasPermission
Constructs a string representing the permissions granted by a Service SAS to a file. 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 setPermissions(ShareFileSasPermission permissions).
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
Constructor | Description |
---|---|
ShareFileSasPermission() |
Initializes an |
Method Summary
Modifier and Type | Method and Description |
---|---|
boolean |
hasCreatePermission()
Gets the create permission status. |
boolean |
hasDeletePermission()
Gets the delete permission status. |
boolean |
hasReadPermission()
Gets the read permission status. |
boolean |
hasWritePermission()
Gets the write permission status. |
static
Share |
parse(String permissionString)
Creates an |
Share |
setCreatePermission(boolean hasCreatePermission)
Sets the create permission status. |
Share |
setDeletePermission(boolean hasDeletePermission)
Sets the delete permission status. |
Share |
setReadPermission(boolean hasReadPermission)
Sets the read permission status. |
Share |
setWritePermission(boolean hasWritePermission)
Sets the write permission status. |
String |
toString()
Converts the given permissions to a String. |
Methods inherited from java.lang.Object
Constructor Details
ShareFileSasPermission
public ShareFileSasPermission()
Initializes an ShareFileSasPermission
object with all fields set to false.
Method Details
hasCreatePermission
public boolean hasCreatePermission()
Gets the create permission status.
Returns:
true
if SAS can create a new file or copy a file to a new file. false
, otherwise.hasDeletePermission
public boolean hasDeletePermission()
Gets the delete permission status.
Returns:
true
if SAS can delete a file. false
, otherwise.hasReadPermission
public boolean hasReadPermission()
Gets the read permission status.
Returns:
true
if the SAS can read the content, properties, and metadata for a file. Can use the file as
the source of a copy operation. false
, otherwise.hasWritePermission
public boolean hasWritePermission()
Gets the write permission status.
Returns:
true
if SAS can write content, properties, or metadata to the file. Or, use the file as the
destination of a copy operation. false
, otherwise.parse
public static ShareFileSasPermission parse(String permissionString)
Creates an ShareFileSasPermission
from the specified permissions string. This method will throw an IllegalArgumentException
if it encounters a character that does not correspond to a valid permission.
Parameters:
String
which represents the ShareFileSasPermission
.
Returns:
ShareFileSasPermission
generated from the given String
.setCreatePermission
public ShareFileSasPermission setCreatePermission(boolean hasCreatePermission)
Sets the create permission status.
Parameters:
true
if SAS can create a new file or copy a file to a new file. false
,
otherwise.
Returns:
setDeletePermission
public ShareFileSasPermission setDeletePermission(boolean hasDeletePermission)
Sets the delete permission status.
Parameters:
true
if SAS can delete a file. false
, otherwise.
Returns:
setReadPermission
public ShareFileSasPermission setReadPermission(boolean hasReadPermission)
Sets the read permission status.
Parameters:
true
if the SAS can read the content, properties, and metadata for a file. Can
use the file as the source of a copy operation. false
, otherwise.
Returns:
setWritePermission
public ShareFileSasPermission setWritePermission(boolean hasWritePermission)
Sets the write permission status.
Parameters:
true
if SAS can write content, properties, or metadata to the file. Or, use the
file as the destination of a copy operation. false
, otherwise.
Returns:
toString
public String toString()
Converts the given permissions to a String. Using this method will guarantee the permissions are in an order accepted by the service.
Overrides:
ShareFileSasPermission.toString()Returns:
String
which represents the ShareFileSasPermission
.