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/notification_rule_step.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.NotificationRuleStep do
@moduledoc """
API calls for all endpoints tagged `NotificationRuleStep`.
"""
alias OpsGenieRESTAPI.Connection
import OpsGenieRESTAPI.RequestBuilder
@doc """
Create Notification Rule Step
Creates a new notification rule step
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- body (CreateNotificationRuleStepPayload): Request payload to create notification rule step
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec create_notification_rule_step(Tesla.Env.client, String.t, String.t, OpsGenieRESTAPI.Model.CreateNotificationRuleStepPayload.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def create_notification_rule_step(connection, identifier, rule_id, body, _opts \\ []) do
%{}
|> method(:post)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps")
|> add_param(:body, :"body", body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Delete Notification Rule Step
Deletes a notification rule step using user identifier, rule id, notification rule step id
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- id (String.t): Id of the rule step will be changed.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec delete_notification_rule_step(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def delete_notification_rule_step(connection, identifier, rule_id, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Disable Notification Rule Step
Disables a new notification rule step
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- id (String.t): Id of the rule step will be changed.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec disable_notification_rule_step(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def disable_notification_rule_step(connection, identifier, rule_id, id, _opts \\ []) do
%{}
|> method(:post)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps/#{id}/disable")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Enable Notification Rule Step
Enables a new notification rule step
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- id (String.t): Id of the rule step will be changed.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec enable_notification_rule_step(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def enable_notification_rule_step(connection, identifier, rule_id, id, _opts \\ []) do
%{}
|> method(:post)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps/#{id}/enable")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
@doc """
Get Notification Rule Step
Returns notification rule step with given user identifier and rule id
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- id (String.t): Id of the rule step will be changed.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.GetNotificationRuleStepResponse{}} on success
{:error, info} on failure
"""
@spec get_notification_rule_step(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.GetNotificationRuleStepResponse.t} | {:error, Tesla.Env.t}
def get_notification_rule_step(connection, identifier, rule_id, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.GetNotificationRuleStepResponse{})
end
@doc """
List Notification Rule Steps
Returns list of notification rule steps
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %OpsGenieRESTAPI.Model.ListNotificationRuleStepsResponse{}} on success
{:error, info} on failure
"""
@spec list_notification_rule_steps(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.ListNotificationRuleStepsResponse.t} | {:error, Tesla.Env.t}
def list_notification_rule_steps(connection, identifier, rule_id, _opts \\ []) do
%{}
|> method(:get)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.ListNotificationRuleStepsResponse{})
end
@doc """
Update Notification Rule Step (Partial)
Update a notification rule step with given user identifier, rule id, and notification rule step id
## Parameters
- connection (OpsGenieRESTAPI.Connection): Connection to server
- identifier (String.t): Identifier of the user to be searched
- rule_id (String.t): Id of the notification rule that step will belong to.
- id (String.t): Id of the rule step will be changed.
- opts (KeywordList): [optional] Optional parameters
- :body (UpdateNotificationRuleStepPayload): Request payload of update schedule action
## Returns
{:ok, %OpsGenieRESTAPI.Model.SuccessResponse{}} on success
{:error, info} on failure
"""
@spec update_notification_rule_step(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, OpsGenieRESTAPI.Model.SuccessResponse.t} | {:error, Tesla.Env.t}
def update_notification_rule_step(connection, identifier, rule_id, id, opts \\ []) do
optional_params = %{
:"body" => :body
}
%{}
|> method(:patch)
|> url("/v2/users/#{identifier}/notification-rules/#{rule_id}/steps/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%OpsGenieRESTAPI.Model.SuccessResponse{})
end
end