Sha256: e17c1793793acb65fb7bba7f6170031588b0eae5be11f036bf43af35dc1a26a2

Contents?: true

Size: 1.5 KB

Versions: 13

Compression:

Stored size: 1.5 KB

Contents

require 'aws-sdk-cloudformation'
require 'cfn_manage/cf_common'

module CfnManage
  module CloudFormation
    class ProgressTracker
      @cf_client = nil
      @stack_name = nil
      @last_event_times = {}
      @period_from = nil

      @@default_ending_states = %w[
        CREATE_COMPLETE
        UPDATE_COMPLETE
        UPDATE_ROLLBACK_COMPLETE
        ROLLBACK_FAILED
        DELETE_FAILED
      ]

      @@default_display_state = %w[
          CREATE_COMPLETE
          UPDATE_COMPLETE
      ]

      @ending_states = nil

      def initialize(stack_name, period_from, creds = nil, region = nil)
        client_params = {}
        client_params['region'] = region unless region.nil?
        client_params['credentials'] = creds unless creds.nil?
        @cf_client = Aws::CloudFormation::Client.new(client_params)
        @stack_name = stack_name
        @ending_statest = @@default_ending_states
        @period_from = period_from
      end


      def track_single_stack(stack)
        stack_id = stack['stack_id']
        # Default to period_from if first run, take from last run otherwise
        event_from = last_event_times[stack_id] if @last_event_times.key?(stack_id)
        event_from = @period_from unless @last_event_times.key?(stack_id)


        stack_resources = @cf_client.describe_stack_events(stack_name: stack['stack_id'],)


      end

      def track_progress(_show_only_failures = false)
        Common.visit_stack(@cf_client, @stack_name, method(:track_single_stack),true)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cfn_manage-0.8.3 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.8.2 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.8.1 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.8.0 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.7.1 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.7.0 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.6.0 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.5.5 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.5.4 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.5.3 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.5.2 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.5.1 lib/cfn_manage/cf_progress_tracker.rb
cfn_manage-0.5.0 lib/cfn_manage/cf_progress_tracker.rb