Class: OpsgenieSdk::ScheduleRotationApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ScheduleRotationApi

Returns a new instance of ScheduleRotationApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_schedule_rotation(identifier, body, opts = {}) ⇒ SuccessResponse

Create Schedule Rotation Creates a new schedule rotation

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • body

    Request payload of created schedule rotation

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id)

Returns:



29
30
31
32
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 29

def create_schedule_rotation(identifier, body, opts = {})
  data, _status_code, _headers = create_schedule_rotation_with_http_info(identifier, body, opts)
  data
end

#create_schedule_rotation_with_http_info(identifier, body, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Create Schedule Rotation Creates a new schedule rotation

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • body

    Request payload of created schedule rotation

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39;

Returns:

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

    SuccessResponse data, response status code and response headers



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
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 41

def create_schedule_rotation_with_http_info(identifier, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScheduleRotationApi.create_schedule_rotation ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleRotationApi.create_schedule_rotation"
  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 ScheduleRotationApi.create_schedule_rotation"
  end
  if @api_client.config.client_side_validation && opts[:'schedule_identifier_type'] && !['id', 'name'].include?(opts[:'schedule_identifier_type'])
    fail ArgumentError, 'invalid value for "schedule_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/schedules/{identifier}/rotations'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'scheduleIdentifierType'] = opts[:'schedule_identifier_type'] if !opts[:'schedule_identifier_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 = @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 => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScheduleRotationApi#create_schedule_rotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_schedule_rotation(identifier, id, opts = {}) ⇒ SuccessResponse

Delete Schedule Rotation Delete schedule rotation with given identifier

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • id

    Identifier of schedule rotation

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; (default to id)

Returns:



93
94
95
96
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 93

def delete_schedule_rotation(identifier, id, opts = {})
  data, _status_code, _headers = delete_schedule_rotation_with_http_info(identifier, id, opts)
  data
end

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

Delete Schedule Rotation Delete schedule rotation with given identifier

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • id

    Identifier of schedule rotation

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39;

Returns:

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

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

def delete_schedule_rotation_with_http_info(identifier, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScheduleRotationApi.delete_schedule_rotation ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleRotationApi.delete_schedule_rotation"
  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 ScheduleRotationApi.delete_schedule_rotation"
  end
  if @api_client.config.client_side_validation && opts[:'schedule_identifier_type'] && !['id', 'name'].include?(opts[:'schedule_identifier_type'])
    fail ArgumentError, 'invalid value for "schedule_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/schedules/{identifier}/rotations/{id}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'scheduleIdentifierType'] = opts[:'schedule_identifier_type'] if !opts[:'schedule_identifier_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(: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: ScheduleRotationApi#delete_schedule_rotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_schedule_rotation(identifier, id, opts = {}) ⇒ GetScheduleRotationResponse

Get Schedule Rotation Returns schedule rotation with given id

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • id

    Identifier of schedule rotation

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; (default to id)

Returns:



157
158
159
160
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 157

def get_schedule_rotation(identifier, id, opts = {})
  data, _status_code, _headers = get_schedule_rotation_with_http_info(identifier, id, opts)
  data
end

#get_schedule_rotation_with_http_info(identifier, id, opts = {}) ⇒ Array<(GetScheduleRotationResponse, Fixnum, Hash)>

Get Schedule Rotation Returns schedule rotation with given id

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • id

    Identifier of schedule rotation

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39;

Returns:



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
209
210
211
212
213
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 169

def get_schedule_rotation_with_http_info(identifier, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScheduleRotationApi.get_schedule_rotation ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleRotationApi.get_schedule_rotation"
  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 ScheduleRotationApi.get_schedule_rotation"
  end
  if @api_client.config.client_side_validation && opts[:'schedule_identifier_type'] && !['id', 'name'].include?(opts[:'schedule_identifier_type'])
    fail ArgumentError, 'invalid value for "schedule_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/schedules/{identifier}/rotations/{id}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'scheduleIdentifierType'] = opts[:'schedule_identifier_type'] if !opts[:'schedule_identifier_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 => 'GetScheduleRotationResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScheduleRotationApi#get_schedule_rotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_schedule_rotations(identifier, opts = {}) ⇒ ListScheduleRotationsResponse

List Schedule Rotations Returns list of schedule rotations

Parameters:

  • identifier

    Identifier of schedule which could be id or name

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; (default to id)

Returns:



220
221
222
223
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 220

def list_schedule_rotations(identifier, opts = {})
  data, _status_code, _headers = list_schedule_rotations_with_http_info(identifier, opts)
  data
end

#list_schedule_rotations_with_http_info(identifier, opts = {}) ⇒ Array<(ListScheduleRotationsResponse, Fixnum, Hash)>

List Schedule Rotations Returns list of schedule rotations

Parameters:

  • identifier

    Identifier of schedule which could be id or name

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39;

Returns:



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/opsgenie_sdk/api/schedule_rotation_api.rb', line 231

def list_schedule_rotations_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScheduleRotationApi.list_schedule_rotations ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleRotationApi.list_schedule_rotations"
  end
  if @api_client.config.client_side_validation && opts[:'schedule_identifier_type'] && !['id', 'name'].include?(opts[:'schedule_identifier_type'])
    fail ArgumentError, 'invalid value for "schedule_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/schedules/{identifier}/rotations'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'scheduleIdentifierType'] = opts[:'schedule_identifier_type'] if !opts[:'schedule_identifier_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 => 'ListScheduleRotationsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScheduleRotationApi#list_schedule_rotations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_schedule_rotation(identifier, id, body, opts = {}) ⇒ SuccessResponse

Update Schedule Rotation (Partial) Update schedule rotation with given id

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • id

    Identifier of schedule rotation

  • body

    Request payload of update schedule rotation action

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; (default to id)

Returns:



280
281
282
283
# File 'lib/opsgenie_sdk/api/schedule_rotation_api.rb', line 280

def update_schedule_rotation(identifier, id, body, opts = {})
  data, _status_code, _headers = update_schedule_rotation_with_http_info(identifier, id, body, opts)
  data
end

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

Update Schedule Rotation (Partial) Update schedule rotation with given id

Parameters:

  • identifier

    Identifier of schedule which could be id or name

  • id

    Identifier of schedule rotation

  • body

    Request payload of update schedule rotation action

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

    the optional parameters

Options Hash (opts):

  • :schedule_identifier_type (String)

    Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39;

Returns:

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

    SuccessResponse data, response status code and response headers



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

def update_schedule_rotation_with_http_info(identifier, id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ScheduleRotationApi.update_schedule_rotation ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleRotationApi.update_schedule_rotation"
  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 ScheduleRotationApi.update_schedule_rotation"
  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 ScheduleRotationApi.update_schedule_rotation"
  end
  if @api_client.config.client_side_validation && opts[:'schedule_identifier_type'] && !['id', 'name'].include?(opts[:'schedule_identifier_type'])
    fail ArgumentError, 'invalid value for "schedule_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/schedules/{identifier}/rotations/{id}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'scheduleIdentifierType'] = opts[:'schedule_identifier_type'] if !opts[:'schedule_identifier_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 = @api_client.object_to_http_body(body)
  auth_names = ['GenieKey']
  data, status_code, headers = @api_client.call_api(:PATCH, 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: ScheduleRotationApi#update_schedule_rotation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end