View Source Ash.Resource.Igniter (ash v3.4.45)
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.
Summary
Functions
Adds the given code block to the resource's actions
block
Adds the given code block to the resource's attributes
block
Adds the given code block to the block of the resource specified
Adds a bypass to the top of the resource's policies
block
Adds the given code block to the resource's identities
block
Adds an action if it doesn't already exist
Adds the given code block to the resource's attributes
block if there is no existing attribute with the given name
Adds the given code block to the resource's identities
block if there is no existing identity with the given name
Adds the given code block to the resource's relationships
block
Adds a policy to the bottom of the resource's policies
block
Adds the given code block to the resource's relationships
block
Adds the given code block to the resource's resource
block
Returns true if the given resource defines an action with the provided name
Returns true if the given resource defines an attribute with the provided name
Returns true if the given resource defines an identity with the provided name
Returns true if the given resource defines a relationship with the provided name
Gets the domain from the given resource module
Ensures that created_at and updated_at timestamps exist on the resource
List all resource modules found in the project
Functions
Adds the given code block to the resource's actions
block
Adds the given code block to the resource's attributes
block
Adds the given code block to the block of the resource specified
Adds a bypass to the top of the resource's policies
block
Adds the given code block to the resource's identities
block
Adds an action if it doesn't already exist
Adds the given code block to the resource's attributes
block if there is no existing attribute with the given name
Adds the given code block to the resource's identities
block if there is no existing identity with the given name
Adds the given code block to the resource's relationships
block
Adds a policy to the bottom of the resource's policies
block
Adds the given code block to the resource's relationships
block
Adds the given code block to the resource's resource
block
@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
@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
@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
@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
@spec domain(Igniter.t(), Ash.Resource.t()) :: {:ok, Igniter.t(), Ash.Domain.t()} | {:error, Igniter.t()}
Gets the domain from the given resource module
@spec ensure_primary_action( Igniter.t(), Ash.Resource.t(), :create | :read | :update | :destroy ) :: Igniter.t()
Ensures that created_at and updated_at timestamps exist on the resource
@spec has_action_with_primary(Igniter.t(), Ash.Resource.t(), atom()) :: {Igniter.t(), true | false}
List all resource modules found in the project