Sha256: c4a2d95bb178bbda744094f964d4a17f6911877813ddb70c9cdcc1a35509db46

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

#    This file is part of RestConnection
#
#    RestConnection is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    RestConnection is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with RestConnection.  If not, see <http://www.gnu.org/licenses/>.

class Tag
  include RightScale::Api::Base
  extend RightScale::Api::BaseExtend

  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

  def self.search_by_href(resource_href)
      connection.get("tags/search", :resource_href => resource_href)
  end
  #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.
  def self.set(resource_href, tags)
    connection.put("tags/set", :resource_href => resource_href, :tags => tags)
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rest_connection-0.1.1 lib/rest_connection/rightscale/tag.rb
rest_connection-0.1.0 lib/rest_connection/rightscale/tag.rb