AshOnetime.Resource.Info (ash_onetime v0.2.0)

Copy Markdown View Source

Read-only introspection for the normalized per-action protections a resource declares under onetime.

Each protected action is normalized at compile time into an AshOnetime.Resource.Protection struct carrying its strategy, scope, key, response contract, and lifecycle configuration. The functions here read that normalized index back without re-running the DSL.

Summary

Functions

Returns true if action_name on resource is protected by an onetime declaration.

Returns the protection for action_name on resource, or nil if the action is unprotected.

Returns all protections declared on resource, in declaration order.

Returns the keyed-effect strategy for action_name (:idempotency or :one_time_nonce), or nil if the action is unprotected.

Types

protection()

@type protection() :: AshOnetime.Resource.Protection.t()

Functions

protected?(resource, action_name)

@spec protected?(Ash.Resource.t(), atom()) :: boolean()

Returns true if action_name on resource is protected by an onetime declaration.

protection(resource, action_name)

@spec protection(Ash.Resource.t(), atom()) :: protection() | nil

Returns the protection for action_name on resource, or nil if the action is unprotected.

protections(resource)

@spec protections(Ash.Resource.t()) :: [protection()]

Returns all protections declared on resource, in declaration order.

Returns an empty list when the resource declares no onetime protections.

strategy(resource, action_name)

@spec strategy(Ash.Resource.t(), atom()) :: :idempotency | :one_time_nonce | nil

Returns the keyed-effect strategy for action_name (:idempotency or :one_time_nonce), or nil if the action is unprotected.