Class: Grafana::Api::Annotations
- Inherits:
-
Object
- Object
- Grafana::Api::Annotations
- Defined in:
- lib/grafana-api/api/annotations.rb
Instance Method Summary collapse
- #create(post_annotations_cmd:) ⇒ Object
- #delete(annotation_id:) ⇒ Object
- #get(annotation_id:) ⇒ Object
- #graphite(post_graphite_annotations_cmd:) ⇒ Object
-
#initialize(connection) ⇒ Annotations
constructor
A new instance of Annotations.
- #list(from: nil, to: nil, user_id: nil, alert_id: nil, alert_uid: nil, dashboard_id: nil, dashboard_uid: nil, panel_id: nil, limit: nil, tags: nil, type: nil, match_any: nil) ⇒ Object
- #mass_delete(mass_delete_annotations_cmd:) ⇒ Object
- #partial_update(annotation_id:, patch_annotations_cmd:) ⇒ Object
- #tags(tag: nil, limit: nil) ⇒ Object
- #update(annotation_id:, update_annotations_cmd:) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Annotations
Returns a new instance of Annotations.
5 6 7 |
# File 'lib/grafana-api/api/annotations.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(post_annotations_cmd:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/grafana-api/api/annotations.rb', line 9 def create(post_annotations_cmd:) raise ArgumentError, 'post_annotations_cmd is required' if post_annotations_cmd.nil? @connection.call( :POST, '/annotations', type: Grafana::Api::Models::PostAnnotation200Response, auth: ['api_key', 'basic'], body: post_annotations_cmd ) end |
#delete(annotation_id:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grafana-api/api/annotations.rb', line 21 def delete(annotation_id:) raise ArgumentError, 'annotation_id is required' if annotation_id.nil? @connection.call( :DELETE, '/annotations/{annotation_id}' .gsub('{annotation_id}', ERB::Util.url_encode(annotation_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'] ) end |
#get(annotation_id:) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/grafana-api/api/annotations.rb', line 33 def get(annotation_id:) raise ArgumentError, 'annotation_id is required' if annotation_id.nil? @connection.call( :GET, '/annotations/{annotation_id}' .gsub('{annotation_id}', ERB::Util.url_encode(annotation_id.to_s)), type: Grafana::Api::Models::Annotation, auth: ['api_key', 'basic'] ) end |
#graphite(post_graphite_annotations_cmd:) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/grafana-api/api/annotations.rb', line 45 def graphite(post_graphite_annotations_cmd:) raise ArgumentError, 'post_graphite_annotations_cmd is required' if post_graphite_annotations_cmd.nil? @connection.call( :POST, '/annotations/graphite', type: Grafana::Api::Models::PostAnnotation200Response, auth: ['api_key', 'basic'], body: post_graphite_annotations_cmd ) end |
#list(from: nil, to: nil, user_id: nil, alert_id: nil, alert_uid: nil, dashboard_id: nil, dashboard_uid: nil, panel_id: nil, limit: nil, tags: nil, type: nil, match_any: nil) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/grafana-api/api/annotations.rb', line 57 def list(from: nil, to: nil, user_id: nil, alert_id: nil, alert_uid: nil, dashboard_id: nil, dashboard_uid: nil, panel_id: nil, limit: nil, tags: nil, type: nil, match_any: nil) @connection.call( :GET, '/annotations', type: [Grafana::Api::Models::Annotation], auth: ['api_key', 'basic'], query: { 'from' => from, 'to' => to, 'userId' => user_id, 'alertId' => alert_id, 'alertUID' => alert_uid, 'dashboardId' => dashboard_id, 'dashboardUID' => dashboard_uid, 'panelId' => panel_id, 'limit' => limit, 'tags' => , 'type' => type, 'matchAny' => match_any } ) end |
#mass_delete(mass_delete_annotations_cmd:) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/grafana-api/api/annotations.rb', line 67 def mass_delete(mass_delete_annotations_cmd:) raise ArgumentError, 'mass_delete_annotations_cmd is required' if mass_delete_annotations_cmd.nil? @connection.call( :POST, '/annotations/mass-delete', type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: mass_delete_annotations_cmd ) end |
#partial_update(annotation_id:, patch_annotations_cmd:) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/grafana-api/api/annotations.rb', line 79 def partial_update(annotation_id:, patch_annotations_cmd:) raise ArgumentError, 'annotation_id is required' if annotation_id.nil? raise ArgumentError, 'patch_annotations_cmd is required' if patch_annotations_cmd.nil? @connection.call( :PATCH, '/annotations/{annotation_id}' .gsub('{annotation_id}', ERB::Util.url_encode(annotation_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: patch_annotations_cmd ) end |
#tags(tag: nil, limit: nil) ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/grafana-api/api/annotations.rb', line 93 def (tag: nil, limit: nil) @connection.call( :GET, '/annotations/tags', type: Grafana::Api::Models::GetAnnotationTagsResponse, auth: ['api_key', 'basic'], query: { 'tag' => tag, 'limit' => limit } ) end |
#update(annotation_id:, update_annotations_cmd:) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/grafana-api/api/annotations.rb', line 103 def update(annotation_id:, update_annotations_cmd:) raise ArgumentError, 'annotation_id is required' if annotation_id.nil? raise ArgumentError, 'update_annotations_cmd is required' if update_annotations_cmd.nil? @connection.call( :PUT, '/annotations/{annotation_id}' .gsub('{annotation_id}', ERB::Util.url_encode(annotation_id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: update_annotations_cmd ) end |