Sha256: 280022d87c5f08fd629b786dae8909615b68177a23381d786f27875c80708eab

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 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)
        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_region
          Configuration.aws_region
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-asg-rolling-0.1.0 lib/capistrano/asg/rolling/aws.rb