Unified DSL extension for all Diffo provider resource kinds.
Provides a single provider do section for Instance, Party, and Place kinds.
The sections within provider do are self-similar across kinds — each kind uses
the sections relevant to it, and verifiers enforce correct usage.
Instance
provider do
specification do
id "da9b207a-26c3-451d-8abd-0640c6349979"
name "DSL Access Service"
type :serviceSpecification
end
characteristics do
characteristic :circuit, Diffo.Access.Circuit
end
features do
feature :dynamic_line_management do
characteristics do
characteristic :constraints, Diffo.Access.Constraints
end
end
end
pools do
pool :ports, :port
end
parties do
party :provider, MyApp.Provider
party_ref :owner, MyApp.InfrastructureCo
parties :technicians, MyApp.Technician, constraints: [min: 1]
end
places do
place :installation_site, MyApp.GeographicSite
place_ref :billing_address, MyApp.GeographicAddress
end
behaviour do
actions do
create :build
end
end
endParty
provider do
instances do
role :facilitates, MyApp.AccessService
instance_ref :manages, MyApp.InternalService
end
parties do
role :employer, MyApp.Person
end
places do
role :headquarters, MyApp.GeographicSite
end
endPlace
provider do
instances do
role :site_for, MyApp.AccessService
end
parties do
role :managed_by, MyApp.Organization
end
places do
role :within, MyApp.GeographicSite
end
endSee Diffo.Provider.Extension.Info for runtime introspection.
See Diffo.Provider.BaseInstance, Diffo.Provider.BaseParty, Diffo.Provider.BasePlace
for full usage documentation.
provider
Provider DSL — structure, roles, and behaviour for this resource kind
Nested DSLs
- specification
- characteristics
- characteristic
- features
- feature
- characteristic
- feature
- pools
- pool
- parties
- party
- parties
- party_ref
- role
- places
- place
- places
- place_ref
- role
- instances
- role
- instance_ref
- behaviour
- actions
- create
- update
- actions
provider.specification
Defines the Instance Specification
Examples
specification do
id "da9b207a-26c3-451d-8abd-0640c6349979"
name "DSL Access Service"
type :serviceSpecification
major_version 1
description "An access network service"
category "Network Service"
end
Options
| Name | Type | Default | Docs |
|---|---|---|---|
id | String.t | The id of the specification, a uuid4 the same in all environments, unique for name and major_version. | |
name | String.t | The name of the specification. | |
type | atom | :serviceSpecification | The type of the specification. |
major_version | integer | 1 | The major version of the specification. |
minor_version | integer | The minor version of the specification. | |
patch_version | integer | The patch version of the specification. | |
tmf_version | integer | The TMF API version of the specification, e.g. 4. | |
description | String.t | A generic description of the specified service or resource. | |
category | String.t | The category the specified service or resource belongs to. |
provider.characteristics
List of Instance Characteristics
Nested DSLs
Examples
characteristics do
characteristic :circuit, Diffo.Access.Circuit
characteristic :line, Diffo.Access.Line
end
provider.characteristics.characteristic
characteristic name, value_typeAdds a Characteristic
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the characteristic. | |
value_type | any | The type of the characteristic value — a module or {:array, module} for an array. |
provider.features
Configuration for Instance Features
Nested DSLs
- feature
- characteristic
Examples
features do
feature :dynamic_line_management do
is_enabled? true
characteristics do
characteristic :constraints, Diffo.Access.Constraints
end
end
end
provider.features.feature
feature nameAdds a Feature
Nested DSLs
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the feature. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
is_enabled? | boolean | Whether the feature is enabled by default, defaults true. |
provider.features.feature.characteristic
characteristic name, value_typeAdds a Characteristic
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the characteristic. | |
value_type | any | The type of the characteristic value — a module or {:array, module} for an array. |
provider.pools
Assignable pools on this Instance — each pool maps to an AssignableCharacteristic
Nested DSLs
Examples
pools do
pool :ports, :port
end
provider.pools.pool
pool name, thingDeclares an assignable pool — a named range of values for auto-assignment
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The pool name (matches the AssignableCharacteristic name). | |
thing | atom | The name of the thing being assigned within the pool (e.g. :port). |
provider.parties
Party roles on this resource — party/parties/party_ref for Instance kinds; role for Party and Place kinds
Nested DSLs
Examples
# Instance
parties do
party :provider, MyApp.Provider
party_ref :owner, MyApp.InfrastructureCo
parties :technicians, MyApp.Technician, constraints: [min: 1]
end
# Party or Place
parties do
role :employer, MyApp.Person
end
provider.parties.party
party role, party_typeDeclares a singular party role on this Instance
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
party_type | any | The module of the Party kind. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
calculate | atom | Ash calculation on this resource that produces the party. |
Introspection
Target: Diffo.Provider.Extension.PartyDeclaration
provider.parties.parties
parties role, party_typeDeclares a plural party role on this Instance
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
party_type | any | The module of the Party kind. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
calculate | atom | Ash calculation on this resource that produces the party. | |
constraints | keyword | Multiplicity constraints, e.g. [min: 1, max: 3]. |
Introspection
Target: Diffo.Provider.Extension.PartyDeclaration
provider.parties.party_ref
party_ref role, party_typeDeclares a singular reference party role — no direct PartyRef edge, reachable by graph traversal
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
party_type | any | The module of the Party kind. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
calculate | atom | Ash calculation on this resource that produces the party. |
Introspection
Target: Diffo.Provider.Extension.PartyDeclaration
provider.parties.role
role role, party_typeDeclares a role this Party or Place kind plays with respect to other Parties
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
party_type | any | The module of the related Party kind. |
Introspection
Target: Diffo.Provider.Extension.PartyRole
provider.places
Place roles on this resource — place/places/place_ref for Instance kinds; role for Party and Place kinds
Nested DSLs
Examples
# Instance
places do
place :installation_site, MyApp.GeographicSite
place_ref :billing_address, MyApp.GeographicAddress
end
# Party or Place
places do
role :headquarters, MyApp.GeographicSite
end
provider.places.place
place role, place_typeDeclares a singular place role on this Instance
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
place_type | any | The module of the Place kind. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
calculate | atom | Ash calculation on this resource that produces the place. |
Introspection
Target: Diffo.Provider.Extension.PlaceDeclaration
provider.places.places
places role, place_typeDeclares a plural place role on this Instance
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
place_type | any | The module of the Place kind. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
calculate | atom | Ash calculation on this resource that produces the place. | |
constraints | keyword | Multiplicity constraints, e.g. [min: 1, max: 3]. |
Introspection
Target: Diffo.Provider.Extension.PlaceDeclaration
provider.places.place_ref
place_ref role, place_typeDeclares a singular reference place role — no direct PlaceRef edge, reachable by graph traversal
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
place_type | any | The module of the Place kind. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
calculate | atom | Ash calculation on this resource that produces the place. |
Introspection
Target: Diffo.Provider.Extension.PlaceDeclaration
provider.places.role
role role, place_typeDeclares a role this Party or Place kind plays with respect to Places
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
place_type | any | The module of the related Place kind. |
Introspection
Target: Diffo.Provider.Extension.PlaceRole
provider.instances
Declares the roles this Party or Place kind plays with respect to Instances
Nested DSLs
Examples
instances do
role :facilitates, MyApp.AccessService
instance_ref :manages, MyApp.InternalService
end
provider.instances.role
role role, instance_typeDeclares a role this Party or Place kind plays with respect to Instances
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
instance_type | any | The module of the related Instance kind. |
Introspection
Target: Diffo.Provider.Extension.InstanceRole
provider.instances.instance_ref
instance_ref role, instance_typeDeclares a reference instance role — no direct edge created, reachable by graph traversal
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
role | atom | The role name. | |
instance_type | any | The module of the related Instance kind. |
Introspection
Target: Diffo.Provider.Extension.InstanceRole
provider.behaviour
Defines the behavioural wiring for the Instance — actions, and in future triggers
Nested DSLs
- actions
- create
- update
Examples
behaviour do
actions do
create :build
end
end
provider.behaviour.actions
Declares which actions to wire for instance behaviour
Nested DSLs
Examples
actions do
create :build
update :define
end
provider.behaviour.actions.create
create nameMarks a create action for instance build wiring
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the create action to wire. |
provider.behaviour.actions.update
update nameMarks an update action for instance behaviour wiring
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the update action to wire. |