Sha256: da9ea186599e19915a8c9879683589037cc7856a454f81d2df0f64068a092502

Contents?: true

Size: 985 Bytes

Versions: 5

Compression:

Stored size: 985 Bytes

Contents

# frozen_string_literal: true

module AwsCftTools
  module Runbooks
    ##
    # Images - report on available AMIs
    #
    # @example
    #   % aws-cli stacks              # list all known stacks
    #   % aws-cli stacks -e QA        # list all known stacks tagged for the QA environment
    #   % aws-cli stacks -e QA -r App # list all known stacks tagged for the QA environment and App role
    #
    class Stacks < Runbook::Report
      ###
      # @return [Array<AwsCftTools::Stack>]
      #
      def items
        client.stacks.sort_by(&method(:sort_key))
      end

      ###
      # @return [Array<String>]
      #
      def columns
        environment_column + role_column + %w[filename created_at name state]
      end

      private

      def sort_key(stack)
        stack.name
      end

      def environment_column
        options[:environment] ? [] : ['environment']
      end

      def role_column
        options[:role] ? [] : ['role']
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aws-cft-tools-0.1.4 lib/aws_cft_tools/runbooks/stacks.rb
aws-cft-tools-0.1.3 lib/aws_cft_tools/runbooks/stacks.rb
aws-cft-tools-0.1.2 lib/aws_cft_tools/runbooks/stacks.rb
aws-cft-tools-0.1.1 lib/aws_cft_tools/runbooks/stacks.rb
aws-cft-tools-0.1.0 lib/aws_cft_tools/runbooks/stacks.rb