ShareSasPermission Class

  • java.lang.Object
    • com.azure.storage.file.share.sas.ShareSasPermission

public final class ShareSasPermission

This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a share. 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 a ShareServiceSasSignatureValues object. 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
ShareSasPermission()

Initializes an ShareSasPermission object with all fields set to false.

Method Summary

Modifier and Type Method and Description
boolean hasCreatePermission()
boolean hasDeletePermission()
boolean hasListPermission()
boolean hasReadPermission()
boolean hasWritePermission()
static ShareSasPermission parse(String permissionString)

Creates an ShareSasPermission from the specified permissions string.

ShareSasPermission setCreatePermission(boolean hasCreatePermission)

Sets the create permission status.

ShareSasPermission setDeletePermission(boolean hasDeletePermission)

Sets the delete permission status.

ShareSasPermission setListPermission(boolean hasListPermission)

Sets the list permission status.

ShareSasPermission setReadPermission(boolean hasReadPermission)

Sets the read permission status.

ShareSasPermission 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

ShareSasPermission

public ShareSasPermission()

Initializes an ShareSasPermission object with all fields set to false.

Method Details

hasCreatePermission

public boolean hasCreatePermission()

Returns:

the create permission status

hasDeletePermission

public boolean hasDeletePermission()

Returns:

the delete permission status

hasListPermission

public boolean hasListPermission()

Returns:

the list permission status

hasReadPermission

public boolean hasReadPermission()

Returns:

the read permission status

hasWritePermission

public boolean hasWritePermission()

Returns:

the write permission status

parse

public static ShareSasPermission parse(String permissionString)

Creates an ShareSasPermission 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:

permissionString - A String which represents the ShareSasPermission.

Returns:

A ShareSasPermission generated from the given String.

setCreatePermission

public ShareSasPermission setCreatePermission(boolean hasCreatePermission)

Sets the create permission status.

Parameters:

hasCreatePermission - Permission status to set

Returns:

the updated ShareSasPermission object

setDeletePermission

public ShareSasPermission setDeletePermission(boolean hasDeletePermission)

Sets the delete permission status.

Parameters:

hasDeletePermission - Permission status to set

Returns:

the updated ShareSasPermission object

setListPermission

public ShareSasPermission setListPermission(boolean hasListPermission)

Sets the list permission status.

Parameters:

hasListPermission - Permission status to set

Returns:

the updated ShareSasPermission object

setReadPermission

public ShareSasPermission setReadPermission(boolean hasReadPermission)

Sets the read permission status.

Parameters:

hasReadPermission - Permission status to set

Returns:

the updated ShareSasPermission object

setWritePermission

public ShareSasPermission setWritePermission(boolean hasWritePermission)

Sets the write permission status.

Parameters:

hasWritePermission - Permission status to set

Returns:

the updated ShareSasPermission object

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:

ShareSasPermission.toString()

Returns:

A String which represents the ShareSasPermission.

Applies to