Module: Cumulus::SQS
- Defined in:
- lib/sqs/SQS.rb,
lib/sqs/Commands.rb,
lib/sqs/loader/Loader.rb,
lib/sqs/manager/Manager.rb,
lib/sqs/models/QueueDiff.rb,
lib/sqs/models/QueueConfig.rb,
lib/sqs/models/DeadLetterDiff.rb,
lib/sqs/models/DeadLetterConfig.rb
Defined Under Namespace
Modules: DeadLetterChange, Loader, QueueChange Classes: Commands, DeadLetterConfig, DeadLetterDiff, Manager, QueueConfig, QueueDiff
Constant Summary collapse
- @@client =
Aws::SQS::Client.new(Configuration.instance.client)
Class Method Summary collapse
-
.client ⇒ Object
Public Returns the AWS client used in the module.
-
.get_arn(queue_name) ⇒ Object
Public: Static method that will get the ARN of a Queue.
-
.queue_arns ⇒ Object
Public: Returns a mapping of queue name to ARN.
-
.queue_attributes ⇒ Object
Public: Return a mapping of queue name to attributes.
-
.queue_policy(queue_name) ⇒ Object
Public: Return the policy of a queue as a Hash.
-
.queue_urls ⇒ Object
Public: Return a mapping of queue name to url.
Class Method Details
.client ⇒ Object
Public Returns the AWS client used in the module
13 14 15 |
# File 'lib/sqs/SQS.rb', line 13 def client @@client end |
.get_arn(queue_name) ⇒ Object
Public: Static method that will get the ARN of a Queue
name - the name of the queue to get
Returns the String ARN
22 23 24 25 26 27 |
# File 'lib/sqs/SQS.rb', line 22 def get_arn(queue_name) queue_arns.fetch(queue_name) rescue KeyError puts Colors.red("No SQS queue named #{queue_name}") exit 1 end |
.queue_arns ⇒ Object
Public: Returns a mapping of queue name to ARN
30 31 32 |
# File 'lib/sqs/SQS.rb', line 30 def queue_arns @queue_arns ||= Hash[queue_attributes.map { |name, attrs| [name, attrs["QueueArn"]] }] end |
.queue_attributes ⇒ Object
Public: Return a mapping of queue name to attributes
45 46 47 |
# File 'lib/sqs/SQS.rb', line 45 def queue_attributes @queue_attributes ||= Hash[queue_urls.map { |name, url| [name, init_attributes(url)] }] end |
.queue_policy(queue_name) ⇒ Object
Public: Return the policy of a queue as a Hash
35 36 37 |
# File 'lib/sqs/SQS.rb', line 35 def queue_policy(queue_name) JSON.parse(URI.decode(queue_attributes[queue_name]["Policy"])) rescue nil end |
.queue_urls ⇒ Object
Public: Return a mapping of queue name to url
40 41 42 |
# File 'lib/sqs/SQS.rb', line 40 def queue_urls @queue_urls ||= init_urls end |