class OpsgenieSdk::ScheduleRotationApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/opsgenie_sdk/api/schedule_rotation_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_schedule_rotation(identifier, body, opts = {}) click to toggle source

Create Schedule Rotation Creates a new schedule rotation @param identifier Identifier of schedule which could be id or name @param body Request payload of created schedule rotation @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id) @return [SuccessResponse]

# 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 = {}) click to toggle source

Create Schedule Rotation Creates a new schedule rotation @param identifier Identifier of schedule which could be id or name @param body Request payload of created schedule rotation @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# 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 = {}) click to toggle source

Delete Schedule Rotation Delete schedule rotation with given identifier @param identifier Identifier of schedule which could be id or name @param id Identifier of schedule rotation @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type 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) @return [SuccessResponse]

# 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 = {}) click to toggle source

Delete Schedule Rotation Delete schedule rotation with given identifier @param identifier Identifier of schedule which could be id or name @param id Identifier of schedule rotation @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# 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 = {}) click to toggle source

Get Schedule Rotation Returns schedule rotation with given id @param identifier Identifier of schedule which could be id or name @param id Identifier of schedule rotation @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type 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) @return [GetScheduleRotationResponse]

# 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 = {}) click to toggle source

Get Schedule Rotation Returns schedule rotation with given id @param identifier Identifier of schedule which could be id or name @param id Identifier of schedule rotation @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; @return [Array<(GetScheduleRotationResponse, Fixnum, Hash)>] GetScheduleRotationResponse data, response status code and response headers

# 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 = {}) click to toggle source

List Schedule Rotations Returns list of schedule rotations @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type 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) @return [ListScheduleRotationsResponse]

# 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 = {}) click to toggle source

List Schedule Rotations Returns list of schedule rotations @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; @return [Array<(ListScheduleRotationsResponse, Fixnum, Hash)>] ListScheduleRotationsResponse data, response status code and response headers

# 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 = {}) click to toggle source

Update Schedule Rotation (Partial) Update schedule rotation with given id @param identifier Identifier of schedule which could be id or name @param id Identifier of schedule rotation @param body Request payload of update schedule rotation action @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type 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) @return [SuccessResponse]

# 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 = {}) click to toggle source

Update Schedule Rotation (Partial) Update schedule rotation with given id @param identifier Identifier of schedule which could be id or name @param id Identifier of schedule rotation @param body Request payload of update schedule rotation action @param [Hash] opts the optional parameters @option opts [String] :schedule_identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# 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