Class: Grafana::Api::Reports
- Inherits:
-
Object
- Object
- Grafana::Api::Reports
- Defined in:
- lib/grafana-api/api/reports.rb
Defined Under Namespace
Classes: Dashboards, Images
Instance Method Summary collapse
- #create(create_or_update_report:) ⇒ Object
- #delete(id:) ⇒ Object
- #email(report_email:) ⇒ Object
- #get(id:) ⇒ Object
-
#initialize(connection) ⇒ Reports
constructor
A new instance of Reports.
- #list ⇒ Object
- #render_csvs(dashboards: nil, title: nil) ⇒ Object
- #render_pdfs(dashboards: nil, orientation: nil, layout: nil, title: nil, scale_factor: nil, include_tables: nil) ⇒ Object
- #settings ⇒ Object
- #settings_post(report_settings:) ⇒ Object
- #test_email(create_or_update_report:) ⇒ Object
- #update(id:, create_or_update_report:) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Reports
Returns a new instance of Reports.
5 6 7 |
# File 'lib/grafana-api/api/reports.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#create(create_or_update_report:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/grafana-api/api/reports.rb', line 9 def create(create_or_update_report:) raise ArgumentError, 'create_or_update_report is required' if create_or_update_report.nil? @connection.call( :POST, '/reports', type: Grafana::Api::Models::CreateReport200Response, auth: ['api_key', 'basic'], body: create_or_update_report ) end |
#delete(id:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grafana-api/api/reports.rb', line 21 def delete(id:) raise ArgumentError, 'id is required' if id.nil? @connection.call( :DELETE, '/reports/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'] ) end |
#email(report_email:) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/grafana-api/api/reports.rb', line 33 def email(report_email:) raise ArgumentError, 'report_email is required' if report_email.nil? @connection.call( :POST, '/reports/email', type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: report_email ) end |
#get(id:) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/grafana-api/api/reports.rb', line 45 def get(id:) raise ArgumentError, 'id is required' if id.nil? @connection.call( :GET, '/reports/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: Grafana::Api::Models::Report, auth: ['api_key', 'basic'] ) end |
#list ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/grafana-api/api/reports.rb', line 57 def list @connection.call( :GET, '/reports', type: [Grafana::Api::Models::Report], auth: ['api_key', 'basic'] ) end |
#render_csvs(dashboards: nil, title: nil) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/grafana-api/api/reports.rb', line 66 def render_csvs(dashboards: nil, title: nil) @connection.call( :GET, '/reports/render/csvs', type: nil, auth: ['api_key', 'basic'], query: { 'dashboards' => dashboards, 'title' => title } ) end |
#render_pdfs(dashboards: nil, orientation: nil, layout: nil, title: nil, scale_factor: nil, include_tables: nil) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/grafana-api/api/reports.rb', line 76 def render_pdfs(dashboards: nil, orientation: nil, layout: nil, title: nil, scale_factor: nil, include_tables: nil) @connection.call( :GET, '/reports/render/pdfs', type: nil, auth: ['api_key', 'basic'], query: { 'dashboards' => dashboards, 'orientation' => orientation, 'layout' => layout, 'title' => title, 'scaleFactor' => scale_factor, 'includeTables' => include_tables } ) end |
#settings ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/grafana-api/api/reports.rb', line 86 def settings @connection.call( :GET, '/reports/settings', type: Grafana::Api::Models::ReportSettings, auth: ['api_key', 'basic'] ) end |
#settings_post(report_settings:) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/grafana-api/api/reports.rb', line 95 def settings_post(report_settings:) raise ArgumentError, 'report_settings is required' if report_settings.nil? @connection.call( :POST, '/reports/settings', type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: report_settings ) end |
#test_email(create_or_update_report:) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/grafana-api/api/reports.rb', line 107 def test_email(create_or_update_report:) raise ArgumentError, 'create_or_update_report is required' if create_or_update_report.nil? @connection.call( :POST, '/reports/test-email', type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: create_or_update_report ) end |
#update(id:, create_or_update_report:) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/grafana-api/api/reports.rb', line 119 def update(id:, create_or_update_report:) raise ArgumentError, 'id is required' if id.nil? raise ArgumentError, 'create_or_update_report is required' if create_or_update_report.nil? @connection.call( :PUT, '/reports/{id}' .gsub('{id}', ERB::Util.url_encode(id.to_s)), type: Grafana::Api::Models::SuccessResponseBody, auth: ['api_key', 'basic'], body: create_or_update_report ) end |