Class: Skeme::CloudProviders::Aws

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_providers/aws.rb

Constant Summary collapse

@@logger =
nil
@@fog_aws_computes =
{}

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Aws

TODO: Allow a preferred region/az if it’s known



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cloud_providers/aws.rb', line 23

def initialize(options={})
  @@logger = options[:logger]
  if options[:aws_access_key_id] && options[:aws_secret_access_key]
    @@logger.info("AWS credentials supplied.  EC2 Tagging Enabled.")
    fog_aws_compute = Fog::Compute.new({:aws_access_key_id => options[:aws_access_key_id], :aws_secret_access_key => options[:aws_secret_access_key], :provider => 'AWS'})
    fog_aws_compute.describe_regions.body['regionInfo'].each do |region|
      @@fog_aws_computes.store(region['regionName'],
        Fog::Compute.new({
          :aws_access_key_id => options[:aws_access_key_id],
          :aws_secret_access_key => options[:aws_secret_access_key],
          :provider => 'AWS',
          :host => region['regionEndpoint']
        })
      )
    end
  end
end

Instance Method Details

#set_tag(params = {}) ⇒ Object



41
42
43
# File 'lib/cloud_providers/aws.rb', line 41

def set_tag(params={})
  tag(params.merge({:action => "set"}))
end

#unset_tag(params = {}) ⇒ Object



45
46
47
# File 'lib/cloud_providers/aws.rb', line 45

def unset_tag(params={})
  tag(params.merge({:action => "unset"}))
end