Class: Terraforming::Resource::SQS
- Inherits:
-
Object
- Object
- Terraforming::Resource::SQS
- Includes:
- Util
- Defined in:
- lib/terraforming/resource/sqs.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(client) ⇒ SQS
constructor
A new instance of SQS.
- #tf ⇒ Object
- #tfstate ⇒ Object
Methods included from Util
#apply_template, #name_from_tag, #normalize_module_name, #prettify_policy, #template_path
Constructor Details
#initialize(client) ⇒ SQS
Returns a new instance of SQS.
14 15 16 |
# File 'lib/terraforming/resource/sqs.rb', line 14 def initialize(client) @client = client end |
Class Method Details
.tf(client: Aws::SQS::Client.new) ⇒ Object
6 7 8 |
# File 'lib/terraforming/resource/sqs.rb', line 6 def self.tf(client: Aws::SQS::Client.new) self.new(client).tf end |
.tfstate(client: Aws::SQS::Client.new) ⇒ Object
10 11 12 |
# File 'lib/terraforming/resource/sqs.rb', line 10 def self.tfstate(client: Aws::SQS::Client.new) self.new(client).tfstate end |
Instance Method Details
#tf ⇒ Object
18 19 20 |
# File 'lib/terraforming/resource/sqs.rb', line 18 def tf apply_template(@client, "tf/sqs") end |
#tfstate ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/terraforming/resource/sqs.rb', line 22 def tfstate queues.inject({}) do |resources, queue| attributes = { "name" => module_name_of(queue), "id" => queue["QueueUrl"], "arn" => queue["QueueArn"], "visibility_timeout_seconds" => queue["VisibilityTimeout"], "message_retention_seconds" => queue["MessageRetentionPeriod"], "max_message_size" => queue["MaximumMessageSize"], "delay_seconds" => queue["DelaySeconds"], "receive_wait_time_seconds" => queue["ReceiveMessageWaitTimeSeconds"], "policy" => queue.key?("Policy") ? queue["Policy"] : "", "redrive_policy" => queue.key?("RedrivePolicy") ? queue["RedrivePolicy"] : "", } resources["aws_sqs_queue.#{module_name_of(queue)}"] = { "type" => "aws_sqs_queue", "primary" => { "id" => queue["QueueUrl"], "attributes" => attributes, } } resources end end |