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



24
25
26
27
28
29
30
31
32
33
# File 'lib/humidifier/aws_shim.rb', line 24

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

Instance Attribute Details

#shimObject

Returns the value of attribute shim.



19
20
21
# File 'lib/humidifier/aws_shim.rb', line 19

def shim
  @shim
end

Class Method Details

.instanceObject

The shim singleton



40
41
42
# File 'lib/humidifier/aws_shim.rb', line 40

def instance
  @instance ||= new
end

.shimObject

The target of all of the forwarding



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

def shim
  instance.shim
end