class Dogapi::V1::TagService
Constants
- API_VERSION
Public Instance Methods
add(host_id, tags, source=nil)
click to toggle source
Adds a list of tags to a host
# File lib/dogapi/v1/tag.rb 37 def add(host_id, tags, source=nil) 38 extra_params = {} 39 if source 40 extra_params['source'] = source 41 end 42 43 body = { 44 :tags => tags 45 } 46 47 request(Net::HTTP::Post, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, extra_params, body, true) 48 end
detach(host_id, source=nil)
click to toggle source
Remove all tags from a host
# File lib/dogapi/v1/tag.rb 71 def detach(host_id, source=nil) 72 extra_params = {} 73 if source 74 extra_params['source'] = source 75 end 76 77 request(Net::HTTP::Delete, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, extra_params, nil, false) 78 end
detatch(host_id)
click to toggle source
DEPRECATED: Spelling mistake temporarily preserved as an alias.
# File lib/dogapi/v1/tag.rb 65 def detatch(host_id) 66 warn '[DEPRECATION] Dogapi::V1::TagService.detatch() is deprecated. Use `detach` instead.' 67 detach(host_id) 68 end
get(host_id, source=nil, by_source=false)
click to toggle source
Gets all tags for a given host
# File lib/dogapi/v1/tag.rb 24 def get(host_id, source=nil, by_source=false) 25 extra_params = {} 26 if source 27 extra_params['source'] = source 28 end 29 if by_source 30 extra_params['by_source'] = 'true' 31 end 32 33 request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, extra_params, nil, false) 34 end
get_all(source=nil)
click to toggle source
Gets all tags in your org and the hosts tagged with them
# File lib/dogapi/v1/tag.rb 14 def get_all(source=nil) 15 extra_params = {} 16 if source 17 extra_params['source'] = source 18 end 19 20 request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts', extra_params, nil, false) 21 end
update(host_id, tags, source=nil)
click to toggle source
Remove all tags from a host and replace them with a new list
# File lib/dogapi/v1/tag.rb 51 def update(host_id, tags, source=nil) 52 extra_params = {} 53 if source 54 extra_params['source'] = source 55 end 56 57 body = { 58 :tags => tags 59 } 60 61 request(Net::HTTP::Put, '/api/' + API_VERSION + '/tags/hosts/' + host_id.to_s, extra_params, body, true) 62 end