Class: TogaiClient::AlertsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/togai_client/api/alerts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AlertsApi

Returns a new instance of AlertsApi.



19
20
21
# File 'lib/togai_client/api/alerts_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/togai_client/api/alerts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_alert(create_alert_request, opts = {}) ⇒ Alert

Create an alert Create an alert

Parameters:

  • create_alert_request (CreateAlertRequest)

    Payload to install an alert

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/togai_client/api/alerts_api.rb', line 27

def create_alert(create_alert_request, opts = {})
  data, _status_code, _headers = create_alert_with_http_info(create_alert_request, opts)
  data
end

#create_alert_with_http_info(create_alert_request, opts = {}) ⇒ Array<(Alert, Integer, Hash)>

Create an alert Create an alert

Parameters:

  • create_alert_request (CreateAlertRequest)

    Payload to install an alert

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Alert, Integer, Hash)>)

    Alert data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/togai_client/api/alerts_api.rb', line 37

def create_alert_with_http_info(create_alert_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.create_alert ...'
  end
  # verify the required parameter 'create_alert_request' is set
  if @api_client.config.client_side_validation && create_alert_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_alert_request' when calling AlertsApi.create_alert"
  end
  # resource path
  local_var_path = '/alerts'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_alert_request)

  # return_type
  return_type = opts[:debug_return_type] || 'Alert'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.create_alert",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#create_alert\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_alert_template(alert_template_id, opts = {}) ⇒ AlertTemplate

Get an alert template Get an alert template

Parameters:

  • alert_template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



95
96
97
98
# File 'lib/togai_client/api/alerts_api.rb', line 95

def get_alert_template(alert_template_id, opts = {})
  data, _status_code, _headers = get_alert_template_with_http_info(alert_template_id, opts)
  data
end

#get_alert_template_with_http_info(alert_template_id, opts = {}) ⇒ Array<(AlertTemplate, Integer, Hash)>

Get an alert template Get an alert template

Parameters:

  • alert_template_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AlertTemplate, Integer, Hash)>)

    AlertTemplate data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/togai_client/api/alerts_api.rb', line 105

