AccessPolicy Class

Access Policy class used by the set and get access policy methods.

A stored access policy can specify the start time, expiry time, and permissions for the Shared Access Signatures with which it's associated. Depending on how you want to control access to your resource, you can specify all of these parameters within the stored access policy, and omit them from the URL for the Shared Access Signature. Doing so permits you to modify the associated signature's behavior at any time, as well as to revoke it. Or you can specify one or more of the access policy parameters within the stored access policy, and the others on the URL. Finally, you can specify all of the parameters on the URL. In this case, you can use the stored access policy to revoke the signature, but not to modify its behavior.

Together the Shared Access Signature and the stored access policy must include all fields required to authenticate the signature. If any required fields are missing, the request will fail. Likewise, if a field is specified both in the Shared Access Signature URL and in the stored access policy, the request will fail with status code 400 (Bad Request).

Constructor

AccessPolicy(permission: QueueSasPermissions | str | None = None, expiry: datetime | str | None = None, start: datetime | str | None = None)

Parameters

Name Description
permission

The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy.

Default value: None
expiry

The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

Default value: None
start

The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. The provided datetime will always be interpreted as UTC.

Default value: None

Methods

as_dict

Return a dict that can be serialized using json.dump.

deserialize

Deserialize this model from a dictionary.

enable_additional_properties_sending

Add additional_properties to the attribute map so they are sent to the service.

from_dict

Parse a dict using a given key extractor and return a model.

is_xml_model

Whether this model is serialized as XML.

serialize

Serialize this model to a dictionary.

as_dict

Return a dict that can be serialized using json.dump.

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, dict[str, typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) -> MutableMapping[str, Any]

Parameters

Name Description
keep_readonly

If you want to serialize the readonly attributes.

Default value: True
key_transformer

A function that takes an attribute name, the attribute map, and the value, and returns the key to use in the output dict.

Returns

Type Description
<xref:JSON>

A dict JSON compatible object.

deserialize

Deserialize this model from a dictionary.

deserialize(data: Any, content_type: str | None = None) -> Self

Parameters

Name Description
data
Required
str

A str using RestAPI structure. JSON by default.

content_type
str

JSON by default, set application/xml if XML.

Default value: None

Returns

Type Description

An instance of this model.

enable_additional_properties_sending

Add additional_properties to the attribute map so they are sent to the service.

enable_additional_properties_sending() -> None

Returns

Type Description

None

from_dict

Parse a dict using a given key extractor and return a model.

from_dict(data: Any, key_extractors: Callable[[str, dict[str, Any], Any], Any] | None = None, content_type: str | None = None) -> Self

Parameters

Name Description
data
Required

A dict using RestAPI structure.

key_extractors

A key extractor function.

Default value: None
content_type
str

JSON by default, set application/xml if XML.

Default value: None

Returns

Type Description

An instance of this model.

is_xml_model

Whether this model is serialized as XML.

is_xml_model() -> bool

Returns

Type Description

True if this model is serialized as XML, otherwise False.

serialize

Serialize this model to a dictionary.

serialize(keep_readonly: bool = False, **kwargs: Any) -> MutableMapping[str, Any]

Parameters

Name Description
keep_readonly

If you want to serialize the readonly attributes.

Default value: False

Returns

Type Description
<xref:JSON>

A dict JSON compatible object.

Attributes

expiry

The time at which the shared access signature becomes invalid.

expiry: datetime | str | None

permission

The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions.

permission: QueueSasPermissions | str | None

start

The time at which the shared access signature becomes valid.

start: datetime | str | None