Class: Humidifier::AwsShim

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/humidifier/aws_shim.rb

Overview

Optionally provides aws-sdk functionality if the gem is loaded

Constant Summary collapse

REGION =

The AWS region, can be set through the environment, defaults to us-east-1

ENV['AWS_REGION'] || 'us-east-1'
STACK_METHODS =

Methods that are sent over to the aws adapter from the stack

%i[
  create delete deploy exists? update upload valid?
  create_and_wait delete_and_wait deploy_and_wait update_and_wait
  create_change_set deploy_change_set
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAwsShim

Either set the SDK based on the configured option or guess the SDK version by attempting to require both aws-sdk-v1 and aws-sdk, then setting the shim based on what successfully loaded



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/humidifier/aws_shim.rb', line 27

def initialize
  @shim =
    if Humidifier.config.sdk_version_1?
      AwsAdapters::SDKV1.new
    elsif Humidifier.config.sdk_version_2?
      AwsAdapters::SDKV2.new
    elsif Humidifier.config.sdk_version_3?
      AwsAdapters::SDKV3.new
    else
      guess_sdk
    end
end

Instance Attribute Details

#shimObject (readonly)

Returns the value of attribute shim.



22
23
24
# File 'lib/humidifier/aws_shim.rb', line 22

def shim
  @shim
end

Class Method Details

.instanceObject

The shim singleton



45
46
47
# File 'lib/humidifier/aws_shim.rb', line 45

def instance
  @instance ||= new
end

.shimObject

The target of all of the forwarding



50
51
52
# File 'lib/humidifier/aws_shim.rb', line 50

def shim
  instance.shim
end