ExScim.Lifecycle (ex_scim v0.2.2)

Copy Markdown View Source

Facade for lifecycle hooks around SCIM operations.

Delegates to the configured lifecycle_adapter. When no adapter is configured, all hooks are transparent no-ops.

Error handling

  • Before hooks fail closed: crashes are rescued and return {:error, :lifecycle_hook_error}, rejecting the operation.
  • After hooks fail open: crashes are rescued and logged, the already-completed operation is returned as successful.
  • on_error crashes are silently rescued and logged.

Summary

Functions

Returns the configured lifecycle adapter module, or nil if none is configured.

Fires after a resource is successfully created. Observe-only; crashes are logged and swallowed.

Fires after a resource is successfully deleted. Observe-only.

Fires after a resource is successfully retrieved. Observe-only.

Fires after a resource is successfully patched. Observe-only.

Fires after a resource is successfully replaced. Observe-only.

Fires before a resource is created. Returns {:ok, data} to proceed or {:error, reason} to halt.

Fires before a resource is deleted. Returns :ok to proceed or {:error, reason} to halt.

Fires before a resource is retrieved. Returns :ok to proceed or {:error, reason} to halt.

Fires before a resource is patched. Returns {:ok, data} to proceed or {:error, reason} to halt.

Fires before a resource is replaced (PUT). Returns {:ok, data} to proceed or {:error, reason} to halt.

Fires when an operation fails. Observe-only; intended for logging or metrics.

Functions

adapter()

Returns the configured lifecycle adapter module, or nil if none is configured.

after_create(resource_type, scim_response, caller)

Fires after a resource is successfully created. Observe-only; crashes are logged and swallowed.

after_delete(resource_type, resource_id, caller)

Fires after a resource is successfully deleted. Observe-only.

after_get(resource_type, scim_response, caller)

Fires after a resource is successfully retrieved. Observe-only.

after_patch(resource_type, scim_response, caller)

Fires after a resource is successfully patched. Observe-only.

after_replace(resource_type, scim_response, caller)

Fires after a resource is successfully replaced. Observe-only.

before_create(resource_type, resource_data, caller)

Fires before a resource is created. Returns {:ok, data} to proceed or {:error, reason} to halt.

before_delete(resource_type, resource_id, caller)

Fires before a resource is deleted. Returns :ok to proceed or {:error, reason} to halt.

before_get(resource_type, resource_id, caller)

Fires before a resource is retrieved. Returns :ok to proceed or {:error, reason} to halt.

before_patch(resource_type, resource_id, resource_data, caller)

Fires before a resource is patched. Returns {:ok, data} to proceed or {:error, reason} to halt.

before_replace(resource_type, resource_id, resource_data, caller)

Fires before a resource is replaced (PUT). Returns {:ok, data} to proceed or {:error, reason} to halt.

on_error(operation, resource_type, error, caller)

Fires when an operation fails. Observe-only; intended for logging or metrics.