lib/roark/ami.rb in roark-0.1.0 vs lib/roark/ami.rb in roark-0.2.0
- old
+ new
@@ -108,10 +108,19 @@
@logger.info msg
Response.new :code => 1, :message => msg
end
end
+ def add_tags(tags)
+ begin
+ tag tags
+ rescue AWS::Errors::Base => e
+ return Response.new :code => 1, :message => e.message
+ end
+ Response.new :code => 0, :message => 'Tagging completed successfully.'
+ end
+
def authorize_account_ids(account_ids)
begin
authorize account_ids
rescue AWS::Errors::Base => e
return Response.new :code => 1, :message => e.message
@@ -147,19 +156,27 @@
def authorize(account_ids)
ec2_ami_authorizations.add :ami_id => @ami_id, :account_ids => account_ids
end
+ def tag(tags)
+ ec2_ami_tags.add :ami_id => @ami_id, :tags => tags
+ end
+
def instance
@instance ||= Instance.new :aws => @aws, :name => instance_name
end
def ec2_ami_state
@ec2_ami_state ||= Roark::Aws::Ec2::AmiState.new @aws
end
def ec2_ami_authorizations
@ec2_ami_authorizations ||= Roark::Aws::Ec2::AmiAuthorizations.new @aws
+ end
+
+ def ec2_ami_tags
+ @ec2_ami_tags ||= Roark::Aws::Ec2::AmiTags.new @aws
end
def ec2_destroy_ami
@ec2_destroy_ami ||= Roark::Aws::Ec2::DestroyAmi.new @aws
end