Skip to content

Commit

Permalink
docstrings for queues (#6066)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristapratico authored and annatisch committed Jun 25, 2019
1 parent a4c28c6 commit 9b9387b
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 231 deletions.
187 changes: 87 additions & 100 deletions sdk/storage/azure-storage-queue/azure/storage/queue/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,13 @@ class Logging(GeneratedLogging):
All required parameters must be populated in order to send to Azure.
:param version: Required. The version of Storage Analytics to configure.
:type version: str
:param delete: Required. Indicates whether all delete requests should be
logged.
:type delete: bool
:param read: Required. Indicates whether all read requests should be
logged.
:type read: bool
:param write: Required. Indicates whether all write requests should be
logged.
:type write: bool
:param retention_policy: Required.
:type retention_policy: ~azure.storage.queue.models.RetentionPolicy
:ivar str version: Required. The version of Storage Analytics to configure.
:ivar bool delete: Required. Indicates whether all delete requests should be logged.
:ivar bool read: Required. Indicates whether all read requests should be logged.
:ivar bool write: Required. Indicates whether all write requests should be logged.
:ivar retention_policy: Required.
The retention policy for the metrics.
:vartype retention_policy: ~azure.storage.queue.models.RetentionPolicy
"""

def __init__(self, **kwargs):
Expand All @@ -53,15 +47,13 @@ class Metrics(GeneratedMetrics):
All required parameters must be populated in order to send to Azure.
:param version: The version of Storage Analytics to configure.
:type version: str
:param enabled: Required. Indicates whether metrics are enabled for the service.
:type enabled: bool
:param include_ap_is: Indicates whether metrics should generate summary
statistics for called API operations.
:type include_ap_is: bool
:param retention_policy:
:type retention_policy: ~azure.storage.queue.models.RetentionPolicy
:ivar str version: The version of Storage Analytics to configure.
:ivar bool enabled: Required. Indicates whether metrics are enabled for the service.
:ivar bool include_ap_is: Indicates whether metrics should generate summary
statistics for called API operations.
:ivar retention_policy: Required.
The retention policy for the metrics.
:vartype retention_policy: ~azure.storage.queue.models.RetentionPolicy
"""

def __init__(self, **kwargs):
Expand All @@ -72,18 +64,16 @@ def __init__(self, **kwargs):


class RetentionPolicy(GeneratedRetentionPolicy):
"""the retention policy which determines how long the associated data should
"""The retention policy which determines how long the associated data should
persist.
All required parameters must be populated in order to send to Azure.
:param enabled: Required. Indicates whether a retention policy is enabled
for the storage service
:type enabled: bool
:param days: Indicates the number of days that metrics or logging or
soft-deleted data should be retained. All data older than this value will
be deleted
:type days: int
:param bool enabled: Required. Indicates whether a retention policy is enabled
for the storage service.
:param int days: Indicates the number of days that metrics or logging or
soft-deleted data should be retained. All data older than this value will
be deleted.
"""

def __init__(self, enabled=False, days=None):
Expand All @@ -102,29 +92,25 @@ class CorsRule(GeneratedCorsRule):
All required parameters must be populated in order to send to Azure.
:param allowed_origins:
:param list(str) allowed_origins:
A list of origin domains that will be allowed via CORS, or "*" to allow
all domains. The list of must contain at least one entry. Limited to 64
origin domains. Each allowed origin can have up to 256 characters.
:type allowed_origins: list(str)
:param allowed_methods:
:param list(str) allowed_methods:
A list of HTTP methods that are allowed to be executed by the origin.
The list of must contain at least one entry. For Azure Storage,
permitted methods are DELETE, GET, HEAD, MERGE, POST, OPTIONS or PUT.
:type allowed_methods: list(str)
:param int max_age_in_seconds:
The number of seconds that the client/browser should cache a
preflight response.
:param exposed_headers:
pre-flight response.
:param list(str) exposed_headers:
Defaults to an empty list. A list of response headers to expose to CORS
clients. Limited to 64 defined headers and two prefixed headers. Each
header can be up to 256 characters.
:type exposed_headers: list(str)
:param allowed_headers:
:param list(str) allowed_headers:
Defaults to an empty list. A list of headers allowed to be part of
the cross-origin request. Limited to 64 defined headers and 2 prefixed
headers. Each header can be up to 256 characters.
:type allowed_headers: list(str)
"""

def __init__(self, allowed_origins, allowed_methods, **kwargs):
Expand All @@ -136,8 +122,7 @@ def __init__(self, allowed_origins, allowed_methods, **kwargs):


class AccessPolicy(GenAccessPolicy):
'''
Access Policy class used by the set and get acl methods in each service.
"""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.
Expand All @@ -155,64 +140,63 @@ class AccessPolicy(GenAccessPolicy):
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).
'''
:param str 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.
:param 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.
:type expiry: datetime or str
:param 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. Azure will always convert values
to UTC. If a date is passed in without timezone info, it is assumed to
be UTC.
:type start: datetime or str
"""

def __init__(self, permission=None, expiry=None, start=None):
'''
:param str 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.
:param 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.
:type expiry: datetime or str
:param 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. Azure will always convert values
to UTC. If a date is passed in without timezone info, it is assumed to
be UTC.
:type start: datetime or str
'''
self.start = start
self.expiry = expiry
self.permission = permission


class QueueMessage(DictMixin):
'''
Queue message class.
:param str id:
"""Queue message class.
:ivar str id:
A GUID value assigned to the message by the Queue service that
identifies the message in the queue. This value may be used together
with the value of pop_receipt to delete a message from the queue after
it has been retrieved with the get messages operation.
:param date insertion_time:
it has been retrieved with the dequeue messages operation.
:ivar date insertion_time:
A UTC date value representing the time the messages was inserted.
:param date expiration_time:
:ivar date expiration_time:
A UTC date value representing the time the message expires.
:param int dequeue_count:
:ivar int dequeue_count:
Begins with a value of 1 the first time the message is dequeued. This
value is incremented each time the message is subsequently dequeued.
:param obj content:
The message content. Type is determined by the decode_function set on
the service. Default is str.
:param str pop_receipt:
:ivar str pop_receipt:
A receipt str which can be used together with the message_id element to
delete a message from the queue after it has been retrieved with the get
messages operation. Only returned by get messages operations. Set to
delete a message from the queue after it has been retrieved with the dequeue
messages operation. Only returned by dequeue messages operations. Set to
None for peek messages.
:param date time_next_visible:
:ivar date time_next_visible:
A UTC date value representing the time the message will next be visible.
Only returned by get messages operations. Set to None for peek messages.
'''
Only returned by dequeue messages operations. Set to None for peek messages.
"""

def __init__(self, content=None):
self.id = None
Expand All @@ -237,18 +221,16 @@ def _from_generated(cls, generated):


class QueueProperties(DictMixin):
'''
Queue Properties.
"""Queue Properties.
:ivar str name:
The name of the queue.
:ivar str name: The name of the queue.
:ivar metadata:
A dict containing name-value pairs associated with the queue as metadata.
This var is set to None unless the include=metadata param was included
for the list queues operation. If this parameter was specified but the
queue has no metadata, metadata will be set to an empty dictionary.
:vartype metadata: dict(str, str)
'''
"""

def __init__(self, **kwargs):
self.name = None
Expand All @@ -264,7 +246,15 @@ def _from_generated(cls, generated):


class QueuePropertiesPaged(Paged):

"""Queue properties paged.
:param callable command: Function to retrieve the next page of items.
:param str prefix: Filters the results to return only containers whose names
begin with the specified prefix.
:param int results_per_page: The maximum number of queue names to retrieve per
call.
:param str marker: An opaque continuation token.
"""
def __init__(self, command, prefix=None, results_per_page=None, marker=None):
super(QueuePropertiesPaged, self).__init__(command, None)
self.service_endpoint = None
Expand Down Expand Up @@ -313,8 +303,7 @@ def __next__(self):


class QueuePermissions(object):
'''
QueuePermissions class to be used with
"""QueuePermissions class to be used with
:func:`~azure.storage.queue.queue_client.QueueClient.generate_shared_access_signature`
method and for the AccessPolicies used with
:func:`~azure.storage.queue.queue_client.QueueClient.set_queue_access_policy`.
Expand All @@ -328,22 +317,20 @@ class QueuePermissions(object):
Update so you can first get the message you want to update.
:ivar QueuePermissions QueuePermissions.PROCESS: Delete entities.
Get and delete messages from the queue.
'''
:param bool read:
Read metadata and properties, including message count. Peek at messages.
:param bool add:
Add messages to the queue.
:param bool update:
Update messages in the queue. Note: Use the Process permission with
Update so you can first get the message you want to update.
:param bool process:
Get and delete messages from the queue.
:param str _str:
A string representing the permissions.
"""

def __init__(self, read=False, add=False, update=False, process=False, _str=None):
'''
:param bool read:
Read metadata and properties, including message count. Peek at messages.
:param bool add:
Add messages to the queue.
:param bool update:
Update messages in the queue. Note: Use the Process permission with
Update so you can first get the message you want to update.
:param bool process:
Get and delete messages from the queue.
:param str _str:
A string representing the permissions.
'''
if not _str:
_str = ''
self.read = read or ('r' in _str)
Expand Down
Loading

0 comments on commit 9b9387b

Please sign in to comment.