Class: McTag
- Inherits:
-
Object
- Object
- McTag
- Extended by:
- RightScale::Api::GatewayExtend
- Includes:
- RightScale::Api::Gateway
- Defined in:
- lib/rest_connection/rightscale/mc_tag.rb
Overview
API 1.5
Instance Attribute Summary
Attributes included from RightScale::Api::Base
Class Method Summary collapse
-
.multi_add(resource_hrefs, tags) ⇒ Object
TAGGABLE_RESOURCES = [ ‘Server’, ‘Ec2EbsSnapshot’, ‘Ec2EbsVolume’, ‘Ec2Image’, ‘Image’, ‘ServerArray’, ‘Ec2Instance’, ‘Instance’, ‘Deployment’, ‘ServerTemplate’, ‘Ec2ServerTemplate’ ].
- .multi_delete(resource_hrefs, tags) ⇒ Object
- .resource_plural_name ⇒ Object
- .resource_singular_name ⇒ Object
-
.search(resource_name, tags, opts = nil) ⇒ Object
, include_tags_with_prefix = false).
- .search_by_href(*resource_hrefs) ⇒ Object
- .set(resource_hrefs, tags) ⇒ Object
- .unset(resource_hrefs, tags) ⇒ Object
Instance Method Summary collapse
Methods included from RightScale::Api::GatewayExtend
create, filters, find, find_all, find_by, find_with_filter, load, load_all, parse_args, resource_post_name
Methods included from RightScale::Api::GatewayConnection
Methods included from RightScale::Api::BaseExtend
#[], #create, #deny_methods, #filters, #find, #find_all, #find_by, #find_by_cloud_id, #find_by_id, #find_by_nickname, #find_by_nickname_speed, #find_with_filter
Methods included from RightScale::Api::BaseConnection
Methods included from RightScale::Api::Gateway
#[], #[]=, #actions, #hash_of_links, #href, #initialize, #load, #method_missing, #nickname, #parse_params, #rediscover, #save
Methods included from RightScale::Api::Base
#[], #[]=, #destroy, #initialize, #method_missing, #reload, #rs_id, #save
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RightScale::Api::Gateway
Class Method Details
.multi_add(resource_hrefs, tags) ⇒ Object
TAGGABLE_RESOURCES = [ ‘Server’, ‘Ec2EbsSnapshot’, ‘Ec2EbsVolume’, ‘Ec2Image’, ‘Image’, ‘ServerArray’, ‘Ec2Instance’,
'Instance', 'Deployment', 'ServerTemplate', 'Ec2ServerTemplate' ]
Tag.set( resource_href, tags ) where tags is an array of tags to set on the resource.
62 63 64 65 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 62 def self.multi_add(resource_hrefs, ) resource_hrefs = [resource_hrefs] unless resource_hrefs.is_a?(Array) connection.post("tags/multi_add", :resource_hrefs => resource_hrefs, :tags => ) end |
.multi_delete(resource_hrefs, tags) ⇒ Object
71 72 73 74 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 71 def self.multi_delete(resource_hrefs, ) resource_hrefs = [resource_hrefs] unless resource_hrefs.is_a?(Array) connection.post("tags/multi_delete", :resource_hrefs => resource_hrefs, :tags => ) end |
.resource_plural_name ⇒ Object
41 42 43 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 41 def self.resource_plural_name "tags" end |
.resource_singular_name ⇒ Object
45 46 47 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 45 def self.resource_singular_name "tag" end |
.search(resource_name, tags, opts = nil) ⇒ Object
, include_tags_with_prefix = false)
49 50 51 52 53 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 49 def self.search(resource_name, , opts=nil) #, include_tags_with_prefix = false) parameters = { :resource_type => resource_name.to_s, :tags => } parameters.merge!(opts) unless opts.nil? result = connection.post("tags/by_tag", parameters) end |
.search_by_href(*resource_hrefs) ⇒ Object
55 56 57 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 55 def self.search_by_href(*resource_hrefs) connection.post("tags/by_resource", :resource_hrefs => resource_hrefs) end |
.set(resource_hrefs, tags) ⇒ Object
67 68 69 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 67 def self.set(resource_hrefs, ) self.multi_add(resource_hrefs, ) end |
.unset(resource_hrefs, tags) ⇒ Object
76 77 78 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 76 def self.unset(resource_hrefs, ) self.multi_delete(resource_hrefs, ) end |
Instance Method Details
#resource_plural_name ⇒ Object
33 34 35 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 33 def resource_plural_name "tags" end |
#resource_singular_name ⇒ Object
37 38 39 |
# File 'lib/rest_connection/rightscale/mc_tag.rb', line 37 def resource_singular_name "tag" end |