class OpsgenieSdk::TeamRoleApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

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

Create Team Role Creates a new team role @param identifier Identifier of the team @param body Request payload of created team role @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are 'id' and 'name'. Default value is 'id' (default to id) @return [SuccessResponse]

# File lib/opsgenie_sdk/api/team_role_api.rb, line 29
def create_team_role(identifier, body, opts = {})
  data, _status_code, _headers = create_team_role_with_http_info(identifier, body, opts)
  data
end
create_team_role_with_http_info(identifier, body, opts = {}) click to toggle source

Create Team Role Creates a new team role @param identifier Identifier of the team @param body Request payload of created team role @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/team_role_api.rb, line 41
def create_team_role_with_http_info(identifier, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamRoleApi.create_team_role ...'
  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 TeamRoleApi.create_team_role"
  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 TeamRoleApi.create_team_role"
  end
  if @api_client.config.client_side_validation && opts[:'team_identifier_type'] && !['id', 'name'].include?(opts[:'team_identifier_type'])
    fail ArgumentError, 'invalid value for "team_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/teams/{identifier}/roles'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamIdentifierType'] = opts[:'team_identifier_type'] if !opts[:'team_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: TeamRoleApi#create_team_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_team_role(identifier, team_role_identifier, opts = {}) click to toggle source

Delete Team Role Deletes a team role using team role 'id' or 'name' @param identifier Identifier of the team @param team_role_identifier Identifier of team role which could be team role &#39;id&#39; or &#39;name&#39; @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; (default to id) @option opts [String] :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/team_role_api.rb, line 94
def delete_team_role(identifier, team_role_identifier, opts = {})
  data, _status_code, _headers = delete_team_role_with_http_info(identifier, team_role_identifier, opts)
  data
end
delete_team_role_with_http_info(identifier, team_role_identifier, opts = {}) click to toggle source

Delete Team Role Deletes a team role using team role &#39;id&#39; or &#39;name&#39; @param identifier Identifier of the team @param team_role_identifier Identifier of team role which could be team role &#39;id&#39; or &#39;name&#39; @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; @option opts [String] :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/team_role_api.rb, line 107
def delete_team_role_with_http_info(identifier, team_role_identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamRoleApi.delete_team_role ...'
  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 TeamRoleApi.delete_team_role"
  end
  # verify the required parameter 'team_role_identifier' is set
  if @api_client.config.client_side_validation && team_role_identifier.nil?
    fail ArgumentError, "Missing the required parameter 'team_role_identifier' when calling TeamRoleApi.delete_team_role"
  end
  if @api_client.config.client_side_validation && opts[:'team_identifier_type'] && !['id', 'name'].include?(opts[:'team_identifier_type'])
    fail ArgumentError, 'invalid value for "team_identifier_type", must be one of id, name'
  end
  if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type'])
    fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/teams/{identifier}/roles/{teamRoleIdentifier}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'teamRoleIdentifier' + '}', team_role_identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamIdentifierType'] = opts[:'team_identifier_type'] if !opts[:'team_identifier_type'].nil?
  query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'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: TeamRoleApi#delete_team_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_team_role(identifier, team_role_identifier, opts = {}) click to toggle source

Get Team Role Returns team role with given 'id' or 'name' @param identifier Identifier of the team @param team_role_identifier Identifier of team role which could be team role &#39;id&#39; or &#39;name&#39; @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; (default to id) @option opts [String] :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 [GetTeamRoleResponse]

# File lib/opsgenie_sdk/api/team_role_api.rb, line 164
def get_team_role(identifier, team_role_identifier, opts = {})
  data, _status_code, _headers = get_team_role_with_http_info(identifier, team_role_identifier, opts)
  data
end
get_team_role_with_http_info(identifier, team_role_identifier, opts = {}) click to toggle source

Get Team Role Returns team role with given &#39;id&#39; or &#39;name&#39; @param identifier Identifier of the team @param team_role_identifier Identifier of team role which could be team role &#39;id&#39; or &#39;name&#39; @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; @option opts [String] :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<(GetTeamRoleResponse, Fixnum, Hash)>] GetTeamRoleResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/team_role_api.rb, line 177
def get_team_role_with_http_info(identifier, team_role_identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamRoleApi.get_team_role ...'
  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 TeamRoleApi.get_team_role"
  end
  # verify the required parameter 'team_role_identifier' is set
  if @api_client.config.client_side_validation && team_role_identifier.nil?
    fail ArgumentError, "Missing the required parameter 'team_role_identifier' when calling TeamRoleApi.get_team_role"
  end
  if @api_client.config.client_side_validation && opts[:'team_identifier_type'] && !['id', 'name'].include?(opts[:'team_identifier_type'])
    fail ArgumentError, 'invalid value for "team_identifier_type", must be one of id, name'
  end
  if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type'])
    fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/teams/{identifier}/roles/{teamRoleIdentifier}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'teamRoleIdentifier' + '}', team_role_identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamIdentifierType'] = opts[:'team_identifier_type'] if !opts[:'team_identifier_type'].nil?
  query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'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 => 'GetTeamRoleResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamRoleApi#get_team_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_team_roles(identifier, opts = {}) click to toggle source

List Team Roles Returns list of team roles @param identifier Identifier of the team @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; (default to id) @return [ListTeamRoleResponse]

# File lib/opsgenie_sdk/api/team_role_api.rb, line 232
def list_team_roles(identifier, opts = {})
  data, _status_code, _headers = list_team_roles_with_http_info(identifier, opts)
  data
end
list_team_roles_with_http_info(identifier, opts = {}) click to toggle source

List Team Roles Returns list of team roles @param identifier Identifier of the team @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; @return [Array<(ListTeamRoleResponse, Fixnum, Hash)>] ListTeamRoleResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/team_role_api.rb, line 243
def list_team_roles_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamRoleApi.list_team_roles ...'
  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 TeamRoleApi.list_team_roles"
  end
  if @api_client.config.client_side_validation && opts[:'team_identifier_type'] && !['id', 'name'].include?(opts[:'team_identifier_type'])
    fail ArgumentError, 'invalid value for "team_identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/teams/{identifier}/roles'.sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamIdentifierType'] = opts[:'team_identifier_type'] if !opts[:'team_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 => 'ListTeamRoleResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TeamRoleApi#list_team_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_team_role(identifier, team_role_identifier, opts = {}) click to toggle source

Update Team Role (Partial) Updates the team role using team role 'id' or 'name' @param identifier Identifier of the team @param team_role_identifier Identifier of team role which could be team role &#39;id&#39; or &#39;name&#39; @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; (default to id) @option opts [String] :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) @option opts [UpdateTeamRolePayload] :body Request payload of update team role @return [SuccessResponse]

# File lib/opsgenie_sdk/api/team_role_api.rb, line 293
def update_team_role(identifier, team_role_identifier, opts = {})
  data, _status_code, _headers = update_team_role_with_http_info(identifier, team_role_identifier, opts)
  data
end
update_team_role_with_http_info(identifier, team_role_identifier, opts = {}) click to toggle source

Update Team Role (Partial) Updates the team role using team role &#39;id&#39; or &#39;name&#39; @param identifier Identifier of the team @param team_role_identifier Identifier of team role which could be team role &#39;id&#39; or &#39;name&#39; @param [Hash] opts the optional parameters @option opts [String] :team_identifier_type Type of the identifier. Possible values are &#39;id&#39; and &#39;name&#39;. Default value is &#39;id&#39; @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are &#39;id&#39; or &#39;name&#39; @option opts [UpdateTeamRolePayload] :body Request payload of update team role @return [Array<(SuccessResponse, Fixnum, Hash)>] SuccessResponse data, response status code and response headers

# File lib/opsgenie_sdk/api/team_role_api.rb, line 307
def update_team_role_with_http_info(identifier, team_role_identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TeamRoleApi.update_team_role ...'
  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 TeamRoleApi.update_team_role"
  end
  # verify the required parameter 'team_role_identifier' is set
  if @api_client.config.client_side_validation && team_role_identifier.nil?
    fail ArgumentError, "Missing the required parameter 'team_role_identifier' when calling TeamRoleApi.update_team_role"
  end
  if @api_client.config.client_side_validation && opts[:'team_identifier_type'] && !['id', 'name'].include?(opts[:'team_identifier_type'])
    fail ArgumentError, 'invalid value for "team_identifier_type", must be one of id, name'
  end
  if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type'])
    fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name'
  end
  # resource path
  local_var_path = '/v2/teams/{identifier}/roles/{teamRoleIdentifier}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'teamRoleIdentifier' + '}', team_role_identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'teamIdentifierType'] = opts[:'team_identifier_type'] if !opts[:'team_identifier_type'].nil?
  query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'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(opts[:'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: TeamRoleApi#update_team_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end