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

Codemods for working with Ash.Resource modules

## Important Details

This interrogates *the source code* of a resource, not its ultimate compiled state.
What this means, is that things like `defines_attribute` will not return `true` if
the attribute is added by an extension. Only if it appears literally in the source code
of the resource or one of its `Spark.Dsl.Fragment`s.

# `add_action`

Adds the given code block to the resource's `actions` block

# `add_attribute`

Adds the given code block to the resource's `attributes` block

# `add_block`

Adds the given code block to the block of the resource specified

# `add_bypass`

Adds a bypass to the top of the resource's `policies` block

# `add_calculation`

Adds the given code block to the resource's `calculations` block

# `add_identity`

Adds the given code block to the resource's `identities` block

# `add_new_action`

Adds an action if it doesn't already exist

# `add_new_attribute`

Adds the given code block to the resource's `attributes` block if there is no existing attribute with the given name

# `add_new_calculation`

Adds the given code block to the resource's `calculations` block if there is no existing calculation with the given name

# `add_new_identity`

Adds the given code block to the resource's `identities` block if there is no existing identity with the given name

# `add_new_relationship`

Adds the given code block to the resource's `relationships` block

# `add_policy`

Adds a policy to the bottom of the resource's `policies` block

# `add_relationship`

Adds the given code block to the resource's `relationships` block

# `add_resource_configuration`

Adds the given code block to the resource's `resource` block

# `defines_action`

```elixir
@spec defines_action(Igniter.t(), Ash.Resource.t(), atom()) ::
  {Igniter.t(), true | false}
```

Returns true if the given resource defines an action with the provided name

# `defines_attribute`

```elixir
@spec defines_attribute(Igniter.t(), Ash.Resource.t(), atom()) ::
  {Igniter.t(), true | false}
```

Returns true if the given resource defines an attribute with the provided name

# `defines_calculation`

```elixir
@spec defines_calculation(Igniter.t(), Ash.Resource.t(), atom()) ::
  {Igniter.t(), true | false}
```

Returns true if the given resource defines a calculation with the provided name

# `defines_identity`

```elixir
@spec defines_identity(Igniter.t(), Ash.Resource.t(), atom()) ::
  {Igniter.t(), true | false}
```

Returns true if the given resource defines an identity with the provided name

# `defines_relationship`

```elixir
@spec defines_relationship(Igniter.t(), Ash.Resource.t(), atom()) ::
  {Igniter.t(), true | false}
```

Returns true if the given resource defines a relationship with the provided name

# `domain`

```elixir
@spec domain(Igniter.t(), Ash.Resource.t()) ::
  {:ok, Igniter.t(), Ash.Domain.t()} | {:error, Igniter.t()}
```

Gets the domain from the given resource module

# `ensure_primary_action`

```elixir
@spec ensure_primary_action(
  Igniter.t(),
  Ash.Resource.t(),
  :create | :read | :update | :destroy
) :: Igniter.t()
```

# `ensure_timestamps`

Ensures that created_at and updated_at timestamps exist on the resource

# `has_action_with_primary`

```elixir
@spec has_action_with_primary(Igniter.t(), Ash.Resource.t(), atom()) ::
  {Igniter.t(), true | false}
```

# `list_resources`

List all resource modules found in the project

# `resource_mods`

---

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