MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / get_queues

Function get_queues

python/example_code/sqs/queue_wrapper.py:72–89  ·  view source on GitHub ↗

Gets a list of SQS queues. When a prefix is specified, only queues with names that start with the prefix are returned. :param prefix: The prefix used to restrict the list of returned queues. :return: A list of Queue objects.

(prefix=None)

Source from the content-addressed store, hash-verified

70
71# snippet-start:[python.example_code.sqs.ListQueues]
72def get_queues(prefix=None):
73 """
74 Gets a list of SQS queues. When a prefix is specified, only queues with names
75 that start with the prefix are returned.
76
77 :param prefix: The prefix used to restrict the list of returned queues.
78 :return: A list of Queue objects.
79 """
80 if prefix:
81 queue_iter = sqs.queues.filter(QueueNamePrefix=prefix)
82 else:
83 queue_iter = sqs.queues.all()
84 queues = list(queue_iter)
85 if queues:
86 logger.info("Got queues: %s", ", ".join([q.url for q in queues]))
87 else:
88 logger.warning("No queues found.")
89 return queues
90
91
92# snippet-end:[python.example_code.sqs.ListQueues]

Callers 1

usage_demoFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected