class OpsgenieSdk::PolicyApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

change_policy_order(policy_id, body, opts = {}) click to toggle source

Change Policy Order Change execution order of the policy with given id @param policy_id Id of the requested policy @param body Change order payload @param [Hash] opts the optional parameters @option opts [String] :team_id TeamId of policy created if it belongs to a team @return [SuccessResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 29
def change_policy_order(policy_id, body, opts = {})
  data, _status_code, _headers = change_policy_order_with_http_info(policy_id, body, opts)
  data
end
change_policy_order_with_http_info(policy_id, body, opts = {}) click to toggle source

Change Policy Order Change execution order of the policy with given id @param policy_id Id of the requested policy @param body Change order payload @param [Hash] opts the optional parameters @option opts [String] :team_id TeamId of policy created if it belongs to a team @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 41
def change_policy_order_with_http_info(policy_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.change_policy_order ...'
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling PolicyApi.change_policy_order"
  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 PolicyApi.change_policy_order"
  end
  # resource path
  local_var_path = '/v2/policies/{policyId}/change-order'.sub('{' + 'policyId' + '}', policy_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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: PolicyApi#change_policy_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_policy(body, opts = {}) click to toggle source

Create Policy Creates a new policy @param body Payload of created policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [CreatePolicyResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 89
def create_policy(body, opts = {})
  data, _status_code, _headers = create_policy_with_http_info(body, opts)
  data
end
create_policy_with_http_info(body, opts = {}) click to toggle source

Create Policy Creates a new policy @param body Payload of created policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(CreatePolicyResponse, Fixnum, Hash)>] CreatePolicyResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 100
def create_policy_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.create_policy ...'
  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 PolicyApi.create_policy"
  end
  # resource path
  local_var_path = '/v2/policies'

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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 => 'CreatePolicyResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PolicyApi#create_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_policy(policy_id, opts = {}) click to toggle source

Delete Policy Delete policy with given id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [SuccessResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 144
def delete_policy(policy_id, opts = {})
  data, _status_code, _headers = delete_policy_with_http_info(policy_id, opts)
  data
end
delete_policy_with_http_info(policy_id, opts = {}) click to toggle source

Delete Policy Delete policy with given id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 155
def delete_policy_with_http_info(policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.delete_policy ...'
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling PolicyApi.delete_policy"
  end
  # resource path
  local_var_path = '/v2/policies/{policyId}'.sub('{' + 'policyId' + '}', policy_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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: PolicyApi#delete_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
disable_policy(policy_id, opts = {}) click to toggle source

Disable Policy Disable the policy with given id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [SuccessResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 199
def disable_policy(policy_id, opts = {})
  data, _status_code, _headers = disable_policy_with_http_info(policy_id, opts)
  data
end
disable_policy_with_http_info(policy_id, opts = {}) click to toggle source

Disable Policy Disable the policy with given id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 210
def disable_policy_with_http_info(policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.disable_policy ...'
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling PolicyApi.disable_policy"
  end
  # resource path
  local_var_path = '/v2/policies/{policyId}/disable'.sub('{' + 'policyId' + '}', policy_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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(: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: PolicyApi#disable_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
enable_policy(policy_id, opts = {}) click to toggle source

Enable Policy Enable the policy with given id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [SuccessResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 254
def enable_policy(policy_id, opts = {})
  data, _status_code, _headers = enable_policy_with_http_info(policy_id, opts)
  data
end
enable_policy_with_http_info(policy_id, opts = {}) click to toggle source

Enable Policy Enable the policy with given id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 265
def enable_policy_with_http_info(policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.enable_policy ...'
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling PolicyApi.enable_policy"
  end
  # resource path
  local_var_path = '/v2/policies/{policyId}/enable'.sub('{' + 'policyId' + '}', policy_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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(: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: PolicyApi#enable_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_policy(policy_id, opts = {}) click to toggle source

Get Policy Used to get details of a single policy with id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [GetPolicyResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 309
def get_policy(policy_id, opts = {})
  data, _status_code, _headers = get_policy_with_http_info(policy_id, opts)
  data
end
get_policy_with_http_info(policy_id, opts = {}) click to toggle source

Get Policy Used to get details of a single policy with id @param policy_id Id of the requested policy @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(GetPolicyResponse, Fixnum, Hash)>] GetPolicyResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 320
def get_policy_with_http_info(policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.get_policy ...'
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling PolicyApi.get_policy"
  end
  # resource path
  local_var_path = '/v2/policies/{policyId}'.sub('{' + 'policyId' + '}', policy_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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 => 'GetPolicyResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PolicyApi#get_policy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_alert_policies(opts = {}) click to toggle source

List Alert Policies Returns the list of alert policies @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [ListPoliciesResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 363
def list_alert_policies(opts = {})
  data, _status_code, _headers = list_alert_policies_with_http_info(opts)
  data
end
list_alert_policies_with_http_info(opts = {}) click to toggle source

List Alert Policies Returns the list of alert policies @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(ListPoliciesResponse, Fixnum, Hash)>] ListPoliciesResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 373
def list_alert_policies_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.list_alert_policies ...'
  end
  # resource path
  local_var_path = '/v2/policies/alert'

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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 => 'ListPoliciesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PolicyApi#list_alert_policies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_notification_policies(opts = {}) click to toggle source

List Notification Policies Returns the list of notification policies @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [ListPoliciesResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 412
def list_notification_policies(opts = {})
  data, _status_code, _headers = list_notification_policies_with_http_info(opts)
  data
end
list_notification_policies_with_http_info(opts = {}) click to toggle source

List Notification Policies Returns the list of notification policies @param [Hash] opts the optional parameters @option opts [Object] :team_id TeamId of policy created if it belongs to a team @return [Array<(ListPoliciesResponse, Fixnum, Hash)>] ListPoliciesResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 422
def list_notification_policies_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.list_notification_policies ...'
  end
  # resource path
  local_var_path = '/v2/policies/notification'

  # query parameters
  query_params = {}
  query_params[:'teamId'] = opts[:'team_id'] if !opts[:'team_id'].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 => 'ListPoliciesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PolicyApi#list_notification_policies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_policy(policy_id, body, opts = {}) click to toggle source

Update Policy Update alert policy with given id @param policy_id Id of the requested policy @param body Payload of updated policy @param [Hash] opts the optional parameters @option opts [String] :team_id TeamId of policy created if it belongs to a team @return [SuccessResponse]

# File lib/opsgenie_sdk/api/policy_api.rb, line 463
def update_policy(policy_id, body, opts = {})
  data, _status_code, _headers = update_policy_with_http_info(policy_id, body, opts)
  data
end
update_policy_with_http_info(policy_id, body, opts = {}) click to toggle source

Update Policy Update alert policy with given id @param policy_id Id of the requested policy @param body Payload of updated policy @param [Hash] opts the optional parameters @option opts [String] :team_id TeamId of policy created if it belongs to a team @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/policy_api.rb, line 475
def update_policy_with_http_info(policy_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PolicyApi.update_policy ...'
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling PolicyApi.update_policy"
  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 PolicyApi.update_policy"
  end
  # resource path
  local_var_path = '/v2/policies/{policyId}'.sub('{' + 'policyId' + '}', policy_id.to_s)

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