Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Addes some examples to the documentation of the tag handling methods.

  • Loading branch information...
commit 8d2f3718ac53a6f91bc19e5233d6f5b90a77b194 1 parent 9ef44e2
Cody Robbins authored committed
Showing with 21 additions and 4 deletions.
  1. +21 −4 lib/AWS/EC2/tags.rb
View
25 lib/AWS/EC2/tags.rb
@@ -4,8 +4,12 @@ class Base < AWS::Base
# The CreateTags operation adds or overwrites tags for the specified resource(s).
#
+ # @example Tag instance i-123456789 with the name 'Test Instance'.
+ # create_tags(:resource_id => 'i-123456789',
+ # :tag => [{'Name' => 'Test Instance'}])
+ #
# @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
+ # @option options [Array] :tag ([]) An array of Hashes representing the tags as string name/value pairs. Use <tt>nil</tt> 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?
@@ -16,9 +20,14 @@ def create_tags( options = {} )
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.
+ # The DescribeTags operation lists the tags. If you do not specify any filters, all tags will be returned.
+ #
+ # @example Find any instances tagged with the name 'Test Instance'.
+ # describe_tags(:filter => [{'resource-type' => ['instance']},
+ # {'key' => ['Name']},
+ # {'value' => ['Test Instance']}])
#
- # @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']},...]
+ # @option options [optional, Array] :filter ([]) An array of Hashes representing the filters. Note that the values in the hashes have to be arrays
#
def describe_tags( options = {} )
params = {}
@@ -30,8 +39,16 @@ def describe_tags( options = {} )
# The DeleteTags operation deletes tags for the specified resource(s).
#
+ # @example Remove the name tag from instance i-123456789.
+ # delete_tags(:resource_id => 'i-123456789',
+ # :tag => [{'Name' => nil}])
+ #
+ # @example Remove the name tag from instance i-123456789, but only if it's 'Test Instance'.
+ # delete_tags(:resource_id => 'i-123456789',
+ # :tag => [{'Name' => 'Test Instance'}])
+ #
# @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
+ # @option options [Array] :tag ([]) An array of Hashes representing the tags as string name/value pairs. If a value is given (instead of <tt>nil</tt> or an empty string), then the tag is only deleted if it has the specified value
#
def delete_tags( options = {} )
raise ArgumentError, "No :resource_id provided" if options[:resource_id].nil? || options[:resource_id].empty?

0 comments on commit 8d2f371

Please sign in to comment.
Something went wrong with that request. Please try again.