Class: OpsgenieSdk::MaintenanceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/opsgenie_sdk/api/maintenance_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MaintenanceApi

Returns a new instance of MaintenanceApi.



19
20
21
# File 'lib/opsgenie_sdk/api/maintenance_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/opsgenie_sdk/api/maintenance_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_maintenance(id, opts = {}) ⇒ SuccessResponse

Cancel Maintenance Cancel maintenance with given id

Parameters:

  • id

    Identifier of the maintenance to be searched

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 27

def cancel_maintenance(id, opts = {})
  data, _status_code, _headers = cancel_maintenance_with_http_info(id, opts)
  data
end

#cancel_maintenance_with_http_info(id, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Cancel Maintenance Cancel maintenance with given id

Parameters:

  • id

    Identifier of the maintenance to be searched

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

    the optional parameters

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse 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
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 37

def cancel_maintenance_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MaintenanceApi.cancel_maintenance ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MaintenanceApi.cancel_maintenance"
  end
  # resource path
  local_var_path = '/v1/maintenance/{id}/cancel'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MaintenanceApi#cancel_maintenance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_maintenance(body, opts = {}) ⇒ CreateMaintenanceResponse

Create Maintenance Creates a new maintenance

Parameters:

  • body

    Request payload of the maintenance object

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

    the optional parameters

Returns:



79
80
81
82
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 79

def create_maintenance(body, opts = {})
  data, _status_code, _headers = create_maintenance_with_http_info(body, opts)
  data
end

#create_maintenance_with_http_info(body, opts = {}) ⇒ Array<(CreateMaintenanceResponse, Fixnum, Hash)>

Create Maintenance Creates a new maintenance

Parameters:

  • body

    Request payload of the maintenance object

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

    the optional parameters

Returns:

  • (Array<(CreateMaintenanceResponse, Fixnum, Hash)>)

    CreateMaintenanceResponse data, response status code and response headers



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 89

def create_maintenance_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MaintenanceApi.create_maintenance ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling MaintenanceApi.create_maintenance"
  end
  # resource path
  local_var_path = '/v1/maintenance'

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'CreateMaintenanceResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MaintenanceApi#create_maintenance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_maintenance(id, opts = {}) ⇒ SuccessResponse

Delete Maintenance Delete maintenance with given identifier

Parameters:

  • id

    Identifier of the maintenance to be searched

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

    the optional parameters

Returns:



131
132
133
134
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 131

def delete_maintenance(id, opts = {})
  data, _status_code, _headers = delete_maintenance_with_http_info(id, opts)
  data
end

#delete_maintenance_with_http_info(id, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Delete Maintenance Delete maintenance with given identifier

Parameters:

  • id

    Identifier of the maintenance to be searched

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

    the optional parameters

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse data, response status code and response headers



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 141

def delete_maintenance_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MaintenanceApi.delete_maintenance ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MaintenanceApi.delete_maintenance"
  end
  # resource path
  local_var_path = '/v1/maintenance/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MaintenanceApi#delete_maintenance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_maintenance(id, opts = {}) ⇒ GetMaintenanceResponse

Get Maintenance Returns maintenance with given id

Parameters:

  • id

    Identifier of the maintenance to be searched

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

    the optional parameters

Returns:



183
184
185
186
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 183

def get_maintenance(id, opts = {})
  data, _status_code, _headers = get_maintenance_with_http_info(id, opts)
  data
end

#get_maintenance_with_http_info(id, opts = {}) ⇒ Array<(GetMaintenanceResponse, Fixnum, Hash)>

Get Maintenance Returns maintenance with given id

Parameters:

  • id

    Identifier of the maintenance to be searched

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

    the optional parameters

Returns:

  • (Array<(GetMaintenanceResponse, Fixnum, Hash)>)

    GetMaintenanceResponse data, response status code and response headers



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 193

def get_maintenance_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MaintenanceApi.get_maintenance ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MaintenanceApi.get_maintenance"
  end
  # resource path
  local_var_path = '/v1/maintenance/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'GetMaintenanceResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MaintenanceApi#get_maintenance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_maintenance(opts = {}) ⇒ ListMaintenanceResponse

List Maintenance List maintenance by type

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :type (String)

    Type of the maintenance list to be searched (default to [all])

Returns:



235
236
237
238
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 235

def list_maintenance(opts = {})
  data, _status_code, _headers = list_maintenance_with_http_info(opts)
  data
end

#list_maintenance_with_http_info(opts = {}) ⇒ Array<(ListMaintenanceResponse, Fixnum, Hash)>

List Maintenance List maintenance by type

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :type (String)

    Type of the maintenance list to be searched

Returns:

  • (Array<(ListMaintenanceResponse, Fixnum, Hash)>)

    ListMaintenanceResponse data, response status code and response headers



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
272
273
274
275
276
277
278
279
280
281
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 245

def list_maintenance_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MaintenanceApi.list_maintenance ...'
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['all', 'past', 'non-expired'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of all, past, non-expired'
  end
  # resource path
  local_var_path = '/v1/maintenance'

  # query parameters
  query_params = {}
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListMaintenanceResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MaintenanceApi#list_maintenance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_maintenance(id, body, opts = {}) ⇒ UpdateMaintenanceResponse

Update Maintenance Update maintenance with given id

Parameters:

  • id

    Identifier of the maintenance to be searched

  • body

    Request payload of the maintenance object

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

    the optional parameters

Returns:



288
289
290
291
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 288

def update_maintenance(id, body, opts = {})
  data, _status_code, _headers = update_maintenance_with_http_info(id, body, opts)
  data
end

#update_maintenance_with_http_info(id, body, opts = {}) ⇒ Array<(UpdateMaintenanceResponse, Fixnum, Hash)>

Update Maintenance Update maintenance with given id

Parameters:

  • id

    Identifier of the maintenance to be searched

  • body

    Request payload of the maintenance object

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

    the optional parameters

Returns:

  • (Array<(UpdateMaintenanceResponse, Fixnum, Hash)>)

    UpdateMaintenanceResponse data, response status code and response headers



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
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/opsgenie_sdk/api/maintenance_api.rb', line 299

def update_maintenance_with_http_info(id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MaintenanceApi.update_maintenance ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling MaintenanceApi.update_maintenance"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling MaintenanceApi.update_maintenance"
  end
  # resource path
  local_var_path = '/v1/maintenance/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UpdateMaintenanceResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MaintenanceApi#update_maintenance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end