The zaqar.transport.validation module

exception ValidationFailed(msg, *args, **kwargs)

Bases: exceptions.ValueError

User input did not follow API restrictions.

class Validator(conf)

Bases: object

claim_creation(metadata, limit=None)

Restrictions on the claim parameters upon creation.

Parameters:
  • metadata – The claim metadata
  • limit – The number of messages to claim
Raises:

ValidationFailed if either TTL or grace is out of range, or the expected number of messages exceed the limit.

claim_updating(metadata)

Restrictions on the claim TTL.

Parameters:metadata – The claim metadata
Raises:ValidationFailed if the TTL is out of range
message_content(message)

Restrictions on each message.

message_deletion(ids=None, pop=None)

Restrictions involving deletion of messages.

Parameters:
  • ids – message ids passed in by the delete request
  • pop – count of messages to be POPped
Raises:

ValidationFailed if, pop AND id params are present together neither pop or id params are present message count to be popped > maximum allowed

message_length(content_length, max_msg_post_size=None)

Restrictions on message post length.

Parameters:content_length – Queue request’s length.
Raises:ValidationFailed if the metadata is oversize.
message_listing(limit=None, **kwargs)

Restrictions involving a list of messages.

Parameters:
  • limit – The expected number of messages in the list
  • kwargs – Ignored arguments passed to storage API
Raises:

ValidationFailed if the limit is exceeded

message_posting(messages)

Restrictions on a list of messages.

Parameters:messages – A list of messages
Raises:ValidationFailed if any message has a out-of-range TTL.
queue_identification(queue, project)

Restrictions on a project id & queue name pair.

Parameters:
  • queue – Name of the queue
  • project – Project id
Raises:

ValidationFailed if the name is longer than 64 characters or contains anything other than ASCII digits and letters, underscores, and dashes. Also raises if project is not None but longer than 256 characters.

queue_listing(limit=None, **kwargs)

Restrictions involving a list of queues.

Parameters:
  • limit – The expected number of queues in the list
  • kwargs – Ignored arguments passed to storage API
Raises:

ValidationFailed if the limit is exceeded

queue_metadata_length(content_length)

Restrictions on queue’s length.

Parameters:content_length – Queue request’s length.
Raises:ValidationFailed if the metadata is oversize.
queue_metadata_putting(queue_metadata)

Checking if the reserved attributes of the queue are valid.

Parameters:queue_metadata – Queue’s metadata.
Raises:ValidationFailed if any reserved attribute is invalid.
queue_patching(request, changes)
subscription_listing(limit=None, **kwargs)

Restrictions involving a list of subscriptions.

Parameters:
  • limit – The expected number of subscriptions in the list
  • kwargs – Ignored arguments passed to storage API
Raises:

ValidationFailed if the limit is exceeded

subscription_patching(subscription)

Restrictions on an update of subscription.

Parameters:subscription – dict of subscription
Raises:ValidationFailed if the subscription is invalid.
subscription_posting(subscription)

Restrictions on a creation of subscription.

Parameters:subscription – dict of subscription
Raises:ValidationFailed if the subscription is invalid.

Previous topic

The zaqar.transport.utils module

Next topic

The zaqar.transport.websocket.driver module

Project Source

This Page