# `Ash.Resource.Info`
[🔗](https://github.com/ash-project/ash/blob/v3.23.1/lib/ash/resource/info.ex#L5)

Introspection for resources

# `action`

```elixir
@spec action(
  Spark.Dsl.t() | Ash.Resource.t(),
  atom(),
  Ash.Resource.Actions.action_type() | nil
) ::
  Ash.Resource.Actions.action() | nil
```

Returns the action with the matching name and type on the resource

# `action_input?`

```elixir
@spec action_input?(Ash.Resource.t(), action :: atom(), input :: atom() | String.t()) ::
  boolean()
```

Returns true or false if the input is accepted by the action, as an argument or an attribute

# `action_inputs`

```elixir
@spec action_inputs(Ash.Resource.t(), action :: atom()) :: MapSet.t()
```

Returns the list of possible accepted keys by an action

# `action_select`

```elixir
@spec action_select(
  Ash.Resource.t(),
  action :: atom() | Ash.Resource.Actions.action()
) ::
  [atom()] | nil
```

Returns the list of attributes that must be selected for an action invocation

# `actions`

```elixir
@spec actions(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Actions.action()]
```

Returns all actions of a resource

# `aggregate`

```elixir
@spec aggregate(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Aggregate.t() | nil
```

Get an aggregate by name

# `aggregate_type`

```elixir
@spec aggregate_type(
  Spark.Dsl.t() | Ash.Resource.t(),
  Ash.Resource.Aggregate.t() | atom()
) ::
  {:ok, Ash.Type.t()} | {:error, String.t()}
```

Gets the type of an aggregate for a given resource.

# `aggregates`

```elixir
@spec aggregates(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Aggregate.t()]
```

Returns all aggregates of a resource

# `always_selected_attribute_names`

```elixir
@spec always_selected_attribute_names(Spark.Dsl.t() | Ash.Resource.t()) :: MapSet.t()
```

# `atomic_validation_default_target_attribute`

```elixir
@spec atomic_validation_default_target_attribute(Spark.Dsl.t() | Ash.Resource.t()) ::
  atom() | nil
```

The configured default target attribute for atomic validations.

# `attribute`

```elixir
@spec attribute(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom()) ::
  Ash.Resource.Attribute.t() | nil
```

Get an attribute name from the resource

# `attribute_names`

```elixir
@spec attribute_names(Spark.Dsl.t() | Ash.Resource.t()) :: MapSet.t()
```

# `attributes`

```elixir
@spec attributes(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Attribute.t()]
```

Returns all attributes of a resource

# `attributes_to_require`

# `attributes_to_require`

# `authorizers`

```elixir
@spec authorizers(Spark.Dsl.t() | Ash.Resource.t()) :: [module()]
```

A list of authorizers to be used when accessing

# `base_filter`

```elixir
@spec base_filter(Spark.Dsl.t() | Ash.Resource.t()) :: term()
```

The base filter of the resource

# `calculation`

```elixir
@spec calculation(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Calculation.t() | nil
```

Get a calculation by name

# `calculation_interface`

```elixir
@spec calculation_interface(Spark.Dsl.t() | Ash.Resource.t(), atom()) ::
  Ash.Resource.CalculationInterface.t() | nil
```

Get an calculation interface by name from the resource

# `calculation_interfaces`

```elixir
@spec calculation_interfaces(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.CalculationInterface.t()
]
```

The list of code interface calculation definitions.

# `calculations`

```elixir
@spec calculations(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Calculation.t()]
```

Returns all calculations of a resource

# `changes`

```elixir
@spec changes(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Validation.t() | Ash.Resource.Change.t()
]
```

A list of all changes for the resource

# `changes`

```elixir
@spec changes(Spark.Dsl.t() | Ash.Resource.t(), :create | :update | :destroy) :: [
  Ash.Resource.Validation.t() | Ash.Resource.Change.t()
]
```

A list of all changes for the resource for a given action type

# `code_interface_domain`

```elixir
@spec code_interface_domain(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil
```

The domain to define the interface for, when defining it in the resource

# `data_layer`

```elixir
@spec data_layer(Ash.Resource.t()) :: Ash.DataLayer.t() | nil
```

The data layer of the resource, or nil if it does not have one

# `default_actions`

```elixir
@spec default_actions(Spark.Dsl.t() | Ash.Resource.t()) :: [
  :create | :read | :update | :destroy
]
```

Returns the configured default actions

# `default_context`

```elixir
@spec default_context(Spark.Dsl.t() | Ash.Resource.t()) :: term()
```

The default context of the resource

# `define_interface?`

```elixir
@spec define_interface?(Spark.Dsl.t() | Ash.Resource.t()) :: boolean()
```

Whether or not to define the interface on the resource

# `description`

```elixir
@spec description(Spark.Dsl.t() | Ash.Resource.t()) :: String.t() | nil
```

The description of the resource

# `domain`

Returns the statically configured domain for the resource.

# `embedded?`

```elixir
@spec embedded?(Spark.Dsl.t() | Ash.Resource.t()) :: boolean()
```

Whether or not the resource is an embedded resource

# `extensions`

```elixir
@spec extensions(resource :: Ash.Resource.t()) :: [module()]
```

Returns a list of extensions in use by the resource.

# `field`

```elixir
@spec field(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom()) ::
  Ash.Resource.Attribute.t()
  | Ash.Resource.Aggregate.t()
  | Ash.Resource.Calculation.t()
  | Ash.Resource.Relationships.relationship()
  | nil
```

Get a field from a resource by name

# `fields`

```elixir
@spec fields(
  Spark.Dsl.t() | Ash.Resource.t(),
  types :: [:attributes | :aggregates | :calculations | :relationships]
) :: [
  Ash.Resource.Attribute.t()
  | Ash.Resource.Aggregate.t()
  | Ash.Resource.Calculation.t()
  | Ash.Resource.Relationships.relationship()
]
```

Returns all attributes, aggregates, calculations and relationships of a resource

# `hide_inspect_fields`

```elixir
@spec hide_inspect_fields(Spark.Dsl.t() | Ash.Resource.t()) :: [atom()]
```

A deny-list of fields to hide from the inspect output.
Takes precedence over `show_inspect_fields`.

# `identities`

```elixir
@spec identities(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Identity.t()]
```

A list of identities for the resource

# `identity`

```elixir
@spec identity(Spark.Dsl.t() | Ash.Resource.t(), atom()) ::
  Ash.Resource.Identity.t() | nil
```

Get an identity by name from the resource

# `inspect_private_fields?`

```elixir
@spec inspect_private_fields?(Spark.Dsl.t() | Ash.Resource.t()) :: boolean()
```

Whether to include private fields in the inspect output.
`show_inspect_fields` takes precedence over this option.

# `interface`

```elixir
@spec interface(Spark.Dsl.t() | Ash.Resource.t(), atom()) ::
  Ash.Resource.Interface.t() | nil
```

Get an interface by name from the resource

# `interfaces`

```elixir
@spec interfaces(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Interface.t()]
```

The list of code interface definitions.

# `lazy_matching_default_attributes`

```elixir
@spec lazy_matching_default_attributes(
  Spark.Dsl.t() | Ash.Resource.t(),
  type :: :create | :update
) :: [Ash.Resource.Attribute.t()]
```

Returns all attributes of a resource with lazy matching defaults

# `lazy_non_matching_default_attributes`

```elixir
@spec lazy_non_matching_default_attributes(
  Spark.Dsl.t() | Ash.Resource.t(),
  type :: :create | :update
) :: [Ash.Resource.Attribute.t()]
```

Returns all attributes of a resource with lazy non-matching-defaults

# `multitenancy_attribute`

```elixir
@spec multitenancy_attribute(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil
```

The multitenancy attribute for a resource

# `multitenancy_global?`

```elixir
@spec multitenancy_global?(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil
```

The MFA to parse the tenant from the attribute

# `multitenancy_parse_attribute`

```elixir
@spec multitenancy_parse_attribute(Spark.Dsl.t() | Ash.Resource.t()) ::
  {atom(), atom(), [any()]}
```

The function to parse the tenant from the attribute

# `multitenancy_strategy`

```elixir
@spec multitenancy_strategy(Spark.Dsl.t() | Ash.Resource.t()) ::
  :context | :attribute | nil
```

The multitenancy strategy for a resource

# `multitenancy_template`

```elixir
@spec multitenancy_template(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil
```

The template for creating the tenant name

# `multitenancy_tenant_from_attribute`

```elixir
@spec multitenancy_tenant_from_attribute(Spark.Dsl.t() | Ash.Resource.t()) ::
  {atom(), atom(), [any()]}
```

The function to get the tenant from the attribute value

# `notifiers`

```elixir
@spec notifiers(Spark.Dsl.t() | Ash.Resource.t()) :: [module()]
```

A list of notifiers to be used when accessing

# `pipeline`

```elixir
@spec pipeline(Spark.Dsl.t() | Ash.Resource.t(), atom()) ::
  Ash.Resource.Pipeline.t() | nil
```

Get a pipeline by name

# `pipelines`

```elixir
@spec pipelines(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Pipeline.t()]
```

Returns all pipelines of a resource

# `plural_name`

The plural_name of the resource

# `preparations`

```elixir
@spec preparations(Spark.Dsl.t() | Ash.Resource.t(), action_type :: :read | :action) ::
  [
    Ash.Resource.Preparation.t()
  ]
```

# `primary_action`

```elixir
@spec primary_action(
  Spark.Dsl.t() | Ash.Resource.t(),
  Ash.Resource.Actions.action_type()
) ::
  Ash.Resource.Actions.action() | nil
```

Returns the primary action of a given type

# `primary_action!`

```elixir
@spec primary_action!(
  Spark.Dsl.t() | Ash.Resource.t(),
  Ash.Resource.Actions.action_type()
) ::
  Ash.Resource.Actions.action() | no_return()
```

Returns the primary action of the given type

# `primary_key`

```elixir
@spec primary_key(Spark.Dsl.t() | Ash.Resource.t()) :: [atom()]
```

A list of field names corresponding to the primary key

# `primary_key_simple_equality?`

```elixir
@spec primary_key_simple_equality?(Spark.Dsl.t() | Ash.Resource.t()) :: boolean()
```

Whether or not all primary key attributes can be compared with simple_equality

# `public_actions`

```elixir
@spec public_actions(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Actions.action()
]
```

Returns all public actions of a resource (actions with `public?: true`). Use for building public APIs; do not expose actions with `public?: false`.

# `public_aggregate`

```elixir
@spec public_aggregate(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Aggregate.t() | nil
```

Get an aggregate by name

# `public_aggregates`

```elixir
@spec public_aggregates(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Aggregate.t()
]
```

Returns all public aggregates of a resource

# `public_attribute`

```elixir
@spec public_attribute(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom()) ::
  Ash.Resource.Attribute.t() | nil
```

Get a public attribute name from the resource

# `public_attributes`

```elixir
@spec public_attributes(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Attribute.t()
]
```

Returns all public attributes of a resource

# `public_calculation`

```elixir
@spec public_calculation(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Calculation.t() | nil
```

Get a public calculation by name

# `public_calculations`

```elixir
@spec public_calculations(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Calculation.t()
]
```

Returns all public calculations of a resource

# `public_field`

```elixir
@spec public_field(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom()) ::
  Ash.Resource.Attribute.t()
  | Ash.Resource.Aggregate.t()
  | Ash.Resource.Calculation.t()
  | Ash.Resource.Relationships.relationship()
  | nil
```

Get a public field from a resource by name

# `public_fields`

```elixir
@spec public_fields(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Attribute.t()
  | Ash.Resource.Aggregate.t()
  | Ash.Resource.Calculation.t()
  | Ash.Resource.Relationships.relationship()
]
```

Returns all public attributes, aggregates, calculations and relationships of a resource

# `public_relationship`

Get a public relationship by name or path

# `public_relationships`

```elixir
@spec public_relationships(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Relationships.relationship()
]
```

Returns all public relationships of a resource

# `related`

```elixir
@spec related(
  Spark.Dsl.t() | Ash.Resource.t(),
  atom() | String.t() | [atom() | String.t()]
) ::
  Ash.Resource.t() | nil
```

# `relationship`

```elixir
@spec relationship(
  Spark.Dsl.t() | Ash.Resource.t(),
  atom() | String.t() | [atom() | String.t()]
) ::
  Ash.Resource.Relationships.relationship() | nil
```

Get a relationship by name or path

# `relationships`

```elixir
@spec relationships(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Relationships.relationship()
]
```

Returns all relationships of a resource

# `required_belongs_to_relationships`

The required belongs_to relationships

# `resource?`

```elixir
@spec resource?(module()) :: boolean()
```

Whether or not a given module is a resource module

# `reverse_relationship`

Retrieves a relationship path from the resource related by path, to the provided resource.

# `selected_by_default_attribute_names`

```elixir
@spec selected_by_default_attribute_names(Spark.Dsl.t() | Ash.Resource.t()) ::
  MapSet.t()
```

# `short_name`

```elixir
@spec short_name(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil
```

The short_name of the resource

# `show_inspect_fields`

```elixir
@spec show_inspect_fields(Spark.Dsl.t() | Ash.Resource.t()) :: [atom()] | nil
```

An allow-list of fields to show in the inspect output.

# `simple_notifiers`

```elixir
@spec simple_notifiers(Spark.Dsl.t() | Ash.Resource.t()) :: [module()]
```

A list of simple notifiers (require no DSL, used to avoid compile time dependencies)

# `sortable?`

```elixir
@spec sortable?(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom(),
  pagination_type: Ash.Page.type(),
  include_private?: boolean()
) :: boolean()
```

Determine if a field is sortable by name

# `static_default_attributes`

```elixir
@spec static_default_attributes(
  Spark.Dsl.t() | Ash.Resource.t(),
  type :: :create | :update
) :: [Ash.Resource.Attribute.t()]
```

Returns all attributes of a resource with static defaults

# `synonymous_relationship_paths?`

```elixir
@spec synonymous_relationship_paths?(
  Ash.Resource.t(),
  [atom()],
  [atom()],
  Ash.Resource.t()
) ::
  boolean()
```

Returns `true` if the relationship paths are synonymous from a data perspective

# `trace_name`

```elixir
@spec trace_name(Spark.Dsl.t() | Ash.Resource.t()) :: String.t() | nil
```

The trace_name of the resource

# `unique_keys`

```elixir
@spec unique_keys(Spark.Dsl.t() | Ash.Resource.t()) :: [
  %{type: atom(), keys: [atom()], nils_distinct?: boolean()}
]
```

A list of unique keys and information for a resource

# `validations`

```elixir
@spec validations(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Validation.t()]
```

A list of all validations for the resource

# `validations`

```elixir
@spec validations(
  Spark.Dsl.t() | Ash.Resource.t(),
  :create | :update | :destroy | :read
) :: [
  Ash.Resource.Validation.t()
]
```

A list of all validations for the resource for a given action type

---

*Consult [api-reference.md](api-reference.md) for complete listing*
