Module: Wavefront::Mixin::Tag
- Included in:
- Alert, Dashboard, DerivedMetric, Event, Source
- Defined in:
- lib/wavefront-sdk/api_mixins/tag.rb
Overview
Tagging support.
Mix this module into class which supports tags, ensuring there is a valid_id? method to perform ID validation.
Instance Method Summary collapse
-
#tag_add(id, tag) ⇒ Wavefront::Response
PUT /api/v2/entity/id/tag/tagValue Add a tag to a specific entity.
-
#tag_delete(id, tag) ⇒ Wavefront::Response
DELETE /api/v2/entity/id/tag/tagValue Remove a tag from a specific entity.
-
#tag_set(id, tags) ⇒ Wavefront::Response
POST /api/v2/entity/id/tag Set all tags associated with a specific entity.
-
#tags(id) ⇒ Wavefront::Response
GET /api/v2/entity/id/tag Get all tags associated with a specific entity.
Instance Method Details
#tag_add(id, tag) ⇒ Wavefront::Response
PUT /api/v2/entity/id/tag/tagValue Add a tag to a specific entity.
57 58 59 60 61 |
# File 'lib/wavefront-sdk/api_mixins/tag.rb', line 57 def tag_add(id, tag) valid_id?(id) wf_string?(tag) api.put([id, 'tag', tag].uri_concat) end |
#tag_delete(id, tag) ⇒ Wavefront::Response
DELETE /api/v2/entity/id/tag/tagValue Remove a tag from a specific entity.
44 45 46 47 48 |
# File 'lib/wavefront-sdk/api_mixins/tag.rb', line 44 def tag_delete(id, tag) valid_id?(id) wf_string?(tag) api.delete([id, 'tag', tag].uri_concat) end |
#tag_set(id, tags) ⇒ Wavefront::Response
POST /api/v2/entity/id/tag Set all tags associated with a specific entity.
30 31 32 33 34 35 |
# File 'lib/wavefront-sdk/api_mixins/tag.rb', line 30 def tag_set(id, ) valid_id?(id) = Array() .each { |t| wf_string?(t) } api.post([id, 'tag'].uri_concat, .to_json, 'application/json') end |
#tags(id) ⇒ Wavefront::Response
GET /api/v2/entity/id/tag Get all tags associated with a specific entity.
18 19 20 21 |
# File 'lib/wavefront-sdk/api_mixins/tag.rb', line 18 def (id) valid_id?(id) api.get([id, 'tag'].uri_concat) end |