ExStorageService.IAM.Audit (ex_storage_service v0.6.2)

Copy Markdown View Source

IAM Audit logging backed by Concord key-value store.

Audit events are stored with the key pattern: "audit:{timestamp}:{event_id}"

Summary

Functions

Lists audit events with optional filtering.

Types

action()

@type action() ::
  :create_user
  | :suspend_user
  | :activate_user
  | :delete_user
  | :create_key
  | :delete_key
  | :create_policy
  | :delete_policy
  | :attach_policy
  | :detach_policy

event()

@type event() :: %{
  id: String.t(),
  actor: String.t(),
  action: action(),
  target: String.t(),
  details: map(),
  timestamp: String.t()
}

Functions

list_events(opts \\ [])

@spec list_events(keyword()) :: {:ok, [event()]} | {:error, term()}

Lists audit events with optional filtering.

Options:

  • :actor - filter by actor
  • :action - filter by action
  • :target - filter by target
  • :limit - max number of events to return (default 100)

log_event(actor, action, target, details \\ %{})

@spec log_event(String.t(), action(), String.t(), map()) ::
  {:ok, event()} | {:error, term()}

Logs an audit event.