Class: Lono::SetInstances::Delete
- Inherits:
-
Changeable
- Object
- AbstractBase
- Cfn::Base
- Lono::Sets::Base
- Base
- Changeable
- Lono::SetInstances::Delete
- Defined in:
- lib/lono/set_instances/delete.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Delete
constructor
A new instance of Delete.
- #long_desc ⇒ Object
- #run ⇒ Object
Methods inherited from Changeable
#accounts, #regions, #validate!
Methods included from Utils::Sure
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 inherited from Base
#accounts, #regions, #requested, #stack_instances
Methods inherited from Lono::Sets::Base
#build_options, #exit_unless_updatable!, #operation_preferences
Methods inherited from Cfn::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 inherited from AbstractBase
Methods included from Blueprint::Root
#find_blueprint_root, #set_blueprint_root
Constructor Details
#initialize(options = {}) ⇒ Delete
Returns a new instance of Delete.
3 4 5 6 |
# File 'lib/lono/set_instances/delete.rb', line 3 def initialize(={}) super @stack = [:stack] end |
Instance Method Details
#long_desc ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/lono/set_instances/delete.rb', line 35 def long_desc total = accounts.size * regions.size <<~EOL These stack instances will be deleted: accounts: #{accounts.join(',')} regions: #{regions.join(',')} Number of stack instances to be deleted: #{total} EOL end |
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lono/set_instances/delete.rb', line 8 def run validate! sure?("Are you sure you want to delete the #{@stack} stack instances?", long_desc) # delete_stack_instances resp has operation_id # Could also use that to poll for status with the list_stack_set_operation_results # api. Currently, Instance::Status class not using this info. If we need will add the logic. retain_stacks = @options[:retain_stacks] ? @options[:retain_stacks] : false resp = cfn.delete_stack_instances( stack_set_name: @stack, accounts: accounts, regions: regions, retain_stacks: retain_stacks, ) operation_id = resp.operation_id # Status tailing handled by caller o = @options.merge( filter: requested, start_on_outdated: false, operation_id: operation_id, ) instances_status = Status.new(o) instances_status.run(to: "deleted") unless @options[:noop] # returns success: true or false end |