Documentation ¶
Index ¶
- Constants
- func AutomationWorkflowRbacReferences(workflow string) (res *Ref, pp []*Ref, err error)
- func CastMergeAlg(v string) (mergeAlg mergeAlg)
- func ComposeChartRbacReferences(namespaceID string, chart string) (res *Ref, pp []*Ref, err error)
- func ComposeModuleFieldRbacReferences(namespaceID string, moduleID string, moduleField string) (res *Ref, pp []*Ref, err error)
- func ComposeModuleRbacReferences(namespaceID string, module string) (res *Ref, pp []*Ref, err error)
- func ComposeNamespaceRbacReferences(namespace string) (res *Ref, pp []*Ref, err error)
- func ComposePageLayoutRbacReferences(namespaceID string, pageID string, pageLayout string) (res *Ref, pp []*Ref, err error)
- func ComposePageRbacReferences(namespaceID string, page string) (res *Ref, pp []*Ref, err error)
- func ComposeRecordRbacReferences(namespaceID string, moduleID string, record string) (res *Ref, pp []*Ref, err error)
- func FederationExposedModuleRbacReferences(nodeID string, exposedModule string) (res *Ref, pp []*Ref, err error)
- func FederationNodeRbacReferences(node string) (res *Ref, pp []*Ref, err error)
- func FederationSharedModuleRbacReferences(nodeID string, sharedModule string) (res *Ref, pp []*Ref, err error)
- func Initialized() bool
- func MergeRefs(a map[string]Ref, bb ...map[string]Ref) (c map[string]Ref)
- func NodesByResourceType(nn ...*Node) (out map[string]NodeSet)
- func ParseRule(res string) (string, *Ref, []*Ref, error)
- func SetDecoderSources(nn NodeSet, dd ...Provider)
- func SetGlobal(n *Service)
- func SplitResourceIdentifier(ref string) (out map[string]Ref)
- func SystemApigwRouteRbacReferences(apigwRoute string) (res *Ref, pp []*Ref, err error)
- func SystemApplicationRbacReferences(application string) (res *Ref, pp []*Ref, err error)
- func SystemAuthClientRbacReferences(authClient string) (res *Ref, pp []*Ref, err error)
- func SystemDalConnectionRbacReferences(dalConnection string) (res *Ref, pp []*Ref, err error)
- func SystemDataPrivacyRequestRbacReferences(dataPrivacyRequest string) (res *Ref, pp []*Ref, err error)
- func SystemQueueRbacReferences(queue string) (res *Ref, pp []*Ref, err error)
- func SystemReportRbacReferences(report string) (res *Ref, pp []*Ref, err error)
- func SystemRoleRbacReferences(role string) (res *Ref, pp []*Ref, err error)
- func SystemTemplateRbacReferences(template string) (res *Ref, pp []*Ref, err error)
- func SystemUserRbacReferences(user string) (res *Ref, pp []*Ref, err error)
- type Datasource
- type DatasourceMapping
- type DecodeParams
- type Decoder
- type DecoderConfig
- type DepGraph
- func (g DepGraph) Children(n *Node) (out NodeSet)
- func (g DepGraph) ChildrenForResourceType(n *Node, rt string) (out NodeSet)
- func (g DepGraph) MissingRefs() (out []map[string]Ref)
- func (g DepGraph) NodeForRef(ref Ref) (out *Node)
- func (g DepGraph) ParentForRT(n *Node, rt string) (out NodeSet)
- func (g DepGraph) ParentForRef(n *Node, ref Ref) (out *Node)
- func (g DepGraph) Roots() (out NodeSet)
- type EncodeParams
- type Encoder
- type EncoderConfig
- type EnvoyConfig
- type Evaluated
- type FieldMapping
- type Identifiers
- func (ii Identifiers) Add(vv ...any) (out Identifiers)
- func (ii Identifiers) FriendlyIdentifier() (out string)
- func (aa Identifiers) HasIntersection(bb Identifiers) bool
- func (ii Identifiers) Idents() (ints []uint64, rest []string)
- func (ii Identifiers) IdentsAsStrings() (ids, rest []string)
- func (aa Identifiers) Intersection(bb Identifiers) (out []string)
- func (aa Identifiers) Merge(bb Identifiers) (cc Identifiers)
- type MapEntry
- type Node
- type NodeSet
- func NodesForResourceType(rt string, nn ...*Node) (out NodeSet)
- func OmitPlaceholderNodes(nn ...*Node) (out NodeSet)
- func RBACRulesForNodes(rr rbac.RuleSet, nn ...*Node) (rules NodeSet, err error)
- func ResourceTranslationsForNodes(tt types.ResourceTranslationSet, nn ...*Node) (translations NodeSet, err error)
- type PrepareEncoder
- type Preparer
- type Provider
- type Ref
- type ResourceFilter
- type Scope
- type Service
- func (svc *Service) AddDecoder(t decodeType, dd ...Decoder)
- func (svc *Service) AddEncoder(t encodeType, ee ...Encoder)
- func (svc *Service) AddPreparer(t encodeType, pp ...Preparer)
- func (svc *Service) Bake(ctx context.Context, p EncodeParams, providers []Provider, nodes ...*Node) (gg *DepGraph, err error)
- func (svc *Service) Decode(ctx context.Context, p DecodeParams) (nodes NodeSet, providers []Provider, err error)
- func (svc *Service) Encode(ctx context.Context, p EncodeParams, dg *DepGraph) (err error)
- type Traverser
Constants ¶
const ( OnConflictDefault mergeAlg = iota OnConflictReplace OnConflictSkip OnConflictPanic DecodeTypeURI decodeType = "uri" DecodeTypeIO decodeType = "io" DecodeTypeStore decodeType = "store" EncodeTypeURI encodeType = "uri" EncodeTypeStore encodeType = "store" EncodeTypeIo encodeType = "io" )
Variables ¶
This section is empty.
Functions ¶
func AutomationWorkflowRbacReferences ¶
AutomationWorkflowRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func CastMergeAlg ¶
func CastMergeAlg(v string) (mergeAlg mergeAlg)
func ComposeChartRbacReferences ¶
ComposeChartRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func ComposeModuleFieldRbacReferences ¶
func ComposeModuleFieldRbacReferences(namespaceID string, moduleID string, moduleField string) (res *Ref, pp []*Ref, err error)
ComposeModuleFieldRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func ComposeModuleRbacReferences ¶
func ComposeModuleRbacReferences(namespaceID string, module string) (res *Ref, pp []*Ref, err error)
ComposeModuleRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func ComposeNamespaceRbacReferences ¶
ComposeNamespaceRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func ComposePageLayoutRbacReferences ¶
func ComposePageLayoutRbacReferences(namespaceID string, pageID string, pageLayout string) (res *Ref, pp []*Ref, err error)
ComposePageLayoutRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func ComposePageRbacReferences ¶
ComposePageRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func ComposeRecordRbacReferences ¶
func ComposeRecordRbacReferences(namespaceID string, moduleID string, record string) (res *Ref, pp []*Ref, err error)
ComposeRecordRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func FederationExposedModuleRbacReferences ¶
func FederationExposedModuleRbacReferences(nodeID string, exposedModule string) (res *Ref, pp []*Ref, err error)
FederationExposedModuleRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func FederationNodeRbacReferences ¶
FederationNodeRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func FederationSharedModuleRbacReferences ¶
func FederationSharedModuleRbacReferences(nodeID string, sharedModule string) (res *Ref, pp []*Ref, err error)
FederationSharedModuleRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func Initialized ¶
func Initialized() bool
func NodesByResourceType ¶
NodesByResourceType returns Nodes grouped by their resource type
func ParseRule ¶
Parse generates resource setting logic for each resource
Resources with "envoy: false" are skipped
This function is auto-generated
func SetDecoderSources ¶
func SplitResourceIdentifier ¶
SplitResourceIdentifier takes an identifier string and splices it into path identifiers as defined by the resource
func SystemApigwRouteRbacReferences ¶
SystemApigwRouteRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemApplicationRbacReferences ¶
SystemApplicationRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemAuthClientRbacReferences ¶
SystemAuthClientRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemDalConnectionRbacReferences ¶
SystemDalConnectionRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemDataPrivacyRequestRbacReferences ¶
func SystemDataPrivacyRequestRbacReferences(dataPrivacyRequest string) (res *Ref, pp []*Ref, err error)
SystemDataPrivacyRequestRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemQueueRbacReferences ¶
SystemQueueRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemReportRbacReferences ¶
SystemReportRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemRoleRbacReferences ¶
SystemRoleRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
func SystemTemplateRbacReferences ¶
SystemTemplateRbacReferences generates RBAC references
Resources with "envoy: false" are skipped
This function is auto-generated
Types ¶
type Datasource ¶
type DatasourceMapping ¶
type DatasourceMapping struct { SourceIdent string `yaml:"source"` KeyField []string `yaml:"key"` References map[string]string Scope map[string]string // Defaultable indicates wether the mapping should keep the values where // the ident is not explicitly mapped. // // When true, the value is assigned to the given identifier. Defaultable bool `yaml:"defaultable"` Mapping FieldMapping }
type DecodeParams ¶
type DecodeParams struct { Type decodeType Params map[string]any Config DecoderConfig Filter map[string]ResourceFilter }
type Decoder ¶
type Decoder interface { // Decode returns a set of Nodes extracted based on the provided definition Decode(ctx context.Context, p DecodeParams) (out NodeSet, err error) }
type DecoderConfig ¶
type DecoderConfig struct{}
type DepGraph ¶
type DepGraph struct {
// contains filtered or unexported fields
}
DepGraph provides a collection of optionally connected subgraphs
Each subgraph is dedicated for a specific node scope. A subgraph with scoped nodes may be connected to the subgraph with no defined scope.
func BuildDepGraph ¶
BuildDepGraph constructs a dependency graph from the provided nodes
We firstly group the nodes by scope, then build a subgraph for each scope, and lastly merge the subgraphs into a single graph.
func (DepGraph) ChildrenForResourceType ¶
ChildrenForResourceType returns child nodes of n which match the resource type
func (DepGraph) MissingRefs ¶
MissingRegs returns a slice of all refs that are requested but not found in the graph
func (DepGraph) NodeForRef ¶
func (DepGraph) ParentForRT ¶
ParentForRT returns a set of parent nodes matching the resource type
func (DepGraph) ParentForRef ¶
ParentForRef returns a parent node of n which matches ref (nil if none)
type EncodeParams ¶
type EncodeParams struct { Type encodeType Params map[string]any Envoy EnvoyConfig Encoder EncoderConfig // @note these are only used by records since v1 did just that // @todo make these more expanded DeferOk func() DeferNok func(error) error Defer func() }
type EncoderConfig ¶
type EnvoyConfig ¶
type FieldMapping ¶
type FieldMapping struct { // @note This had to be like so to simplify decoding Map map[string]MapEntry }
func (*FieldMapping) UnmarshalYAML ¶
func (d *FieldMapping) UnmarshalYAML(n *yaml.Node) (err error)
UnmarshalYAML is used to get the yaml parsed into a series of nodes so we can easily pass it down
type Identifiers ¶
func MakeIdentifiers ¶
func MakeIdentifiers(ii ...any) (out Identifiers)
MakeIdentifiers initializes an Identifiers instance from the given slice
func MergeIdents ¶
func MergeIdents(a, b Identifiers) (cc Identifiers)
MergeIdents merges the two identifiers and returns a new one
func (Identifiers) Add ¶
func (ii Identifiers) Add(vv ...any) (out Identifiers)
Add adds the given values to the identifier
func (Identifiers) FriendlyIdentifier ¶
func (ii Identifiers) FriendlyIdentifier() (out string)
FriendlyIdentifier returns the best available identifier
If any non-ID identifiers are available, it uses the first one. If no non-ID identifiers are available, it returns the first ID.
func (Identifiers) HasIntersection ¶
func (aa Identifiers) HasIntersection(bb Identifiers) bool
HasIntersection returns true if the two identifiers define an intersection
func (Identifiers) Idents ¶
func (ii Identifiers) Idents() (ints []uint64, rest []string)
Idents returns a slice of numeric and text identifiers
func (Identifiers) IdentsAsStrings ¶
func (ii Identifiers) IdentsAsStrings() (ids, rest []string)
func (Identifiers) Intersection ¶
func (aa Identifiers) Intersection(bb Identifiers) (out []string)
Intersection returns a slice of identifiers which are in an intersection
func (Identifiers) Merge ¶
func (aa Identifiers) Merge(bb Identifiers) (cc Identifiers)
Merge merges the two identifiers and returns a new one @todo deprecate this; use MergeIdents instead
type Node ¶
type Node struct { Resource resource Datasource Datasource ResourceType string Identifiers Identifiers References map[string]Ref Scope Scope // Placeholders are resources which were added to help resolve missing deps Placeholder bool Config EnvoyConfig Evaluated Evaluated }
Node is a wrapper around a Corteza resource for use within Envoy
func NodeForRef ¶
NodeForRef returns the Node that matches the given ref
type NodeSet ¶
type NodeSet []*Node
func NodesForResourceType ¶
NodesForResourceType returns which belong to the given resource type
func OmitPlaceholderNodes ¶
func RBACRulesForNodes ¶
func ResourceTranslationsForNodes ¶
func ResourceTranslationsForNodes(tt types.ResourceTranslationSet, nn ...*Node) (translations NodeSet, err error)
type PrepareEncoder ¶
type Ref ¶
type Ref struct { ResourceType string Identifiers Identifiers Scope Scope // @todo consider replacing with something that indicates // it can't be fetched from the DB Optional bool }
Ref defines a reference to a different resource
The reference only holds if all three parts match -- the resource type, there is an intersection between the identifiers, and the scope matches.
func (Ref) ResourceFilter ¶
func (r Ref) ResourceFilter() (out map[string]ResourceFilter)
ResourceFilter returns a filter which would match the referenced resource
type ResourceFilter ¶
type ResourceFilter struct { Identifiers Identifiers Refs map[string]Ref Limit uint Scope Scope }
type Scope ¶
type Scope struct { ResourceType string Identifiers Identifiers }
Scope lets us group nodes based on some common context
Scope is primarily used to scope low-code applications to denote to what namespace a specific module reference belongs to. In the previous version this was referred to as reference constraints; This is the same but different.
When constructing dependency graphs, nodes with the same scope are grouped together. Nodes from the same scope can reference each other. Nodes from a defined scope can reference nodes from an undefined scope, but not the other way around.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AddDecoder ¶
func (*Service) AddEncoder ¶
func (*Service) AddPreparer ¶
type Traverser ¶
type Traverser interface { // ParentForRef returns the parent of the provided node which matches the ref // // If no parent is found, nil is returned. ParentForRef(*Node, Ref) *Node // ParentForRT returns a set of parent nodes matching the resource type ParentForRT(*Node, string) NodeSet // ChildrenForResourceType returns the children of the provided node which // match the provided resource type ChildrenForResourceType(*Node, string) NodeSet // Children returns all of the children of the provided node Children(*Node) NodeSet // NodeForRef returns the node which matches the provided ref NodeForRef(Ref) *Node }
Traverser provides a structure which can be used to traverse the node's deps