Diffo.Provider.Extension

Copy Markdown View Source

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
end

Party

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
end

Place

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
end

See 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

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

NameTypeDefaultDocs
idString.tThe id of the specification, a uuid4 the same in all environments, unique for name and major_version.
nameString.tThe name of the specification.
typeatom:serviceSpecificationThe type of the specification.
major_versioninteger1The major version of the specification.
minor_versionintegerThe minor version of the specification.
patch_versionintegerThe patch version of the specification.
tmf_versionintegerThe TMF API version of the specification, e.g. 4.
descriptionString.tA generic description of the specified service or resource.
categoryString.tThe 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_type

Adds a Characteristic

Arguments

NameTypeDefaultDocs
nameatomThe name of the characteristic.
value_typeanyThe type of the characteristic value — a module or {:array, module} for an array.

provider.features

Configuration for Instance Features

Nested DSLs

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 name

Adds a Feature

Nested DSLs

Arguments

NameTypeDefaultDocs
nameatomThe name of the feature.

Options

NameTypeDefaultDocs
is_enabled?booleanWhether the feature is enabled by default, defaults true.

provider.features.feature.characteristic

characteristic name, value_type

Adds a Characteristic

Arguments

NameTypeDefaultDocs
nameatomThe name of the characteristic.
value_typeanyThe 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, thing

Declares an assignable pool — a named range of values for auto-assignment

Arguments

NameTypeDefaultDocs
nameatomThe pool name (matches the AssignableCharacteristic name).
thingatomThe 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_type

Declares a singular party role on this Instance

Arguments

NameTypeDefaultDocs
roleatomThe role name.
party_typeanyThe module of the Party kind.

Options

NameTypeDefaultDocs
calculateatomAsh calculation on this resource that produces the party.

Introspection

Target: Diffo.Provider.Extension.PartyDeclaration

provider.parties.parties

parties role, party_type

Declares a plural party role on this Instance

Arguments

NameTypeDefaultDocs
roleatomThe role name.
party_typeanyThe module of the Party kind.

Options

NameTypeDefaultDocs
calculateatomAsh calculation on this resource that produces the party.
constraintskeywordMultiplicity constraints, e.g. [min: 1, max: 3].

Introspection

Target: Diffo.Provider.Extension.PartyDeclaration

provider.parties.party_ref

party_ref role, party_type

Declares a singular reference party role — no direct PartyRef edge, reachable by graph traversal

Arguments

NameTypeDefaultDocs
roleatomThe role name.
party_typeanyThe module of the Party kind.

Options

NameTypeDefaultDocs
calculateatomAsh calculation on this resource that produces the party.

Introspection

Target: Diffo.Provider.Extension.PartyDeclaration

provider.parties.role

role role, party_type

Declares a role this Party or Place kind plays with respect to other Parties

Arguments

NameTypeDefaultDocs
roleatomThe role name.
party_typeanyThe 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_type

Declares a singular place role on this Instance

Arguments

NameTypeDefaultDocs
roleatomThe role name.
place_typeanyThe module of the Place kind.

Options

NameTypeDefaultDocs
calculateatomAsh calculation on this resource that produces the place.

Introspection

Target: Diffo.Provider.Extension.PlaceDeclaration

provider.places.places

places role, place_type

Declares a plural place role on this Instance

Arguments

NameTypeDefaultDocs
roleatomThe role name.
place_typeanyThe module of the Place kind.

Options

NameTypeDefaultDocs
calculateatomAsh calculation on this resource that produces the place.
constraintskeywordMultiplicity constraints, e.g. [min: 1, max: 3].

Introspection

Target: Diffo.Provider.Extension.PlaceDeclaration

provider.places.place_ref

place_ref role, place_type

Declares a singular reference place role — no direct PlaceRef edge, reachable by graph traversal

Arguments

NameTypeDefaultDocs
roleatomThe role name.
place_typeanyThe module of the Place kind.

Options

NameTypeDefaultDocs
calculateatomAsh calculation on this resource that produces the place.

Introspection

Target: Diffo.Provider.Extension.PlaceDeclaration

provider.places.role

role role, place_type

Declares a role this Party or Place kind plays with respect to Places

Arguments

NameTypeDefaultDocs
roleatomThe role name.
place_typeanyThe 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_type

Declares a role this Party or Place kind plays with respect to Instances

Arguments

NameTypeDefaultDocs
roleatomThe role name.
instance_typeanyThe module of the related Instance kind.

Introspection

Target: Diffo.Provider.Extension.InstanceRole

provider.instances.instance_ref

instance_ref role, instance_type

Declares a reference instance role — no direct edge created, reachable by graph traversal

Arguments

NameTypeDefaultDocs
roleatomThe role name.
instance_typeanyThe 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

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 name

Marks a create action for instance build wiring

Arguments

NameTypeDefaultDocs
nameatomThe name of the create action to wire.

provider.behaviour.actions.update

update name

Marks an update action for instance behaviour wiring

Arguments

NameTypeDefaultDocs
nameatomThe name of the update action to wire.