Search documentation of ash

# View Source Ash.Domain.Info (ash v3.4.30)

Introspection tools for Ash.Domain

# Summary

## Functions

allow(domain)

The allow MFA for a domain

allow_unregistered?(domain)

Whether or not the domain allows unregistered resources to be used with it

authorize(domain)

When authorization should happen for a given domain

depend_on_resources(domain) deprecated

Gets the resources of a domain module. Can be used at compile time.

description(domain)

The description of the domain

find_manage_relationships_with_identity_not_configured(otp_app)
related_domain(subject, relationship, default \\ nil)

Determine what domain to use when interacting with a related resource.

require_actor?(domain)

Whether or not the actor is always required for a domain

resource(domain, resource)

Returns `{:ok, resource}` if the resource can be used by the domain, or `{:error, error}`.

resource_references(domain)

Gets the resource references of a domain module. DO NOT USE AT COMPILE TIME.

resources(domain)

Gets the resources of a domain module.

short_name(domain)

The short name for a domain

span_name(domain, resource, action)

The span_name for a domain and resource combination

telemetry_event_name(domain, name)

Names a telemetry event for a given domain/resource combo

timeout(domain)

The execution timeout for a domain

trace_name(domain)

The trace name for a domain

# Functions

Link to this function

# allow(domain)

View Source

    @spec allow(Ash.Domain.t() | Spark.Dsl.t()) :: mfa() | nil

The allow MFA for a domain

Link to this function

# allow_unregistered?(domain)

View Source

    @spec allow_unregistered?(Ash.Domain.t() | Spark.Dsl.t()) :: atom() | nil

Whether or not the domain allows unregistered resources to be used with it

Link to this function

# authorize(domain)

View Source

    @spec authorize(Ash.Domain.t()) :: :always | :by_default | :when_requested

When authorization should happen for a given domain

Link to this macro

# depend_on_resources(domain)

View Source (macro)
This macro is deprecated. Use `Ash.Domain.Info.resources/1` instead. This macro is no longer necessary.

    @spec depend_on_resources(Macro.t()) :: Macro.t()

Gets the resources of a domain module. Can be used at compile time.

Liberal use of this can greatly increase compile times, or even cause compiler deadlocks. Use with care.

Link to this function

# description(domain)

View Source

    @spec description(Spark.Dsl.t() | Ash.Domain.t()) :: String.t() | nil

The description of the domain

Link to this function

# find_manage_relationships_with_identity_not_configured(otp_app)

View Source
Link to this function

# related_domain(subject, relationship, default \\ nil)

View Source

    @spec related_domain(
      Ash.Resource.t() | Ash.Query.t() | Ash.Changeset.t() | Ash.ActionInput.t(),
      atom()
      | Ash.Resource.Relationships.relationship()
      | [atom() | Ash.Resource.Relationships.relationship()],
      Ash.Domain.t() | nil
    ) :: Ash.Domain.t()

Determine what domain to use when interacting with a related resource.

We choose the first domain found in the following order:

- `relationship.domain`, i.e an explicitly configured domain for a relationship
- `resource.domain`, i.e. the domain the resource declares
- `subject.domain`, i.e. the domain of the query, changeset or action input (if it has one)
- `default`, the default domain provided as the third argument

Link to this function

# require_actor?(domain)

View Source

    @spec require_actor?(Ash.Domain.t()) :: boolean()

Whether or not the actor is always required for a domain

Link to this function

# resource(domain, resource)

View Source

    @spec resource(Ash.Domain.t() | Spark.Dsl.t(), Ash.Resource.t()) ::
      {:ok, Ash.Resource.t()} | {:error, Ash.Error.t()}

Returns `{:ok, resource}` if the resource can be used by the domain, or `{:error, error}`.

Link to this function

# resource_references(domain)

View Source

    @spec resource_references(Spark.Dsl.t() | Ash.Domain.t()) :: [
      Ash.Domain.Dsl.ResourceReference.t()
    ]

Gets the resource references of a domain module. DO NOT USE AT COMPILE TIME.

If you need the resource list at compile time, use `depend_on_resources/1`

Link to this function

# resources(domain)

View Source

    @spec resources(Spark.Dsl.t() | Ash.Domain.t()) :: [Ash.Resource.t()]

Gets the resources of a domain module.

Link to this function

# short_name(domain)

View Source

    @spec short_name(Ash.Domain.t()) :: atom()

The short name for a domain

Link to this function

# span_name(domain, resource, action)

View Source

    @spec span_name(Ash.Domain.t(), Ash.Resource.t(), action :: atom() | binary()) ::
      String.t()

The span_name for a domain and resource combination

Link to this function

# telemetry_event_name(domain, name)

View Source

    @spec telemetry_event_name(Ash.Domain.t(), atom() | [atom()]) :: [atom()]

Names a telemetry event for a given domain/resource combo

Link to this function

# timeout(domain)

View Source

    @spec timeout(Ash.Domain.t()) :: nil | :infinity | integer()

The execution timeout for a domain

Link to this function

# trace_name(domain)

View Source

    @spec trace_name(Ash.Domain.t()) :: String.t()

The trace name for a domain