WorkOS.AuditLogs (WorkOS SDK for Elixir v3.0.1)

Copy Markdown View Source

Operations for the AuditLogs API.

Summary

Functions

create_event(client, params \\ %{}, opts \\ [])

@spec create_event(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.AuditLogEventCreateResponse.t()} | {:error, WorkOS.Error.error()}

Create Event

Create an Audit Log Event.

This API supports idempotency which guarantees that performing the same operation multiple times will have the same result as if the operation were performed only once. This is handy in situations where you may need to retry a request due to a failure or prevent accidental duplicate requests from creating more than one resource.

To achieve idempotency, you can add Idempotency-Key request header to a Create Event request with a unique string as the value. Each subsequent request matching this unique string will return the same response. We suggest using v4 UUIDs for idempotency keys to avoid collisions.

Idempotency keys expire after 24 hours. The API will generate a new response if you submit a request with an expired key.

Parameters

create_export(client, params \\ %{}, opts \\ [])

@spec create_export(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.AuditLogExport.t()} | {:error, WorkOS.Error.error()}

Create Export

Create an Audit Log Export. Exports are scoped to a single organization within a specified date range.

Parameters

create_schema(client, action_name, params \\ %{}, opts \\ [])

@spec create_schema(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.AuditLogSchema.t()} | {:error, WorkOS.Error.error()}

Create Schema

Creates a new Audit Log schema used to validate the payload of incoming Audit Log Events. If the action does not exist, it will also be created.

Parameters

  • action_name — The name of the Audit Log action.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)

get_export(client, audit_log_export_id, opts \\ [])

@spec get_export(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, WorkOS.AuditLogExport.t()} | {:error, WorkOS.Error.error()}

Get Export

Get an Audit Log Export. The URL will expire after 10 minutes. If the export is needed again at a later time, refetching the export will regenerate the URL.

Parameters

  • audit_log_export_id — The unique ID of the Audit Log Export.
  • opts — per-request options (see WorkOS.Client.request/5)

get_organization_audit_logs_retention(client, id, opts \\ [])

@spec get_organization_audit_logs_retention(WorkOS.Client.t(), String.t(), keyword()) ::
  {:ok, WorkOS.AuditLogsRetention.t()} | {:error, WorkOS.Error.error()}

Get Retention

Get the configured event retention period for the given Organization.

Parameters

list_action_schemas(client, action_name, params \\ %{}, opts \\ [])

@spec list_action_schemas(WorkOS.Client.t(), String.t(), map(), keyword()) ::
  {:ok, WorkOS.Page.t(WorkOS.AuditLogSchema.t())}
  | {:error, WorkOS.Error.error()}

List Schemas

Get a list of all schemas for the Audit Logs action identified by :name.

Parameters

  • action_name — The name of the Audit Log action.
  • params — query parameters: :before, :after_, :limit, :order
  • opts — per-request options (see WorkOS.Client.request/5)

list_actions(client, params \\ %{}, opts \\ [])

@spec list_actions(WorkOS.Client.t(), map(), keyword()) ::
  {:ok, WorkOS.Page.t(WorkOS.AuditLogAction.t())}
  | {:error, WorkOS.Error.error()}

List Actions

Get a list of all Audit Log actions in the current environment.

Parameters

  • params — query parameters: :before, :after_, :limit, :order
  • opts — per-request options (see WorkOS.Client.request/5)

update_organization_audit_logs_retention(client, id, params \\ %{}, opts \\ [])

@spec update_organization_audit_logs_retention(
  WorkOS.Client.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, WorkOS.AuditLogsRetention.t()} | {:error, WorkOS.Error.error()}

Set Retention

Set the event retention period for the given Organization.

Parameters

  • id — Unique identifier of the Organization.
  • params — request body map
  • opts — per-request options (see WorkOS.Client.request/5)