View Source Ash.Flow.Dsl (ash v1.52.0-rc.22)
The built in flow DSL.
dsl-documentation
DSL Documentation
index
Index
- flow
- argument
- steps
- map
- transaction
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- transaction
- transaction
- map
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- map
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- map
docs
Docs
flow
flow
Details about the flow itself, like description and the successful return type.
:api
- An api to use by default when calling actions:description
- A description of the flow:returns
- The step or step who's output to return. If given a single step, then the result of the step is returned. If given multiple, then a map of step name to result is returned. If nothing is provided, then the last step is returned.
To rename keys in the map of step names to results, use a keyword list, where the key is the step and the value is what should be in the returned map.
For example:returns :step_name
returns [:step_one, :step_two]
returns [step_one: :one, step_two: :two]
argument
argument
An argument to be passed into the flow
Introspection Target:
Examples:
argument :params, :map do
default %{}
end
argument :retries, :integer do
allow_nil? false
end
:name
- Required. The name to use for the argument:type
- Required. The type of the argument:default
- false A default value to use for the argument if not provided:allow_nil?
- Whether or not the argument value may be nil The default value istrue
.:constraints
- Constraints to provide to the type when casting the value. See the type's documentation for more information. The default value is[]
.
steps
steps
The steps to run.
- map
- transaction
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- transaction
- transaction
- map
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- create
- debug
- update
- destroy
- read
- run_flow
- custom
- map
- create
- debug
- update
- destroy
- read
- run_flow
- custom
Examples:
steps do
# invokes a create action
create :create_post, MyApp.Post, :create
end
Imports:
map
map
Runs a set of steps for each item in a provided list.
Introspection Target:
Examples:
map :create_users, range(1, arg(:count)) do
output :create_user
create :create_user, Org, :create do
input %{
first_name: {Faker.Person, :first_name, []},
last_name: {Faker.Person, :last_name, []}
}
end
end
:over
- The value to be iterated over. Will be available inside themap
step aselement(:map_step_name)
:output
- Which step to use when constructing the output list. Defaults to the last step.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
transaction
Runs a set of steps in a transaction.
Introspection Target:
Examples:
transaction :create_users do
create :create_user, User, :create do
input %{
first_name: {Faker.Person, :first_name, []},
last_name: {Faker.Person, :last_name, []}
}
end
update :update_user, User, :update do
record
end
over range(1, arg(:count))
output :create_user
create :create_user, Org, :create do
input %{
first_name: {Faker.Person, :first_name, []},
last_name: {Faker.Person, :last_name, []}
}
end
end
:output
- Which step or steps to use when constructing the output list. Defaults to the last step.:timeout
- A timeout to apply to the transaction.:resource
- The Ash resource to use for the transaction.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
create
Declares a step that will call a create action on a resource.
Introspection Target:
Examples:
create :create_post, MyApp.Post, :create
:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
debug
Declares a step that will inspect its input and provide additional debug information.
Introspection Target:
Examples:
debug :show_some_information do
input %{post: result(:create_post)}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
update
Declares a step that will call a update action on a resource.
Introspection Target:
Examples:
update :update_post, MyApp.Post, :update do
record result(:get_post)
end
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
destroy
Declares a step that will call a destroy action on a resource.
Introspection Target:
Examples:
destroy :destroy_post, MyApp.Post, :destroy
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
read
Declares a step that will call a read action on a resource.
Introspection Target:
Examples:
read :destroy_post, MyApp.Post, :destroy
:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
run_flow
Runs another flow as part of the current flow. The return value of the flow is the return value of the step.
Introspection Target:
Examples:
run_flow :get_org, GetOrgByName do
input %{
name: arg(:org_name)
}
:flow
- Required. The flow to run.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
custom
Runs a custom step module.
See Ash.Flow.Step
for the necessary callbacks and more information.
Introspection Target:
Examples:
custom :do_custom_thing, MyApp.DoCustomThing do
input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
input %{...}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:custom
:async?
- Whether or not this step can be run outside of the current process. Defaults to true.
Generally speaking, you should also set thetouches_resources
if you setasync?
to true. This ensures that the custom step will be run synchronously if any of those resource's data layers is in a corresponding transaction. You don't necessarily need to set all of the resources that will be touched. For example, all AshPostgres resources that share the same repo share the same transaction state. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
create
Declares a step that will call a create action on a resource.
Introspection Target:
Examples:
create :create_post, MyApp.Post, :create
:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
debug
Declares a step that will inspect its input and provide additional debug information.
Introspection Target:
Examples:
debug :show_some_information do
input %{post: result(:create_post)}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
update
Declares a step that will call a update action on a resource.
Introspection Target:
Examples:
update :update_post, MyApp.Post, :update do
record result(:get_post)
end
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
destroy
Declares a step that will call a destroy action on a resource.
Introspection Target:
Examples:
destroy :destroy_post, MyApp.Post, :destroy
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
read
Declares a step that will call a read action on a resource.
Introspection Target:
Examples:
read :destroy_post, MyApp.Post, :destroy
:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
run_flow
Runs another flow as part of the current flow. The return value of the flow is the return value of the step.
Introspection Target:
Examples:
run_flow :get_org, GetOrgByName do
input %{
name: arg(:org_name)
}
:flow
- Required. The flow to run.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
custom
Runs a custom step module.
See Ash.Flow.Step
for the necessary callbacks and more information.
Introspection Target:
Examples:
custom :do_custom_thing, MyApp.DoCustomThing do
input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
input %{...}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:custom
:async?
- Whether or not this step can be run outside of the current process. Defaults to true.
Generally speaking, you should also set thetouches_resources
if you setasync?
to true. This ensures that the custom step will be run synchronously if any of those resource's data layers is in a corresponding transaction. You don't necessarily need to set all of the resources that will be touched. For example, all AshPostgres resources that share the same repo share the same transaction state. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
transaction
transaction
Runs a set of steps in a transaction.
Introspection Target:
Examples:
transaction :create_users do
create :create_user, User, :create do
input %{
first_name: {Faker.Person, :first_name, []},
last_name: {Faker.Person, :last_name, []}
}
end
update :update_user, User, :update do
record
end
over range(1, arg(:count))
output :create_user
create :create_user, Org, :create do
input %{
first_name: {Faker.Person, :first_name, []},
last_name: {Faker.Person, :last_name, []}
}
end
end
:output
- Which step or steps to use when constructing the output list. Defaults to the last step.:timeout
- A timeout to apply to the transaction.:resource
- The Ash resource to use for the transaction.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
map
Runs a set of steps for each item in a provided list.
Introspection Target:
Examples:
map :create_users, range(1, arg(:count)) do
output :create_user
create :create_user, Org, :create do
input %{
first_name: {Faker.Person, :first_name, []},
last_name: {Faker.Person, :last_name, []}
}
end
end
:over
- The value to be iterated over. Will be available inside themap
step aselement(:map_step_name)
:output
- Which step to use when constructing the output list. Defaults to the last step.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
create
Declares a step that will call a create action on a resource.
Introspection Target:
Examples:
create :create_post, MyApp.Post, :create
:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
debug
Declares a step that will inspect its input and provide additional debug information.
Introspection Target:
Examples:
debug :show_some_information do
input %{post: result(:create_post)}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
update
Declares a step that will call a update action on a resource.
Introspection Target:
Examples:
update :update_post, MyApp.Post, :update do
record result(:get_post)
end
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
destroy
Declares a step that will call a destroy action on a resource.
Introspection Target:
Examples:
destroy :destroy_post, MyApp.Post, :destroy
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
read
Declares a step that will call a read action on a resource.
Introspection Target:
Examples:
read :destroy_post, MyApp.Post, :destroy
:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
run_flow
Runs another flow as part of the current flow. The return value of the flow is the return value of the step.
Introspection Target:
Examples:
run_flow :get_org, GetOrgByName do
input %{
name: arg(:org_name)
}
:flow
- Required. The flow to run.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
custom
Runs a custom step module.
See Ash.Flow.Step
for the necessary callbacks and more information.
Introspection Target:
Examples:
custom :do_custom_thing, MyApp.DoCustomThing do
input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
input %{...}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:custom
:async?
- Whether or not this step can be run outside of the current process. Defaults to true.
Generally speaking, you should also set thetouches_resources
if you setasync?
to true. This ensures that the custom step will be run synchronously if any of those resource's data layers is in a corresponding transaction. You don't necessarily need to set all of the resources that will be touched. For example, all AshPostgres resources that share the same repo share the same transaction state. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
create
Declares a step that will call a create action on a resource.
Introspection Target:
Examples:
create :create_post, MyApp.Post, :create
:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
debug
Declares a step that will inspect its input and provide additional debug information.
Introspection Target:
Examples:
debug :show_some_information do
input %{post: result(:create_post)}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
update
Declares a step that will call a update action on a resource.
Introspection Target:
Examples:
update :update_post, MyApp.Post, :update do
record result(:get_post)
end
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
destroy
Declares a step that will call a destroy action on a resource.
Introspection Target:
Examples:
destroy :destroy_post, MyApp.Post, :destroy
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
read
Declares a step that will call a read action on a resource.
Introspection Target:
Examples:
read :destroy_post, MyApp.Post, :destroy
:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
run_flow
Runs another flow as part of the current flow. The return value of the flow is the return value of the step.
Introspection Target:
Examples:
run_flow :get_org, GetOrgByName do
input %{
name: arg(:org_name)
}
:flow
- Required. The flow to run.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
custom
Runs a custom step module.
See Ash.Flow.Step
for the necessary callbacks and more information.
Introspection Target:
Examples:
custom :do_custom_thing, MyApp.DoCustomThing do
input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
input %{...}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:custom
:async?
- Whether or not this step can be run outside of the current process. Defaults to true.
Generally speaking, you should also set thetouches_resources
if you setasync?
to true. This ensures that the custom step will be run synchronously if any of those resource's data layers is in a corresponding transaction. You don't necessarily need to set all of the resources that will be touched. For example, all AshPostgres resources that share the same repo share the same transaction state. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
create
create
Declares a step that will call a create action on a resource.
Introspection Target:
Examples:
create :create_post, MyApp.Post, :create
:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
debug
debug
Declares a step that will inspect its input and provide additional debug information.
Introspection Target:
Examples:
debug :show_some_information do
input %{post: result(:create_post)}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:description
- A description for the step.
update
update
Declares a step that will call a update action on a resource.
Introspection Target:
Examples:
update :update_post, MyApp.Post, :update do
record result(:get_post)
end
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
destroy
destroy
Declares a step that will call a destroy action on a resource.
Introspection Target:
Examples:
destroy :destroy_post, MyApp.Post, :destroy
:record
- Required. The record to be updated, can use template helpers, e.gresult(:step_name)
.
If the value isnil
, the step is skipped andnil
is the result of the step. Any other value is used as an input record.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
read
read
Declares a step that will call a read action on a resource.
Introspection Target:
Examples:
read :destroy_post, MyApp.Post, :destroy
:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.:resource
- Required. The resource to call the action on.:action
- Required. The action to call on the resource.:api
- The api to use when calling the action. Defaults to the api set in theflow
section.:tenant
- A tenant to use for the operation. May be a template or a literal value.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step
run_flow
run_flow
Runs another flow as part of the current flow. The return value of the flow is the return value of the step.
Introspection Target:
Examples:
run_flow :get_org, GetOrgByName do
input %{
name: arg(:org_name)
}
:flow
- Required. The flow to run.:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:get?
- Whether or not read action is expected to return 0 or 1 results.
Action result will benil
or a record. If the action is configured withget? true
then this is automatically set totrue
. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.
custom
custom
Runs a custom step module.
See Ash.Flow.Step
for the necessary callbacks and more information.
Introspection Target:
Examples:
custom :do_custom_thing, MyApp.DoCustomThing do
input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
input %{...}
end
:input
- A template for the input.
Available template functions:
arg/1
to refer to a flow argumentresult/1
to refer to the result of another step:custom
:async?
- Whether or not this step can be run outside of the current process. Defaults to true.
Generally speaking, you should also set thetouches_resources
if you setasync?
to true. This ensures that the custom step will be run synchronously if any of those resource's data layers is in a corresponding transaction. You don't necessarily need to set all of the resources that will be touched. For example, all AshPostgres resources that share the same repo share the same transaction state. The default value isfalse
.:name
- Required. The name of the step. Will be used when expressing dependencies, and step inputs.:wait_for
- Ensures that the step happens after the configured step or steps.
This value is just a template that isn't used, except to determine dependencies, so you can use it like thiswait_for [result(:step_one), result(:step_two)]
orwait_for result(:step)
.:touches_resources
- A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed forcustom
steps.:description
- A description for the step.