View Source Ash.Api.Dsl (ash v2.9.21)
A small DSL for declaring APIs
Apis are the entrypoints for working with your resources.
Apis may optionally include a list of resources, in which case they can be
used as an
Ash.Registry in various places. This is for backwards compatibility,
but if at all possible you should define an
Ash.Registry if you are using an extension
that requires a list of resources. For example, most extensions look for two application
environment variables called
:ash_registries to find any potential registries
General Api configuration
api do description """ Resources related to the flux capacitor. """ end
String.t/0) - A description for the api.
List the resources present in this API
resources do registry MyApp.Registry en
:allow- Support a dynamic resource list by providing a callback that checks whether or not the resource should be allowed.
boolean/0) - Whether the Api will support only registered entries or not. The default value is
atom/0) - Configure the registry that contains the resources. It is recommended to use application config for this, to help with compile times. See the quick start guide for more.
Options for how requests are executed using this Api
execution do timeout :timer.seconds(30) end
timeout/0) - The default timeout to use for requests using this API. See the timeouts guide for more. The default value is
String.t/0) - The name to use in traces. Defaults to the last part of the module.
See the monitoring guide for more
Options for how requests are authorized using this Api.
See the security guide for more.
authorization do authorize :by_default end
boolean/0) - Requires that an actor has been supplied. The default value is
:authorize- When to run authorization for a given request. The default value is