Guardsix.Data.HttpNotification (guardsix v1.2.2)

Copy Markdown View Source

Builder for HTTP notification structs.

Wraps the HTTP Notification for Alert Rules API. Start with Guardsix.http_notification/3 and pipe through the builder functions to configure the request and auth. Supports no_auth/1, api_token_auth/3, basic_auth/3, and bearer_auth/2.

Summary

Types

t()

@type t() :: %Guardsix.Data.HttpNotification{
  auth: map(),
  dispatch_option: String.t() | nil,
  http_body: String.t() | nil,
  http_format_query: String.t() | nil,
  http_protocol: String.t() | nil,
  http_querystring: String.t() | nil,
  http_request_type: String.t(),
  http_url: String.t(),
  ids: [String.t()],
  notify_http: boolean() | nil,
  threshold_option: String.t() | nil,
  threshold_value: number() | nil
}

Functions

api_token_auth(notif, key, value)

basic_auth(notif, username, password)

bearer_auth(notif, token)

body(notif, body)

dispatch_option(notif, option)

format_query(notif, format)

new(ids, url, atom)

no_auth(notif)

notify_http(notif, enabled)

protocol(notif, protocol)

querystring(notif, qs)

threshold(notif, option, value)

to_map(notif)

This function is deprecated. Use to_payload/1 instead.

Convert an HttpNotification struct into the flat map format expected by the Guardsix API.

to_payload(notif)

validate(notif)

@spec validate(t()) :: :ok | {:error, [String.t()]}