/usr/lib/ruby/vendor_ruby/AWS/EC2/tags.rb is in ruby-amazon-ec2 0.9.17-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | module AWS
module EC2
class Base < AWS::Base
# The CreateTags operation adds or overwrites tags for the specified resource(s).
#
# @option options [Array] :resource_id ([]) The ids of the resource(s) to tag
# @option options [Array] :tag ([]) An array of Hashes representing the tags { tag_name => tag_value }. Use nil or empty string to get a tag without a value
#
def create_tags( options = {} )
raise ArgumentError, "No :resource_id provided" if options[:resource_id].nil? || options[:resource_id].empty?
raise ArgumentError, "No :tag provided" if options[:tag].nil? || options[:tag].empty?
params = pathlist("ResourceId", options[:resource_id] )
params.merge!(pathkvlist('Tag', options[:tag], 'Key', 'Value', {}))
return response_generator(:action => "CreateTags", :params => params)
end
# The DescribeTags operation lists the tags, If you do not specify any filters, all tags will be returned.
#
# @option options [optional, Array] :filter ([]) An array of Hashes representing the filters. Note that the values in the hashes have to be arrays. E.g. [{:key => ['name']}, {:resource_type => ['instance']},...]
#
def describe_tags( options = {} )
params = {}
if options[:filter]
params.merge!(pathkvlist('Filter', options[:filter], 'Name', 'Value', {:resource_id => 'resource-id', :resource_type => 'resource-type' }))
end
return response_generator(:action => "DescribeTags", :params => params)
end
# The DeleteTags operation deletes tags for the specified resource(s).
#
# @option options [Array] :resource_id ([]) The ids of the resource(s) to tag
# @option options [Array] :tag ([]) An array of Hashes representing the tags { tag_name => tag_value }. If a value is given (instead of nil/empty string), then the tag is only deleted if it has this value
#
def delete_tags( options = {} )
raise ArgumentError, "No :resource_id provided" if options[:resource_id].nil? || options[:resource_id].empty?
raise ArgumentError, "No :tag provided" if options[:tag].nil? || options[:tag].empty?
params = pathlist("ResourceId", options[:resource_id] )
params.merge!(pathkvlist('Tag', options[:tag], 'Key', 'Value', {}))
return response_generator(:action => "DeleteTags", :params => params)
end
end
end
end
|