Sha256: d3062515b626ba6a83676b91d0b008da8686ec620d424a44e6aba68710d33c6e

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'aws-sdk-autoscaling'
require 'aws-sdk-ec2'

module Capistrano
  module ASG
    module Rolling
      # AWS SDK.
      module AWS
        def aws_autoscaling_client
          @aws_autoscaling_client ||= ::Aws::AutoScaling::Client.new(aws_options)
        end

        def aws_ec2_client
          @aws_ec2_client ||= ::Aws::EC2::Client.new(aws_options)
        end

        private

        def aws_options
          options = {}
          options[:region] = aws_region if aws_region
          options[:credentials] = aws_credentials if aws_credentials.set?
          options[:http_wire_trace] = true if ENV['AWS_HTTP_WIRE_TRACE'] == '1'
          options
        end

        def aws_credentials
          ::Aws::Credentials.new(aws_access_key_id, aws_secret_access_key, aws_session_token)
        end

        def aws_access_key_id
          Configuration.aws_access_key_id
        end

        def aws_secret_access_key
          Configuration.aws_secret_access_key
        end

        def aws_session_token
          Configuration.aws_session_token
        end

        def aws_region
          Configuration.aws_region
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
capistrano-asg-rolling-0.5.1 lib/capistrano/asg/rolling/aws.rb
capistrano-asg-rolling-0.5.0 lib/capistrano/asg/rolling/aws.rb
capistrano-asg-rolling-0.4.1 lib/capistrano/asg/rolling/aws.rb
capistrano-asg-rolling-0.4.0 lib/capistrano/asg/rolling/aws.rb
capistrano-asg-rolling-0.3.0 lib/capistrano/asg/rolling/aws.rb
capistrano-asg-rolling-0.2.1 lib/capistrano/asg/rolling/aws.rb
capistrano-asg-rolling-0.2.0 lib/capistrano/asg/rolling/aws.rb