Class: Grafana::Api::Convert

Inherits:
Object
  • Object
show all
Defined in:
lib/grafana-api/api/convert.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Convert

Returns a new instance of Convert.



5
6
7
# File 'lib/grafana-api/api/convert.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Method Details

#api_prom_rulesObject



9
10
11
12
13
14
15
16
# File 'lib/grafana-api/api/convert.rb', line 9

def api_prom_rules
  @connection.call(
    :GET,
    '/convert/api/prom/rules',
    type: Grafana::Api::Models::PrometheusNamespace,
    auth: ['api_key', 'basic']
  )
end

#api_prom_rules_delete(namespace_title:) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/grafana-api/api/convert.rb', line 18

def api_prom_rules_delete(namespace_title:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?

  @connection.call(
    :DELETE,
    '/convert/api/prom/rules/{NamespaceTitle}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s)),
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic']
  )
end

#api_prom_rules_delete_1(namespace_title:, group:) ⇒ Object

Raises:

  • (ArgumentError)


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/grafana-api/api/convert.rb', line 30

def api_prom_rules_delete_1(namespace_title:, group:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?
  raise ArgumentError, 'group is required' if group.nil?

  @connection.call(
    :DELETE,
    '/convert/api/prom/rules/{NamespaceTitle}/{Group}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s))
      .gsub('{Group}', ERB::Util.url_encode(group.to_s)),
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic']
  )
end

#api_prom_rules_get(namespace_title:) ⇒ Object

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
54
# File 'lib/grafana-api/api/convert.rb', line 44

def api_prom_rules_get(namespace_title:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?

  @connection.call(
    :GET,
    '/convert/api/prom/rules/{NamespaceTitle}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s)),
    type: Grafana::Api::Models::PrometheusNamespace,
    auth: ['api_key', 'basic']
  )
end

#api_prom_rules_get_1(namespace_title:, group:) ⇒ Object

Raises:

  • (ArgumentError)


56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/grafana-api/api/convert.rb', line 56

def api_prom_rules_get_1(namespace_title:, group:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?
  raise ArgumentError, 'group is required' if group.nil?

  @connection.call(
    :GET,
    '/convert/api/prom/rules/{NamespaceTitle}/{Group}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s))
      .gsub('{Group}', ERB::Util.url_encode(group.to_s)),
    type: Grafana::Api::Models::PrometheusRuleGroup,
    auth: ['api_key', 'basic']
  )
end

#api_prom_rules_postObject



70
71
72
73
74
75
76
77
# File 'lib/grafana-api/api/convert.rb', line 70

def api_prom_rules_post
  @connection.call(
    :POST,
    '/convert/api/prom/rules',
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic']
  )
end

#api_prom_rules_post_1(namespace_title:, x_grafana_alerting_datasource_uid: nil, x_grafana_alerting_recording_rules_paused: nil, x_grafana_alerting_alert_rules_paused: nil, x_grafana_alerting_target_datasource_uid: nil, x_grafana_alerting_folder_uid: nil, x_grafana_alerting_notification_settings: nil, prometheus_rule_group: nil) ⇒ Object

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/grafana-api/api/convert.rb', line 79

def api_prom_rules_post_1(namespace_title:, x_grafana_alerting_datasource_uid: nil, x_grafana_alerting_recording_rules_paused: nil, x_grafana_alerting_alert_rules_paused: nil, x_grafana_alerting_target_datasource_uid: nil, x_grafana_alerting_folder_uid: nil, x_grafana_alerting_notification_settings: nil, prometheus_rule_group: nil)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?

  @connection.call(
    :POST,
    '/convert/api/prom/rules/{NamespaceTitle}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s)),
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic'],
    headers: { 'x-grafana-alerting-datasource-uid' => x_grafana_alerting_datasource_uid, 'x-grafana-alerting-recording-rules-paused' => x_grafana_alerting_recording_rules_paused, 'x-grafana-alerting-alert-rules-paused' => x_grafana_alerting_alert_rules_paused, 'x-grafana-alerting-target-datasource-uid' => x_grafana_alerting_target_datasource_uid, 'x-grafana-alerting-folder-uid' => x_grafana_alerting_folder_uid, 'x-grafana-alerting-notification-settings' => x_grafana_alerting_notification_settings },
    body: prometheus_rule_group
  )
end

#prometheus_config_v1_rulesObject



93
94
95
96
97
98
99
100
# File 'lib/grafana-api/api/convert.rb', line 93

def prometheus_config_v1_rules
  @connection.call(
    :GET,
    '/convert/prometheus/config/v1/rules',
    type: Grafana::Api::Models::PrometheusNamespace,
    auth: ['api_key', 'basic']
  )
end

#prometheus_config_v1_rules_delete(namespace_title:) ⇒ Object

Raises:

  • (ArgumentError)


102
103
104
105
106
107
108
109
110
111
112
# File 'lib/grafana-api/api/convert.rb', line 102

def prometheus_config_v1_rules_delete(namespace_title:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?

  @connection.call(
    :DELETE,
    '/convert/prometheus/config/v1/rules/{NamespaceTitle}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s)),
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic']
  )
end

#prometheus_config_v1_rules_delete_1(namespace_title:, group:) ⇒ Object

Raises:

  • (ArgumentError)


114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/grafana-api/api/convert.rb', line 114

def prometheus_config_v1_rules_delete_1(namespace_title:, group:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?
  raise ArgumentError, 'group is required' if group.nil?

  @connection.call(
    :DELETE,
    '/convert/prometheus/config/v1/rules/{NamespaceTitle}/{Group}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s))
      .gsub('{Group}', ERB::Util.url_encode(group.to_s)),
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic']
  )
end

#prometheus_config_v1_rules_get(namespace_title:) ⇒ Object

Raises:

  • (ArgumentError)


128
129
130
131
132
133
134
135
136
137
138
# File 'lib/grafana-api/api/convert.rb', line 128

def prometheus_config_v1_rules_get(namespace_title:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?

  @connection.call(
    :GET,
    '/convert/prometheus/config/v1/rules/{NamespaceTitle}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s)),
    type: Grafana::Api::Models::PrometheusNamespace,
    auth: ['api_key', 'basic']
  )
end

#prometheus_config_v1_rules_get_1(namespace_title:, group:) ⇒ Object

Raises:

  • (ArgumentError)


140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/grafana-api/api/convert.rb', line 140

def prometheus_config_v1_rules_get_1(namespace_title:, group:)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?
  raise ArgumentError, 'group is required' if group.nil?

  @connection.call(
    :GET,
    '/convert/prometheus/config/v1/rules/{NamespaceTitle}/{Group}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s))
      .gsub('{Group}', ERB::Util.url_encode(group.to_s)),
    type: Grafana::Api::Models::PrometheusRuleGroup,
    auth: ['api_key', 'basic']
  )
end

#prometheus_config_v1_rules_postObject



154
155
156
157
158
159
160
161
# File 'lib/grafana-api/api/convert.rb', line 154

def prometheus_config_v1_rules_post
  @connection.call(
    :POST,
    '/convert/prometheus/config/v1/rules',
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic']
  )
end

#prometheus_config_v1_rules_post_1(namespace_title:, x_grafana_alerting_datasource_uid: nil, x_grafana_alerting_recording_rules_paused: nil, x_grafana_alerting_alert_rules_paused: nil, x_grafana_alerting_target_datasource_uid: nil, x_grafana_alerting_folder_uid: nil, x_grafana_alerting_notification_settings: nil, prometheus_rule_group: nil) ⇒ Object

Raises:

  • (ArgumentError)


163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/grafana-api/api/convert.rb', line 163

def prometheus_config_v1_rules_post_1(namespace_title:, x_grafana_alerting_datasource_uid: nil, x_grafana_alerting_recording_rules_paused: nil, x_grafana_alerting_alert_rules_paused: nil, x_grafana_alerting_target_datasource_uid: nil, x_grafana_alerting_folder_uid: nil, x_grafana_alerting_notification_settings: nil, prometheus_rule_group: nil)
  raise ArgumentError, 'namespace_title is required' if namespace_title.nil?

  @connection.call(
    :POST,
    '/convert/prometheus/config/v1/rules/{NamespaceTitle}'
      .gsub('{NamespaceTitle}', ERB::Util.url_encode(namespace_title.to_s)),
    type: Grafana::Api::Models::ConvertPrometheusResponse,
    auth: ['api_key', 'basic'],
    headers: { 'x-grafana-alerting-datasource-uid' => x_grafana_alerting_datasource_uid, 'x-grafana-alerting-recording-rules-paused' => x_grafana_alerting_recording_rules_paused, 'x-grafana-alerting-alert-rules-paused' => x_grafana_alerting_alert_rules_paused, 'x-grafana-alerting-target-datasource-uid' => x_grafana_alerting_target_datasource_uid, 'x-grafana-alerting-folder-uid' => x_grafana_alerting_folder_uid, 'x-grafana-alerting-notification-settings' => x_grafana_alerting_notification_settings },
    body: prometheus_rule_group
  )
end