module Shelter::CLI::Helpers::CloudFormation
Mixin module for CloudFormation
Public Instance Methods
cf_client()
click to toggle source
# File lib/cli/helpers/cloudformation_helper.rb 8 def cf_client 9 @cf_client ||= Aws::CloudFormation::Client.new( 10 credentials: Aws::Credentials.new( 11 ENV.fetch('AWS_ACCESS_KEY_ID'), 12 ENV.fetch('AWS_SECRET_ACCESS_KEY') 13 ) 14 ) 15 end
display_stack_output(out)
click to toggle source
# File lib/cli/helpers/cloudformation_helper.rb 31 def display_stack_output(out) 32 puts out.description unless out.description.nil? 33 puts "#{out.output_key}: #{out.output_value}" 34 end
display_stack_resource(r)
click to toggle source
# File lib/cli/helpers/cloudformation_helper.rb 25 def display_stack_resource(r) 26 puts "Resource ID: #{r.physical_resource_id}" 27 puts " Resource Type: #{r.resource_type}" 28 puts " Resource Status: #{r.resource_status}" 29 end
stack_meta(res, type: 'resource')
click to toggle source
# File lib/cli/helpers/cloudformation_helper.rb 36 def stack_meta(res, type: 'resource') 37 tags = [] 38 39 res.each do |key, value| 40 tags << { key: key.to_s, value: value.to_s } 41 end 42 43 tags << { key: 'type', value: type } 44 45 tags 46 end
stack_params(res)
click to toggle source
# File lib/cli/helpers/cloudformation_helper.rb 48 def stack_params(res) 49 params = [] 50 51 res.each do |key, value| 52 params << { parameter_key: key.to_s, parameter_value: value.to_s } 53 end 54 55 params 56 end
wait_until(status, stack_name)
click to toggle source
# File lib/cli/helpers/cloudformation_helper.rb 17 def wait_until(status, stack_name) 18 puts "Waiting for '#{status}' on '#{stack_name}'..." 19 cf_client.wait_until( 20 status, 21 stack_name: stack_name 22 ) 23 end