325 lines
14 KiB
Go
325 lines
14 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// Package meshprovisioner is the contract of the seat "mesh-provisioner", defined whole (seats/mesh-provisioner/seat.json): The provisioner (ADR 0349): which domain answers which kind of placeholder, what each module needs, what is applied where.
|
|
package meshprovisioner
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"errors"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "mesh-provisioner"
|
|
|
|
const (
|
|
VerbProvisioning = "provisioning"
|
|
)
|
|
|
|
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
|
func Verbs() []string {
|
|
return []string{VerbProvisioning}
|
|
}
|
|
|
|
const (
|
|
StatePlans = "plans"
|
|
StateProvisions = "provisions"
|
|
)
|
|
|
|
// PlansByNodeModuleKey is the key of one value of the state plans under the form "<node>.<module>".
|
|
func PlansByNodeModuleKey(node, module string) string { return node + "." + module }
|
|
|
|
// ParsePlansByNodeModuleKey reads the parts of a key of the form "<node>.<module>", in the order of the form; the last result is false for a key of another form.
|
|
func ParsePlansByNodeModuleKey(key string) (string, string, bool) {
|
|
rest := key
|
|
v0, after0, found0 := strings.Cut(rest, ".")
|
|
if !found0 || v0 == "" {
|
|
return "", "", false
|
|
}
|
|
rest = after0
|
|
if rest == "" {
|
|
return "", "", false
|
|
}
|
|
v2 := rest
|
|
rest = ""
|
|
if rest != "" {
|
|
return "", "", false
|
|
}
|
|
return v0, v2, true
|
|
}
|
|
|
|
// DecodePlansByNodeModuleValue reads one value of the state plans under the form "<node>.<module>", refusing a field PlansByNodeModuleValue does not know and any text after the value.
|
|
func DecodePlansByNodeModuleValue(raw []byte) (PlansByNodeModuleValue, error) {
|
|
var v PlansByNodeModuleValue
|
|
dec := json.NewDecoder(bytes.NewReader(raw))
|
|
dec.DisallowUnknownFields()
|
|
if err := dec.Decode(&v); err != nil {
|
|
return v, err
|
|
}
|
|
if dec.More() {
|
|
return v, errors.New("text after the value")
|
|
}
|
|
return v, nil
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionKey is the key of one value of the state provisions under the form "<node>.<consumer>.<provision>".
|
|
func ProvisionsByNodeConsumerProvisionKey(node, consumer, provision string) string {
|
|
return node + "." + consumer + "." + provision
|
|
}
|
|
|
|
// ParseProvisionsByNodeConsumerProvisionKey reads the parts of a key of the form "<node>.<consumer>.<provision>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseProvisionsByNodeConsumerProvisionKey(key string) (string, string, string, bool) {
|
|
rest := key
|
|
v0, after0, found0 := strings.Cut(rest, ".")
|
|
if !found0 || v0 == "" {
|
|
return "", "", "", false
|
|
}
|
|
rest = after0
|
|
v2, after2, found2 := strings.Cut(rest, ".")
|
|
if !found2 || v2 == "" {
|
|
return "", "", "", false
|
|
}
|
|
rest = after2
|
|
if rest == "" {
|
|
return "", "", "", false
|
|
}
|
|
v4 := rest
|
|
rest = ""
|
|
if rest != "" {
|
|
return "", "", "", false
|
|
}
|
|
return v0, v2, v4, true
|
|
}
|
|
|
|
// DecodeProvisionsByNodeConsumerProvisionValue reads one value of the state provisions under the form "<node>.<consumer>.<provision>", refusing a field ProvisionsByNodeConsumerProvisionValue does not know and any text after the value.
|
|
func DecodeProvisionsByNodeConsumerProvisionValue(raw []byte) (ProvisionsByNodeConsumerProvisionValue, error) {
|
|
var v ProvisionsByNodeConsumerProvisionValue
|
|
dec := json.NewDecoder(bytes.NewReader(raw))
|
|
dec.DisallowUnknownFields()
|
|
if err := dec.Decode(&v); err != nil {
|
|
return v, err
|
|
}
|
|
if dec.More() {
|
|
return v, errors.New("text after the value")
|
|
}
|
|
return v, nil
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalKey is the key of one value of the state provisions under the form "<node>.<consumer>.<provision>.<local>".
|
|
func ProvisionsByNodeConsumerProvisionLocalKey(node, consumer, provision, local string) string {
|
|
return node + "." + consumer + "." + provision + "." + local
|
|
}
|
|
|
|
// ParseProvisionsByNodeConsumerProvisionLocalKey reads the parts of a key of the form "<node>.<consumer>.<provision>.<local>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseProvisionsByNodeConsumerProvisionLocalKey(key string) (string, string, string, string, bool) {
|
|
rest := key
|
|
v0, after0, found0 := strings.Cut(rest, ".")
|
|
if !found0 || v0 == "" {
|
|
return "", "", "", "", false
|
|
}
|
|
rest = after0
|
|
v2, after2, found2 := strings.Cut(rest, ".")
|
|
if !found2 || v2 == "" {
|
|
return "", "", "", "", false
|
|
}
|
|
rest = after2
|
|
v4, after4, found4 := strings.Cut(rest, ".")
|
|
if !found4 || v4 == "" {
|
|
return "", "", "", "", false
|
|
}
|
|
rest = after4
|
|
if rest == "" {
|
|
return "", "", "", "", false
|
|
}
|
|
v6 := rest
|
|
rest = ""
|
|
if rest != "" {
|
|
return "", "", "", "", false
|
|
}
|
|
return v0, v2, v4, v6, true
|
|
}
|
|
|
|
// DecodeProvisionsByNodeConsumerProvisionLocalValue reads one value of the state provisions under the form "<node>.<consumer>.<provision>.<local>", refusing a field ProvisionsByNodeConsumerProvisionLocalValue does not know and any text after the value.
|
|
func DecodeProvisionsByNodeConsumerProvisionLocalValue(raw []byte) (ProvisionsByNodeConsumerProvisionLocalValue, error) {
|
|
var v ProvisionsByNodeConsumerProvisionLocalValue
|
|
dec := json.NewDecoder(bytes.NewReader(raw))
|
|
dec.DisallowUnknownFields()
|
|
if err := dec.Decode(&v); err != nil {
|
|
return v, err
|
|
}
|
|
if dec.More() {
|
|
return v, errors.New("text after the value")
|
|
}
|
|
return v, nil
|
|
}
|
|
|
|
// ProvisioningInput is what provisioning takes.
|
|
type ProvisioningInput struct {
|
|
// for collect: a collection
|
|
Collection string `json:"collection,omitempty"`
|
|
// a module: for collect, a contributor
|
|
Module string `json:"module,omitempty"`
|
|
// a node
|
|
Node string `json:"node,omitempty"`
|
|
// registry (when not given), needs, applied or collect
|
|
What string `json:"what,omitempty"`
|
|
}
|
|
|
|
// ProvisioningAnswer is what provisioning answers.
|
|
type ProvisioningAnswer = map[string]any
|
|
|
|
// PlansByNodeModuleValue is one value of the state plans under the key <node>.<module>.
|
|
type PlansByNodeModuleValue struct {
|
|
Module string `json:"module"`
|
|
Node string `json:"node"`
|
|
// the module's plan
|
|
Plan map[string]any `json:"plan"`
|
|
V int64 `json:"v,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionValueConsumer is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionValueConsumer struct {
|
|
Module string `json:"module,omitempty"`
|
|
Node string `json:"node,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionValuePlan is the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126).
|
|
type ProvisionsByNodeConsumerProvisionValuePlan struct {
|
|
As string `json:"as,omitempty"`
|
|
At string `json:"at,omitempty"`
|
|
// the provider's own contract's bytes, carried unread
|
|
Contributed map[string]any `json:"contributed,omitempty"`
|
|
Contributes map[string]any `json:"contributes,omitempty"`
|
|
CredentialForm any `json:"credential-form,omitempty"`
|
|
CredentialTool string `json:"credential-tool,omitempty"`
|
|
From string `json:"from,omitempty"`
|
|
Local string `json:"local,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
Names map[string]string `json:"names,omitempty"`
|
|
Path string `json:"path,omitempty"`
|
|
Provider string `json:"provider"`
|
|
ProviderModule string `json:"provider-module"`
|
|
Provision string `json:"provision"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionValueProvider is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionValueProvider struct {
|
|
Module string `json:"module,omitempty"`
|
|
Node string `json:"node,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionValueReference is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionValueReference struct {
|
|
Generation int64 `json:"generation,omitempty"`
|
|
ID string `json:"id,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionValueWarrant is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionValueWarrant struct {
|
|
Ask string `json:"ask,omitempty"`
|
|
At *time.Time `json:"at,omitempty"`
|
|
By string `json:"by,omitempty"`
|
|
Option string `json:"option,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionValue is one value of the state provisions under the key <node>.<consumer>.<provision>.
|
|
type ProvisionsByNodeConsumerProvisionValue struct {
|
|
Ask string `json:"ask,omitempty"`
|
|
At time.Time `json:"at"`
|
|
Consumer ProvisionsByNodeConsumerProvisionValueConsumer `json:"consumer"`
|
|
DependsOn []string `json:"depends-on,omitempty"`
|
|
Local string `json:"local,omitempty"`
|
|
// the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126)
|
|
Plan *ProvisionsByNodeConsumerProvisionValuePlan `json:"plan,omitempty"`
|
|
Provider ProvisionsByNodeConsumerProvisionValueProvider `json:"provider"`
|
|
Provision string `json:"provision"`
|
|
Reference *ProvisionsByNodeConsumerProvisionValueReference `json:"reference,omitempty"`
|
|
State string `json:"state"`
|
|
V int64 `json:"v,omitempty"`
|
|
Warrant *ProvisionsByNodeConsumerProvisionValueWarrant `json:"warrant,omitempty"`
|
|
Why string `json:"why,omitempty"`
|
|
}
|
|
|
|
// The values of ProvisionsByNodeConsumerProvisionValue's state.
|
|
const (
|
|
ProvisionsByNodeConsumerProvisionValueStateAsked = "asked"
|
|
ProvisionsByNodeConsumerProvisionValueStateProvided = "provided"
|
|
ProvisionsByNodeConsumerProvisionValueStateWaits = "waits"
|
|
ProvisionsByNodeConsumerProvisionValueStateFailed = "failed"
|
|
ProvisionsByNodeConsumerProvisionValueStateRetiring = "retiring"
|
|
)
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalValueConsumer is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionLocalValueConsumer struct {
|
|
Module string `json:"module,omitempty"`
|
|
Node string `json:"node,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalValuePlan is the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126).
|
|
type ProvisionsByNodeConsumerProvisionLocalValuePlan struct {
|
|
As string `json:"as,omitempty"`
|
|
At string `json:"at,omitempty"`
|
|
// the provider's own contract's bytes, carried unread
|
|
Contributed map[string]any `json:"contributed,omitempty"`
|
|
Contributes map[string]any `json:"contributes,omitempty"`
|
|
CredentialForm any `json:"credential-form,omitempty"`
|
|
CredentialTool string `json:"credential-tool,omitempty"`
|
|
From string `json:"from,omitempty"`
|
|
Local string `json:"local,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
Names map[string]string `json:"names,omitempty"`
|
|
Path string `json:"path,omitempty"`
|
|
Provider string `json:"provider"`
|
|
ProviderModule string `json:"provider-module"`
|
|
Provision string `json:"provision"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalValueProvider is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionLocalValueProvider struct {
|
|
Module string `json:"module,omitempty"`
|
|
Node string `json:"node,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalValueReference is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionLocalValueReference struct {
|
|
Generation int64 `json:"generation,omitempty"`
|
|
ID string `json:"id,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalValueWarrant is a type of the contract.
|
|
type ProvisionsByNodeConsumerProvisionLocalValueWarrant struct {
|
|
Ask string `json:"ask,omitempty"`
|
|
At *time.Time `json:"at,omitempty"`
|
|
By string `json:"by,omitempty"`
|
|
Option string `json:"option,omitempty"`
|
|
}
|
|
|
|
// ProvisionsByNodeConsumerProvisionLocalValue is one value of the state provisions under the key <node>.<consumer>.<provision>.<local>.
|
|
type ProvisionsByNodeConsumerProvisionLocalValue struct {
|
|
Ask string `json:"ask,omitempty"`
|
|
At time.Time `json:"at"`
|
|
Consumer ProvisionsByNodeConsumerProvisionLocalValueConsumer `json:"consumer"`
|
|
DependsOn []string `json:"depends-on,omitempty"`
|
|
Local string `json:"local,omitempty"`
|
|
// the plan's provision: the entry the key was composed from, at the consumer's wanted build or its newest (issue 1126)
|
|
Plan *ProvisionsByNodeConsumerProvisionLocalValuePlan `json:"plan,omitempty"`
|
|
Provider ProvisionsByNodeConsumerProvisionLocalValueProvider `json:"provider"`
|
|
Provision string `json:"provision"`
|
|
Reference *ProvisionsByNodeConsumerProvisionLocalValueReference `json:"reference,omitempty"`
|
|
State string `json:"state"`
|
|
V int64 `json:"v,omitempty"`
|
|
Warrant *ProvisionsByNodeConsumerProvisionLocalValueWarrant `json:"warrant,omitempty"`
|
|
Why string `json:"why,omitempty"`
|
|
}
|
|
|
|
// The values of ProvisionsByNodeConsumerProvisionLocalValue's state.
|
|
const (
|
|
ProvisionsByNodeConsumerProvisionLocalValueStateAsked = "asked"
|
|
ProvisionsByNodeConsumerProvisionLocalValueStateProvided = "provided"
|
|
ProvisionsByNodeConsumerProvisionLocalValueStateWaits = "waits"
|
|
ProvisionsByNodeConsumerProvisionLocalValueStateFailed = "failed"
|
|
ProvisionsByNodeConsumerProvisionLocalValueStateRetiring = "retiring"
|
|
)
|