# `LogpointApi.Core.AlertRule`
[🔗](https://github.com/MikaelFangel/logpoint_api/blob/v2.2.0/lib/logpoint_api/core/alert_rule.ex#L1)

Manage alert rules and their notifications in Logpoint.

Wraps the [Alert Rules API](https://docs.logpoint.com/siem/product-docs/readme/siem_api_reference/alert_rules_api).
Use the `Rule`, `EmailNotification`, and `HttpNotification` builders to compose
structs for creation endpoints.

# `activate`

```elixir
@spec activate(LogpointApi.Data.Client.t(), [String.t()]) ::
  {:ok, map()} | {:error, term()}
```

Activate alert rules by IDs.

# `create`

```elixir
@spec create(LogpointApi.Data.Client.t(), LogpointApi.Data.Rule.t() | map()) ::
  {:ok, map()} | {:error, term()}
```

Create an alert rule.

# `create_email_notification`

```elixir
@spec create_email_notification(
  LogpointApi.Data.Client.t(),
  LogpointApi.Data.EmailNotification.t()
) ::
  {:ok, map()} | {:error, term()}
```

Create an email notification for alert rules.

# `create_email_notification`

```elixir
@spec create_email_notification(LogpointApi.Data.Client.t(), [String.t()], map()) ::
  {:ok, map()} | {:error, term()}
```

# `create_http_notification`

```elixir
@spec create_http_notification(
  LogpointApi.Data.Client.t(),
  LogpointApi.Data.HttpNotification.t()
) ::
  {:ok, map()} | {:error, term()}
```

Create an HTTP notification for alert rules.

# `create_http_notification`

```elixir
@spec create_http_notification(LogpointApi.Data.Client.t(), [String.t()], map()) ::
  {:ok, map()} | {:error, term()}
```

# `deactivate`

```elixir
@spec deactivate(LogpointApi.Data.Client.t(), [String.t()]) ::
  {:ok, map()} | {:error, term()}
```

Deactivate alert rules by IDs.

# `delete`

```elixir
@spec delete(LogpointApi.Data.Client.t(), [String.t()]) ::
  {:ok, map()} | {:error, term()}
```

Delete alert rules by IDs.

# `get`

```elixir
@spec get(LogpointApi.Data.Client.t(), String.t()) :: {:ok, map()} | {:error, term()}
```

Get an alert rule by ID.

# `get_notification`

```elixir
@spec get_notification(LogpointApi.Data.Client.t(), String.t(), :email | :http) ::
  {:ok, map()} | {:error, term()}
```

Get alert notification by alert ID and type.

# `list`

```elixir
@spec list(LogpointApi.Data.Client.t(), map()) :: {:ok, map()} | {:error, term()}
```

List alert rules.

Supported keys in `params`:

  * `:limit` - maximum number of rules to return
  * `:page` - page number for pagination
  * `:return_all_data` - when `true`, returns all rule data

## Examples

    AlertRule.list(client)
    AlertRule.list(client, %{limit: 10, page: 1})

# `update`

```elixir
@spec update(
  LogpointApi.Data.Client.t(),
  String.t(),
  LogpointApi.Data.Rule.t() | map()
) ::
  {:ok, map()} | {:error, term()}
```

Update an alert rule.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
