Class: Tag

Inherits:
Object
  • Object
show all
Extended by:
RightScale::Api::BaseExtend
Includes:
RightScale::Api::Base
Defined in:
lib/rest_connection/rightscale/tag.rb

Overview

API 1.0

Instance Attribute Summary

Attributes included from RightScale::Api::Base

#params

Class Method Summary collapse

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, resource_plural_name, resource_singular_name

Methods included from RightScale::Api::BaseConnection

#connection

Methods included from RightScale::Api::Base

#[], #[]=, #destroy, #initialize, #method_missing, #reload, #resource_plural_name, #resource_singular_name, #rs_id, #save

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightScale::Api::Base

Class Method Details

.search(resource_name, tags, opts = nil) ⇒ Object



33
34
35
36
37
# File 'lib/rest_connection/rightscale/tag.rb', line 33

def self.search(resource_name, tags, opts=nil)
  parameters = { :resource_type => resource_name.to_s, :tags => tags }
  parameters.merge!(opts) unless opts.nil?
  result = connection.get("tags/search", parameters)
end

.search_by_href(resource_href) ⇒ Object



39
40
41
# File 'lib/rest_connection/rightscale/tag.rb', line 39

def self.search_by_href(resource_href)
    connection.get("tags/search", :resource_href => resource_href)
end

.set(resource_href, 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.



46
47
48
# File 'lib/rest_connection/rightscale/tag.rb', line 46

def self.set(resource_href, tags)
  connection.put("tags/set", :resource_href => resource_href, :tags => tags)
end

.unset(resource_href, tags) ⇒ Object



50
51
52
# File 'lib/rest_connection/rightscale/tag.rb', line 50

def self.unset(resource_href, tags)
  connection.put("tags/unset", :resource_href => resource_href, :tags => tags)
end