Class: Grafana::Api::Snapshots
- Inherits:
-
Object
- Object
- Grafana::Api::Snapshots
- Defined in:
- lib/grafana-api/api/snapshots.rb
Instance Method Summary collapse
- #create(create_dashboard_snapshot_command:) ⇒ Object
- #delete(key:) ⇒ Object
- #get(key:) ⇒ Object
-
#initialize(connection) ⇒ Snapshots
constructor
A new instance of Snapshots.
Constructor Details
#initialize(connection) ⇒ Snapshots
Returns a new instance of Snapshots.
5 6 7 |
# File 'lib/grafana-api/api/snapshots.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(create_dashboard_snapshot_command:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/grafana-api/api/snapshots.rb', line 9 def create(create_dashboard_snapshot_command:) raise ArgumentError, 'create_dashboard_snapshot_command is required' if create_dashboard_snapshot_command.nil? @connection.call( :POST, '/snapshots', type: Grafana::Api::Models::CreateDashboardSnapshot200Response, auth: ['api_key', 'basic'], body: create_dashboard_snapshot_command ) end |
#delete(key:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grafana-api/api/snapshots.rb', line 21 def delete(key:) raise ArgumentError, 'key is required' if key.nil? @connection.call( :DELETE, '/snapshots/{key}' .gsub('{key}', ERB::Util.url_encode(key.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'] ) end |
#get(key:) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/grafana-api/api/snapshots.rb', line 33 def get(key:) raise ArgumentError, 'key is required' if key.nil? @connection.call( :GET, '/snapshots/{key}' .gsub('{key}', ERB::Util.url_encode(key.to_s)), type: nil, auth: ['api_key', 'basic'] ) end |