Class: Lono::Cfn::Preview::Codediff
- Inherits:
-
Base
- Object
- AbstractBase
- Base
- Lono::Cfn::Preview::Codediff
- Includes:
- AwsServices, DiffViewer
- Defined in:
- lib/lono/cfn/preview/codediff.rb
Instance Method Summary collapse
- #download_existing_cfn_template ⇒ Object
- #existing_template_path ⇒ Object
-
#new_cfn_template ⇒ Object
for clarity.
- #run ⇒ Object
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Helper
#rollback_complete?, #testing_update?
Methods included from AwsServices::StackSet
#find_stack_set, #stack_set_exists?
Methods included from AwsServices::Stack
Methods included from DiffViewer
Methods inherited from Base
#capabilities, #command_with_iam, #continue_update_rollback, #continue_update_rollback_sure?, #delete_rollback_stack, #exit_unless_updatable!, #generate_all, #notification_arns, #pretty_path, #prompt_for_iam, #quit, #rerun_with_iam?, #set_template_url!, #show_options, #stack_status, #starting_message, #status, #tags
Methods included from Utils::Sure
Methods inherited from AbstractBase
#initialize, #reinitialize, #template_path
Methods included from Blueprint::Root
#find_blueprint_root, #set_blueprint_root
Constructor Details
This class inherits a constructor from Lono::AbstractBase
Instance Method Details
#download_existing_cfn_template ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/lono/cfn/preview/codediff.rb', line 24 def download_existing_cfn_template resp = cfn.get_template( stack_name: @stack, template_stage: "Original" ) IO.write(existing_template_path, resp.template_body) end |
#existing_template_path ⇒ Object
37 38 39 |
# File 'lib/lono/cfn/preview/codediff.rb', line 37 def existing_template_path "/tmp/existing_stack.yml" end |
#new_cfn_template ⇒ Object
for clarity
33 34 35 |
# File 'lib/lono/cfn/preview/codediff.rb', line 33 def new_cfn_template template_path end |
#run ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lono/cfn/preview/codediff.rb', line 6 def run puts "Code Diff Preview:".color(:green) unless stack_exists?(@stack) puts "WARN: Cannot create a diff for the stack because the #{@stack} does not exists.".color(:yellow) return end if @options[:noop] puts "NOOP Generating CloudFormation source code diff..." else generate_all # from Base superclass. Generates the output lono teplates puts "Generating CloudFormation source code diff..." download_existing_cfn_template show_diff(existing_template_path, new_cfn_template) end end |