Class: Roark::Aws::Ec2::AmiTags

Inherits:
Object
  • Object
show all
Defined in:
lib/roark/aws/ec2/ami_tags.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ AmiTags

Returns a new instance of AmiTags.



5
6
7
8
# File 'lib/roark/aws/ec2/ami_tags.rb', line 5

def initialize(connection)
  @connection = connection
  @logger     = Roark.logger
end

Instance Method Details

#add(args) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/roark/aws/ec2/ami_tags.rb', line 10

def add(args)
  ami_id = args[:ami_id]
  tags   = args[:tags]

  tags.each_pair do |key,value|
    @logger.info "Tagging AMI with '#{key}=#{value}'."
    @connection.ec2.images[ami_id].tag key, :value => value
  end
end