Class: AWS::SQS::QueueCollection
- Inherits:
-
Object
- Object
- AWS::SQS::QueueCollection
- Includes:
- Enumerable
- Defined in:
- lib/aws/sqs/queue_collection.rb
Overview
Represents all the Queue objects in your account.
If you have permission to access a queue created by another account, you can also use this collection to access that queue by URL.
Instance Attribute Summary collapse
-
#prefix ⇒ String
readonly
The queue name prefix by which this collection is filtered.
Instance Method Summary collapse
-
#[](url) ⇒ Queue
The queue with the given URL.
-
#create(name, opts = {}) ⇒ Queue
Creates a new queue.
- #each {|queue| ... } ⇒ Object
-
#with_prefix(prefix) ⇒ QueueCollection
A new collection representing only the queues whose names start with the given prefix.
Instance Attribute Details
#prefix ⇒ String (readonly)
Returns The queue name prefix by which this collection is filtered.
48 49 50 |
# File 'lib/aws/sqs/queue_collection.rb', line 48 def prefix @prefix end |
Instance Method Details
#[](url) ⇒ Queue
Returns The queue with the given URL.
98 99 100 |
# File 'lib/aws/sqs/queue_collection.rb', line 98 def [](url) Queue.new(url, :config => config) end |
#create(name, opts = {}) ⇒ Queue
Note:
If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name.
Creates a new queue.
77 78 79 80 |
# File 'lib/aws/sqs/queue_collection.rb', line 77 def create(name, opts = {}) resp = client.create_queue(opts.merge(:queue_name => name)) Queue.new(resp.queue_url, :config => config) end |
#each {|queue| ... } ⇒ Object
83 84 85 86 87 88 |
# File 'lib/aws/sqs/queue_collection.rb', line 83 def each(&block) client.list_queues.queue_urls.each do |url| queue = self[url] yield(queue) end end |
#with_prefix(prefix) ⇒ QueueCollection
Returns A new collection representing only the queues whose names start with the given prefix.
93 94 95 |
# File 'lib/aws/sqs/queue_collection.rb', line 93 def with_prefix(prefix) self.class.new(:prefix => prefix, :config => config) end |