Packages
REST API Generated with swagger-codegen using the OpsGenie OpenAPI Specification.
Current section
Files
Jump to
Current section
Files
lib/ops_genie_restapi/api/schedule_rotation.ex
# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.
defmodule OpsGenieRESTAPI.Api.ScheduleRotation do
@moduledoc """
API calls for all endpoints tagged `ScheduleRotation`.
"""
alias OpsGenieRESTAPI.Connection
import OpsGenieRESTAPI.RequestBuilder
@doc """
Create Schedule Rotation
Creates a new schedule rotation
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of schedule which could be id or name
- body (CreateScheduleRotationPayload): Request payload of created schedule rotation
- opts (KeywordList): [optional] Optional parameters
- :schedule_identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec create_schedule_rotation(Tesla.Env.client, String.t, OpsGenieRESTAPI.Model.CreateScheduleRotationPayload.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def create_schedule_rotation(connection, identifier, body, opts \\ []) do
optional_params = %{
:"scheduleIdentifierType" => :query
}
%{}
|> method(:post)
|> url("/v2/schedules/#{identifier}/rotations")
|> add_param(:body, :"body", body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Delete Schedule Rotation
Delete schedule rotation with given identifier
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of schedule which could be id or name
- id (String.t): Identifier of schedule rotation
- opts (KeywordList): [optional] Optional parameters
- :schedule_identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec delete_schedule_rotation(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def delete_schedule_rotation(connection, identifier, id, opts \\ []) do
optional_params = %{
:"scheduleIdentifierType" => :query
}
%{}
|> method(:delete)
|> url("/v2/schedules/#{identifier}/rotations/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Get Schedule Rotation
Returns schedule rotation with given id
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of schedule which could be id or name
- id (String.t): Identifier of schedule rotation
- opts (KeywordList): [optional] Optional parameters
- :schedule_identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'
## Returns
{:ok, %OpsGenieRESTAPI.Model.GetScheduleRotationResponse{}} on success
{:error, info} on failure
"""
@spec get_schedule_rotation(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.GetScheduleRotationResponse.t} | {:error, Tesla.Env.t}
def get_schedule_rotation(connection, identifier, id, opts \\ []) do
optional_params = %{
:"scheduleIdentifierType" => :query
}
%{}
|> method(:get)
|> url("/v2/schedules/#{identifier}/rotations/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.GetScheduleRotationResponse{})
end
@doc """
List Schedule Rotations
Returns list of schedule rotations
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of schedule which could be id or name
- opts (KeywordList): [optional] Optional parameters
- :schedule_identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'
## Returns
{:ok, %OpsGenieRESTAPI.Model.ListScheduleRotationsResponse{}} on success
{:error, info} on failure
"""
@spec list_schedule_rotations(Tesla.Env.client, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.ListScheduleRotationsResponse.t} | {:error, Tesla.Env.t}
def list_schedule_rotations(connection, identifier, opts \\ []) do
optional_params = %{
:"scheduleIdentifierType" => :query
}
%{}
|> method(:get)
|> url("/v2/schedules/#{identifier}/rotations")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.ListScheduleRotationsResponse{})
end
@doc """
Update Schedule Rotation (Partial)
Update schedule rotation with given id
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of schedule which could be id or name
- id (String.t): Identifier of schedule rotation
- body (UpdateScheduleRotationPayload): Request payload of update schedule rotation action
- opts (KeywordList): [optional] Optional parameters
- :schedule_identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name'
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec update_schedule_rotation(Tesla.Env.client, String.t, String.t, OpsGenieRESTAPI.Model.UpdateScheduleRotationPayload.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def update_schedule_rotation(connection, identifier, id, body, opts \\ []) do
optional_params = %{
:"scheduleIdentifierType" => :query
}
%{}
|> method(:patch)
|> url("/v2/schedules/#{identifier}/rotations/#{id}")
|> add_param(:body, :"body", body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
end