Sha256: 26c0a4788e6e5f4a4c4b57acc0fb89a282550dc1e293cd7fe6164dfc70cfb9c3

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

module OpsPreflight
  module OpsWorks
    class Base
      attr_accessor :region
      attr_accessor :stack_name

      def initialize(region, stack_name)
        require 'aws-sdk'

        @region = region
        @stack_name = stack_name
      end

      protected
      def opsworks
        @opsworks ||= Aws::OpsWorks::Client.new(region: @region)
      end

      def stack_id
        @stack_id ||= begin
          resp = opsworks.describe_stacks
          stack = resp[:stacks].find {|stack| stack[:name] == stack_name }

          raise "OpsWorks stack not found!" if stack.nil?

          stack[:stack_id]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ops_preflight-1.3.1 lib/ops_preflight/ops_works/base.rb
ops_preflight-1.3.0 lib/ops_preflight/ops_works/base.rb
ops_preflight-1.2.1 lib/ops_preflight/ops_works/base.rb
ops_preflight-1.2.0 lib/ops_preflight/ops_works/base.rb