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
@type protection() :: AshOnetime.Resource.Protection.t()
Functions
@spec protected?(Ash.Resource.t(), atom()) :: boolean()
Returns true if action_name on resource is protected by an onetime declaration.
@spec protection(Ash.Resource.t(), atom()) :: protection() | nil
Returns the protection for action_name on resource, or nil if the action is unprotected.
@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.
@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.