Class: Aws::SQS::Queue
- Inherits:
-
Object
- Object
- Aws::SQS::Queue
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-sqs/queue.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#attributes ⇒ Hash<String,String>
A map of attributes to their respective values.
- #url ⇒ String
Actions collapse
- #add_permission(options = {}) ⇒ EmptyStructure
- #change_message_visibility_batch(options = {}) ⇒ Types::ChangeMessageVisibilityBatchResult
- #delete(options = {}) ⇒ EmptyStructure
- #delete_messages(options = {}) ⇒ Types::DeleteMessageBatchResult
- #purge(options = {}) ⇒ EmptyStructure
- #receive_messages(options = {}) ⇒ Message::Collection
- #remove_permission(options = {}) ⇒ EmptyStructure
- #send_message(options = {}) ⇒ Types::SendMessageResult
- #send_messages(options = {}) ⇒ Types::SendMessageBatchResult
- #set_attributes(options = {}) ⇒ EmptyStructure
Associations collapse
- #dead_letter_source_queues(options = {}) ⇒ Queue::Collection
- #identifiers ⇒ Object deprecated private Deprecated.
- #message(receipt_handle) ⇒ Message
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::GetQueueAttributesResult
Returns the data for this Queue.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ Queue
constructor
A new instance of Queue.
- #load ⇒ self (also: #reload)
Constructor Details
#initialize(url, options = {}) ⇒ Queue #initialize(options = {}) ⇒ Queue
Returns a new instance of Queue.
22 23 24 25 26 27 28 |
# File 'lib/aws-sdk-sqs/queue.rb', line 22 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @url = extract_url(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#add_permission(options = {}) ⇒ EmptyStructure
126 127 128 129 130 131 132 |
# File 'lib/aws-sdk-sqs/queue.rb', line 126 def ( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#attributes ⇒ Hash<String,String>
A map of attributes to their respective values.
39 40 41 |
# File 'lib/aws-sdk-sqs/queue.rb', line 39 def attributes data[:attributes] end |
#change_message_visibility_batch(options = {}) ⇒ Types::ChangeMessageVisibilityBatchResult
150 151 152 153 154 155 156 |
# File 'lib/aws-sdk-sqs/queue.rb', line 150 def ( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#data ⇒ Types::GetQueueAttributesResult
Returns the data for this Aws::SQS::Queue. Calls Client#get_queue_attributes if #data_loaded? is ‘false`.
71 72 73 74 |
# File 'lib/aws-sdk-sqs/queue.rb', line 71 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
79 80 81 |
# File 'lib/aws-sdk-sqs/queue.rb', line 79 def data_loaded? !!@data end |
#dead_letter_source_queues(options = {}) ⇒ Queue::Collection
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
# File 'lib/aws-sdk-sqs/queue.rb', line 877 def dead_letter_source_queues( = {}) batches = Enumerator.new do |y| = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.list_dead_letter_source_queues() end resp.each_page do |page| batch = [] page.data.queue_urls.each do |q| batch << Queue.new( url: q, client: @client ) end y.yield(batch) end end Queue::Collection.new(batches) end |
#delete(options = {}) ⇒ EmptyStructure
163 164 165 166 167 168 169 |
# File 'lib/aws-sdk-sqs/queue.rb', line 163 def delete( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_queue() end resp.data end |
#delete_messages(options = {}) ⇒ Types::DeleteMessageBatchResult
185 186 187 188 189 190 191 |
# File 'lib/aws-sdk-sqs/queue.rb', line 185 def ( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deprecated.
909 910 911 |
# File 'lib/aws-sdk-sqs/queue.rb', line 909 def identifiers { url: @url } end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::SQS::Queue. Returns ‘self` making it possible to chain methods.
queue.reload.data
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/aws-sdk-sqs/queue.rb', line 56 def load resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.get_queue_attributes( queue_url: @url, attribute_names: ["All"] ) end @data = resp.data self end |
#message(receipt_handle) ⇒ Message
899 900 901 902 903 904 905 |
# File 'lib/aws-sdk-sqs/queue.rb', line 899 def (receipt_handle) Message.new( queue_url: @url, receipt_handle: receipt_handle, client: @client ) end |
#purge(options = {}) ⇒ EmptyStructure
198 199 200 201 202 203 204 |
# File 'lib/aws-sdk-sqs/queue.rb', line 198 def purge( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.purge_queue() end resp.data end |
#receive_messages(options = {}) ⇒ Message::Collection
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/aws-sdk-sqs/queue.rb', line 413 def ( = {}) batch = [] = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data..each do |m| batch << Message.new( queue_url: @url, receipt_handle: m.receipt_handle, data: m, client: @client ) end Message::Collection.new([batch], size: batch.size) end |
#remove_permission(options = {}) ⇒ EmptyStructure
440 441 442 443 444 445 446 |
# File 'lib/aws-sdk-sqs/queue.rb', line 440 def ( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#send_message(options = {}) ⇒ Types::SendMessageResult
617 618 619 620 621 622 623 |
# File 'lib/aws-sdk-sqs/queue.rb', line 617 def ( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#send_messages(options = {}) ⇒ Types::SendMessageBatchResult
660 661 662 663 664 665 666 |
# File 'lib/aws-sdk-sqs/queue.rb', line 660 def ( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.data end |
#set_attributes(options = {}) ⇒ EmptyStructure
862 863 864 865 866 867 868 |
# File 'lib/aws-sdk-sqs/queue.rb', line 862 def set_attributes( = {}) = .merge(queue_url: @url) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.set_queue_attributes() end resp.data end |
#url ⇒ String
33 34 35 |
# File 'lib/aws-sdk-sqs/queue.rb', line 33 def url @url end |