in syndicate/connection/sqs_connection.py [0:0]
def create_queue(self, queue_name, delay_seconds=None,
maximum_message_size=None, message_retention_period=None,
policy=None, receive_message_wait_time_seconds=None,
redrive_policy=None, visibility_timeout=None,
kms_master_key_id=None,
kms_data_key_reuse_period_seconds=None, fifo_queue=False,
content_based_deduplication=None, tags=None):
attributes = dict()
if fifo_queue:
attributes['FifoQueue'] = str(fifo_queue)
params = dict(QueueName=queue_name)
if delay_seconds:
if delay_seconds < 0 or delay_seconds > 900:
raise AssertionError(
'Delay seconds for queue must be between 0 and 900 seconds')
attributes['DelaySeconds'] = str(delay_seconds)
if maximum_message_size:
if maximum_message_size < 1024 or maximum_message_size > 262144:
raise AssertionError(
'Maximum message size must be between 1024 and 262144 bytes')
attributes['MaximumMessageSize'] = str(maximum_message_size)
if message_retention_period:
if message_retention_period < 60 or message_retention_period > 1209600:
raise AssertionError(
'Message retention size must be between 60 and 1209600 seconds')
attributes['MessageRetentionPeriod'] = str(
message_retention_period)
if policy:
if isinstance(policy, dict):
policy = json.dumps(policy)
attributes['Policy'] = policy
if receive_message_wait_time_seconds:
if receive_message_wait_time_seconds < 0 or receive_message_wait_time_seconds > 20:
raise AssertionError(
'Receive message wait time must be between 0 and 20 seconds')
attributes[
'ReceiveMessageWaitTimeSeconds'] = str(
receive_message_wait_time_seconds)
if redrive_policy:
attributes['RedrivePolicy'] = json.dumps(redrive_policy)
if visibility_timeout:
if visibility_timeout < 0 or visibility_timeout > 43200:
raise AssertionError(
'Visibility timeout must be between 0 and 43200 seconds')
attributes['VisibilityTimeout'] = str(visibility_timeout)
if kms_master_key_id:
attributes['KmsMasterKeyId'] = kms_master_key_id
if kms_data_key_reuse_period_seconds:
if kms_data_key_reuse_period_seconds < 60 or kms_data_key_reuse_period_seconds > 86400:
raise AssertionError(
'KMS key reuse period must be between 60 and 86400 seconds')
attributes[
'KmsDataKeyReusePeriodSeconds'] = str(
kms_data_key_reuse_period_seconds)
if content_based_deduplication:
attributes[
'ContentBasedDeduplication'] = str(content_based_deduplication)
params['Attributes'] = attributes
if tags:
params['tags'] = tags
return self.client.create_queue(**params)