Documentation
¶
Overview ¶
Package composition validates component membership in named compositions.
A composition groups multiple services into one system. Components join a composition via their first-class `composition:` field. Membership is a closed contract (a component may only claim a service the composition declares) but fulfillment is open (a declared service with no component in a given stack is allowed).
Index ¶
- func ExecuteLifecycle(ctx context.Context, info *schema.ConfigAndStacksInfo, verb, name string, ...) error
- func ExecuteList(_ context.Context, info *schema.ConfigAndStacksInfo) error
- func ExecuteValidate(_ context.Context, info *schema.ConfigAndStacksInfo, name string) error
- func ValidateMembership(componentName, compositionName string, ...) error
- type Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteLifecycle ¶ added in v1.223.0
func ExecuteLifecycle(ctx context.Context, info *schema.ConfigAndStacksInfo, verb, name string, flags map[string]any) error
ExecuteLifecycle runs a provider-backed lifecycle/read command against one composition or all compositions fulfilled in the selected stack.
func ExecuteList ¶ added in v1.223.0
func ExecuteList(_ context.Context, info *schema.ConfigAndStacksInfo) error
ExecuteList lists declared compositions. With a stack, it includes fulfillment details for that stack; without a stack, it lists the declared composition contract without inspecting stack fulfillment.
func ExecuteValidate ¶
ExecuteValidate produces a soft report of which composition services are fulfilled and which are not provided in a stack, and surfaces any unknown members (which are hard errors enforced during component execution).
func ValidateMembership ¶
func ValidateMembership(componentName, compositionName string, compositions map[string]schema.Composition) error
ValidateMembership checks that a component claiming membership in a composition is allowed: the composition must exist and must declare the component's name in its services list. Returns a hard error otherwise. An empty composition name is valid (no membership).
Types ¶
type Report ¶
type Report struct {
Composition string
Description string
Fulfilled []string // declared services that a component provides in this stack
NotProvided []string // declared services with no component in this stack
Unknown []string // members claimed by components but not declared (hard errors)
}
Report describes which declared services of a composition are fulfilled by components in a stack and which are not provided there.
func Validate ¶
func Validate(compositionName string, members []string, compositions map[string]schema.Composition) (Report, error)
Validate builds a soft Report for a composition given the set of component names that claim membership in it within a stack. Members not declared by the composition are surfaced in Unknown (these are hard errors elsewhere).