def get_alert_template_with_http_info(alert_template_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_alert_template ...'
  end
  # verify the required parameter 'alert_template_id' is set
  if @api_client.config.client_side_validation && alert_template_id.nil?
    fail ArgumentError, "Missing the required parameter 'alert_template_id' when calling AlertsApi.get_alert_template"
  end
  # resource path
  local_var_path = '/alert_templates/{alert_template_id}'.sub('{' + 'alert_template_id' + '}', CGI.escape(alert_template_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AlertTemplate'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.get_alert_template",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#get_alert_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_alert_templates(opts = {}) ⇒ AlertTemplatesPaginatedResponse

List alert templates Returns a list of alert templates with pagination and sort.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



157
158
159
160
# File 'lib/togai_client/api/alerts_api.rb', line 157

def get_alert_templates(opts = {})
  data, _status_code, _headers = get_alert_templates_with_http_info(opts)
  data
end

#get_alert_templates_with_http_info(opts = {}) ⇒ Array<(AlertTemplatesPaginatedResponse, Integer, Hash)>

List alert templates Returns a list of alert templates with pagination and sort.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/togai_client/api/alerts_api.rb', line 166

def get_alert_templates_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_alert_templates ...'
  end
  # resource path
  local_var_path = '/alert_templates'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AlertTemplatesPaginatedResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.get_alert_templates",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#get_alert_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_incident(incident_id, opts = {}) ⇒ Incident

Get an incident Get an incident

Parameters:

  • incident_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



215
216
217
218
# File 'lib/togai_client/api/alerts_api.rb', line 215

def get_incident(incident_id, opts = {})
  data, _status_code, _headers = get_incident_with_http_info(incident_id, opts)
  data
end

#get_incident_with_http_info(incident_id, opts = {}) ⇒ Array<(Incident, Integer, Hash)>

Get an incident Get an incident

Parameters:

  • incident_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Incident, Integer, Hash)>)

    Incident data, response status code and response headers



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/togai_client/api/alerts_api.rb', line 225

def get_incident_with_http_info(incident_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_incident ...'
  end
  # verify the required parameter 'incident_id' is set
  if @api_client.config.client_side_validation && incident_id.nil?
    fail ArgumentError, "Missing the required parameter 'incident_id' when calling AlertsApi.get_incident"
  end
  # resource path
  local_var_path = '/incidents/{incident_id}'.sub('{' + 'incident_id' + '}', CGI.escape(incident_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Incident'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.get_incident",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#get_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_incidents(opts = {}) ⇒ IncidentsPaginatedResponse

List incidents Returns a list of incidents with pagination and sort.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



277
278
279
280
# File 'lib/togai_client/api/alerts_api.rb', line 277

def get_incidents(opts = {})
  data, _status_code, _headers = get_incidents_with_http_info(opts)
  data
end

#get_incidents_with_http_info(opts = {}) ⇒ Array<(IncidentsPaginatedResponse, Integer, Hash)>

List incidents Returns a list of incidents with pagination and sort.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(IncidentsPaginatedResponse, Integer, Hash)>)

    IncidentsPaginatedResponse data, response status code and response headers



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/togai_client/api/alerts_api.rb', line 286

def get_incidents_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_incidents ...'
  end
  # resource path
  local_var_path = '/incidents'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'IncidentsPaginatedResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.get_incidents",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#get_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_alerts(opts = {}) ⇒ AlertsPaginatedResponse

List alerts Returns a list of alerts with pagination and sort.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



334
335
336
337
# File 'lib/togai_client/api/alerts_api.rb', line 334

def list_alerts(opts = {})
  data, _status_code, _headers = list_alerts_with_http_info(opts)
  data
end

#list_alerts_with_http_info(opts = {}) ⇒ Array<(AlertsPaginatedResponse, Integer, Hash)>

List alerts Returns a list of alerts with pagination and sort.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AlertsPaginatedResponse, Integer, Hash)>)

    AlertsPaginatedResponse data, response status code and response headers



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/togai_client/api/alerts_api.rb', line 343

def list_alerts_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.list_alerts ...'
  end
  # resource path
  local_var_path = '/alerts'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AlertsPaginatedResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.list_alerts",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#list_alerts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_alert(alert_id, opts = {}) ⇒ Alert

Update an alert Update an alert

Parameters:

  • alert_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



393
394
395
396
# File 'lib/togai_client/api/alerts_api.rb', line 393

def update_alert(alert_id, opts = {})
  data, _status_code, _headers = update_alert_with_http_info(alert_id, opts)
  data
end

#update_alert_with_http_info(alert_id, opts = {}) ⇒ Array<(Alert, Integer, Hash)>

Update an alert Update an alert

Parameters:

  • alert_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Alert, Integer, Hash)>)

    Alert data, response status code and response headers



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/togai_client/api/alerts_api.rb', line 404

def update_alert_with_http_info(alert_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.update_alert ...'
  end
  # verify the required parameter 'alert_id' is set
  if @api_client.config.client_side_validation && alert_id.nil?
    fail ArgumentError, "Missing the required parameter 'alert_id' when calling AlertsApi.update_alert"
  end
  # resource path
  local_var_path = '/alerts/{alert_id}'.sub('{' + 'alert_id' + '}', CGI.escape(alert_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_alert_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'Alert'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.update_alert",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#update_alert\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_incident_status(incident_id, opts = {}) ⇒ Incident

Update an incident status Update an incident status

Parameters:

  • incident_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



463
464
465
466
# File 'lib/togai_client/api/alerts_api.rb', line 463

def update_incident_status(incident_id, opts = {})
  data, _status_code, _headers = update_incident_status_with_http_info(incident_id, opts)
  data
end

#update_incident_status_with_http_info(incident_id, opts = {}) ⇒ Array<(Incident, Integer, Hash)>

Update an incident status Update an incident status

Parameters:

  • incident_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Incident, Integer, Hash)>)

    Incident data, response status code and response headers



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/togai_client/api/alerts_api.rb', line 474

def update_incident_status_with_http_info(incident_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.update_incident_status ...'
  end
  # verify the required parameter 'incident_id' is set
  if @api_client.config.client_side_validation && incident_id.nil?
    fail ArgumentError, "Missing the required parameter 'incident_id' when calling AlertsApi.update_incident_status"
  end
  # resource path
  local_var_path = '/incidents/{incident_id}/status'.sub('{' + 'incident_id' + '}', CGI.escape(incident_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_incident_status_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'Incident'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"AlertsApi.update_incident_status",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#update_incident_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end