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/forwarding_rule.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.ForwardingRule do
@moduledoc """
API calls for all endpoints tagged `ForwardingRule`.
"""
alias OpsGenieRESTAPI.Connection
import OpsGenieRESTAPI.RequestBuilder
@doc """
Create Forwarding Rule
Creates a new forwarding rule
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- body (CreateForwardingRulePayload): Request payload to created forwarding rule
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.CreateForwardingRuleResponse{}} on success
{:error, info} on failure
"""
@spec create_forwarding_rule(Tesla.Env.client, OpsGenieRESTAPI.Model.CreateForwardingRulePayload.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.CreateForwardingRuleResponse.t} | {:error, Tesla.Env.t}
def create_forwarding_rule(connection, body, _opts \\ []) do
%{}
|> method(:post)
|> url("/v2/forwarding-rules")
|> add_param(:body, :"body", body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.CreateForwardingRuleResponse{})
end
@doc """
Delete Forwarding Rule
Deletes forwarding rule with given identifier
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the forwarding rule which could be forwarding rule 'id' or 'alias'
- opts (KeywordList): [optional] Optional parameters
- :identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'alias'
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec delete_forwarding_rule(Tesla.Env.client, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def delete_forwarding_rule(connection, identifier, opts \\ []) do
optional_params = %{
:"identifierType" => :query
}
%{}
|> method(:delete)
|> url("/v2/forwarding-rules/#{identifier}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Get Forwarding Rule
Returns forwarding rule with given id or alias
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the forwarding rule which could be forwarding rule 'id' or 'alias'
- opts (KeywordList): [optional] Optional parameters
- :identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'alias'
## Returns
{:ok, %OpsGenieRESTAPI.Model.GetForwardingRuleResponse{}} on success
{:error, info} on failure
"""
@spec get_forwarding_rule(Tesla.Env.client, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.GetForwardingRuleResponse.t} | {:error, Tesla.Env.t}
def get_forwarding_rule(connection, identifier, opts \\ []) do
optional_params = %{
:"identifierType" => :query
}
%{}
|> method(:get)
|> url("/v2/forwarding-rules/#{identifier}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.GetForwardingRuleResponse{})
end
@doc """
List Forwarding Rules
Returns list of forwarding rules
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.ListForwardingRulesResponse{}} on success
{:error, info} on failure
"""
@spec list_forwarding_rules(Tesla.Env.client, keyword()) :: {:ok, OpsGenieRESTAPI.Model.ListForwardingRulesResponse.t} | {:error, Tesla.Env.t}
def list_forwarding_rules(connection, _opts \\ []) do
%{}
|> method(:get)
|> url("/v2/forwarding-rules")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.ListForwardingRulesResponse{})
end
@doc """
Update Forwarding Rule
Update forwarding rule with given rule id or alias
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the forwarding rule which could be forwarding rule 'id' or 'alias'
- body (UpdateForwardingRulePayload): Request payload of update forwarding rule action
- opts (KeywordList): [optional] Optional parameters
- :identifier_type (String.t): Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'alias'
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec update_forwarding_rule(Tesla.Env.client, String.t, OpsGenieRESTAPI.Model.UpdateForwardingRulePayload.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def update_forwarding_rule(connection, identifier, body, opts \\ []) do
optional_params = %{
:"identifierType" => :query
}
%{}
|> method(:put)
|> url("/v2/forwarding-rules/#{identifier}")
|> add_param(:body, :"body", body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
end