Documentation ¶
Index ¶
- Constants
- Variables
- func GetBlockTypeNames() []string
- func GetContext(ctx context.Context) string
- func ParseReferenceString(inputString string) string
- type Backend
- func (r *Backend) GetAttributes() *KformBlockAttributes
- func (r *Backend) GetBlockName() string
- func (r *Backend) GetBlockType() string
- func (r *Backend) GetConfig() any
- func (r *Backend) GetContext(n string) string
- func (r *Backend) GetDefault() []any
- func (r *Backend) GetDependencies() map[string]string
- func (r *Backend) GetFileName() string
- func (r *Backend) GetInputParams() map[string]any
- func (r *Backend) GetLevel() int
- func (r *Backend) GetModDependencies() map[string]string
- func (r *Backend) GetModuleName() string
- func (r *Backend) GetValue() any
- func (r *Backend) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type Block
- type BlockContextKey
- type BlockInitializer
- type BlockType
- type Context
- type CtxKey
- type DependencyBlock
- type Initializer
- type Input
- func (r *Input) GetAttributes() *KformBlockAttributes
- func (r *Input) GetBlockName() string
- func (r *Input) GetBlockType() string
- func (r *Input) GetConfig() any
- func (r *Input) GetContext(n string) string
- func (r *Input) GetDefault() []any
- func (r *Input) GetDependencies() map[string]string
- func (r *Input) GetFileName() string
- func (r *Input) GetInputParams() map[string]any
- func (r *Input) GetLevel() int
- func (r *Input) GetModDependencies() map[string]string
- func (r *Input) GetModuleName() string
- func (r *Input) GetValue() any
- func (r *Input) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type Kform
- type KformBlock
- type KformBlockAttributes
- type KformBlockContext
- type KformBlockSchema
- type Local
- func (r *Local) GetAttributes() *KformBlockAttributes
- func (r *Local) GetBlockName() string
- func (r *Local) GetBlockType() string
- func (r *Local) GetConfig() any
- func (r *Local) GetContext(n string) string
- func (r *Local) GetDefault() []any
- func (r *Local) GetDependencies() map[string]string
- func (r *Local) GetFileName() string
- func (r *Local) GetInputParams() map[string]any
- func (r *Local) GetLevel() int
- func (r *Local) GetModDependencies() map[string]string
- func (r *Local) GetModuleName() string
- func (r *Local) GetValue() any
- func (r *Local) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type MetaArgument
- type Module
- func (r *Module) GenerateDAG(ctx context.Context, provider bool, unrefed []string)
- func (r *Module) GetModuleDependencies(ctx context.Context) map[string]string
- func (r *Module) GetProviderRequirements(ctx context.Context) map[cache.NSN]kformpkgmetav1alpha1.Provider
- func (r *Module) GetProvidersFromResources(ctx context.Context) sets.Set[cache.NSN]
- func (r *Module) ResolveDAGDependencies(ctx context.Context)
- func (r *Module) ResolveResource2ProviderConfig(ctx context.Context)
- func (r *Module) ValidateChildProviderConfigs(ctx context.Context)
- type ModuleCall
- func (r *ModuleCall) GetAttributes() *KformBlockAttributes
- func (r *ModuleCall) GetBlockName() string
- func (r *ModuleCall) GetBlockType() string
- func (r *ModuleCall) GetConfig() any
- func (r *ModuleCall) GetContext(n string) string
- func (r *ModuleCall) GetDefault() []any
- func (r *ModuleCall) GetDependencies() map[string]string
- func (r *ModuleCall) GetFileName() string
- func (r *ModuleCall) GetInputParams() map[string]any
- func (r *ModuleCall) GetLevel() int
- func (r *ModuleCall) GetModDependencies() map[string]string
- func (r *ModuleCall) GetModuleName() string
- func (r *ModuleCall) GetProviders() map[string]string
- func (r *ModuleCall) GetValue() any
- func (r *ModuleCall) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type ModuleKind
- type Output
- func (r *Output) GetAttributes() *KformBlockAttributes
- func (r *Output) GetBlockName() string
- func (r *Output) GetBlockType() string
- func (r *Output) GetConfig() any
- func (r *Output) GetContext(n string) string
- func (r *Output) GetDefault() []any
- func (r *Output) GetDependencies() map[string]string
- func (r *Output) GetFileName() string
- func (r *Output) GetInputParams() map[string]any
- func (r *Output) GetLevel() int
- func (r *Output) GetModDependencies() map[string]string
- func (r *Output) GetModuleName() string
- func (r *Output) GetValue() any
- func (r *Output) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type Provider
- type ProviderConfig
- func (r *ProviderConfig) GetAttributes() *KformBlockAttributes
- func (r *ProviderConfig) GetBlockName() string
- func (r *ProviderConfig) GetBlockType() string
- func (r *ProviderConfig) GetConfig() any
- func (r *ProviderConfig) GetContext(n string) string
- func (r *ProviderConfig) GetDefault() []any
- func (r *ProviderConfig) GetDependencies() map[string]string
- func (r *ProviderConfig) GetFileName() string
- func (r *ProviderConfig) GetInputParams() map[string]any
- func (r *ProviderConfig) GetLevel() int
- func (r *ProviderConfig) GetModDependencies() map[string]string
- func (r *ProviderConfig) GetModuleName() string
- func (r *ProviderConfig) GetName() string
- func (r *ProviderConfig) GetValue() any
- func (r *ProviderConfig) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type Renderer
- type Resource
- func (r *Resource) GetAttributes() *KformBlockAttributes
- func (r *Resource) GetBlockName() string
- func (r *Resource) GetBlockType() string
- func (r *Resource) GetConfig() any
- func (r *Resource) GetContext(n string) string
- func (r *Resource) GetDefault() []any
- func (r *Resource) GetDependencies() map[string]string
- func (r *Resource) GetFileName() string
- func (r *Resource) GetInputParams() map[string]any
- func (r *Resource) GetLevel() int
- func (r *Resource) GetModDependencies() map[string]string
- func (r *Resource) GetModuleName() string
- func (r *Resource) GetProvider() string
- func (r *Resource) GetValue() any
- func (r *Resource) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
- type VertexContext
Constants ¶
View Source
const ( ResourceType = "resourceType" ResourceID = "resourceID" )
View Source
const ( LoopKeyCountIndex = "count.index" LoopKeyForEachKey = "each.key" LoopKeyForEachVal = "each.value" )
Variables ¶
View Source
var BlockTypes = map[BlockType]BlockInitializer{
BlockTypeBackend: newBackend,
BlockTypeProvider: newProvider,
BlockTypeModule: newModule,
BlockTypeInput: newInput,
BlockTypeOutput: newOutput,
BlockTypeLocal: newLocal,
BlockTypeResource: newResource,
BlockTypeData: newResource,
BlockTypeList: newResource,
}
View Source
var LocalVars = map[string]struct{}{ LoopKeyCountIndex: {}, LoopKeyForEachKey: {}, LoopKeyForEachVal: {}, }
View Source
var ResourceBlockTypes = []string{string(BlockTypeResource), string(BlockTypeData), string(BlockTypeList)}
Functions ¶
func GetBlockTypeNames ¶
func GetBlockTypeNames() []string
func GetContext ¶
func ParseReferenceString ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func (*Backend) GetAttributes ¶
func (r *Backend) GetAttributes() *KformBlockAttributes
func (*Backend) GetBlockName ¶
func (*Backend) GetBlockType ¶
func (r *Backend) GetBlockType() string
func (*Backend) GetContext ¶
func (*Backend) GetDefault ¶
func (r *Backend) GetDefault() []any
func (*Backend) GetDependencies ¶
func (*Backend) GetFileName ¶
func (r *Backend) GetFileName() string
func (*Backend) GetInputParams ¶
func (*Backend) GetModDependencies ¶
func (*Backend) GetModuleName ¶
func (r *Backend) GetModuleName() string
func (*Backend) ProcessBlock ¶
func (r *Backend) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type Block ¶
type BlockContextKey ¶
type BlockContextKey string
const ( BlockContextKeyUnknown BlockContextKey = "unknown" BlockContextKeyAttributes BlockContextKey = "attributes" //BlockContextKeyInstances BlockContextKey = "instances" BlockContextKeyDefault BlockContextKey = "default" BlockContextKeyInputParams BlockContextKey = "inputParams" BlockContextKeyConfig BlockContextKey = "config" BlockContextKeyValue BlockContextKey = "value" )
type BlockType ¶
type BlockType string
const ( BlockTypeUnknown BlockType = "unknown" BlockTypeBackend BlockType = "backend" BlockTypeRequiredProviders BlockType = "requiredProviders" BlockTypeProvider BlockType = "provider" BlockTypeModule BlockType = "module" BlockTypeInput BlockType = "input" BlockTypeOutput BlockType = "output" BlockTypeLocal BlockType = "local" BlockTypeResource BlockType = "resource" BlockTypeData BlockType = "data" BlockTypeList BlockType = "list" BlockTypeRoot BlockType = dag.Root )
func GetBlockType ¶
type CtxKey ¶
type CtxKey string
const ( //CtxExecConfig CtxKey = "execConfig" CtxKeyRecorder CtxKey = "recorder" CtxKeyModule CtxKey = "module" CtxKeyModuleName CtxKey = "moduleName" CtxKeyModuleKind CtxKey = "moduleKind" CtxKeyFileName CtxKey = "fileName" CtxKeyLevel CtxKey = "level" CtxKeyBlockType CtxKey = "blockType" CtxKeyVarName CtxKey = "varName" CtxKeyVarType CtxKey = "varType" CtxKeyKformContext CtxKey = "kformContext" )
type DependencyBlock ¶
type DependencyBlock interface { GetDependencies() map[string]string GetModDependencies() map[string]string GetContext(string) string GetAttributes() *KformBlockAttributes }
interface signature
type Initializer ¶
func ProviderInitializer ¶
func ProviderInitializer(execPath string) Initializer
ProviderInitializer produces a provider factory that runs up the executable file in the given path and uses go-plugin to implement Provider Interface against it.
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
func (*Input) GetAttributes ¶
func (r *Input) GetAttributes() *KformBlockAttributes
func (*Input) GetBlockName ¶
func (*Input) GetBlockType ¶
func (r *Input) GetBlockType() string
func (*Input) GetContext ¶
func (*Input) GetDefault ¶
func (r *Input) GetDefault() []any
func (*Input) GetDependencies ¶
func (*Input) GetFileName ¶
func (r *Input) GetFileName() string
func (*Input) GetInputParams ¶
func (*Input) GetModDependencies ¶
func (*Input) GetModuleName ¶
func (r *Input) GetModuleName() string
func (*Input) ProcessBlock ¶
func (r *Input) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type Kform ¶
type Kform struct {
Blocks []KformBlock `json:"spec" yaml:"spec"`
}
type KformBlock ¶
type KformBlock struct { KformBlockContext `json:",inline" yaml:",inline"` NestedBlock map[string]KformBlock `json:",inline" yaml:",inline"` }
func GetNextBlock ¶
func GetNextBlock(ctx context.Context, block *KformBlock) (string, *KformBlock, error)
type KformBlockAttributes ¶
type KformBlockAttributes struct { Schema *KformBlockSchema `json:"schema,omitempty" yaml:"schema,omitempty"` Source *string `json:"source,omitempty" yaml:"source,omitempty"` Alias *string `json:"alias,omitempty" yaml:"alias,omitempty"` // should be an int actually Count *string `json:"count,omitempty" yaml:"count,omitempty"` ForEach *string `json:"forEach,omitempty" yaml:"forEach,omitempty"` Provider *string `json:"provider,omitempty" yaml:"provider,omitempty"` Providers map[string]string `json:"providers,omitempty" yaml:"providers,omitempty"` DependsOn *string `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` Sensitive *bool `json:"sensitive,omitempty" yaml:"sensitive,omitempty"` Validation *string `json:"validation,omitempty" yaml:"validation,omitempty"` Lifecycle *string `json:"lifecycle,omitempty" yaml:"lifecycle,omitempty"` PreCondition *string `json:"preCondition,omitempty" yaml:"preCondition,omitempty"` PostCondition *string `json:"postCondition,omitempty" yaml:"postCondition,omitempty"` Provisioner *string `json:"provisioner,omitempty" yaml:"provisioner,omitempty"` Connection *string `json:"connection,omitempty" yaml:"connection,omitempty"` Hostname *string `json:"hostname,omitempty" yaml:"hostname,omitempty"` Organization *string `json:"organization,omitempty" yaml:"organization,omitempty"` Workspaces map[string]string `json:"workspaces,omitempty" yaml:"workspaces,omitempty"` }
func (*KformBlockAttributes) GetSource ¶
func (r *KformBlockAttributes) GetSource() string
type KformBlockContext ¶
type KformBlockContext struct { Attributes *KformBlockAttributes `json:"attributes,omitempty" yaml:"attributes,omitempty"` //Instances []any `json:"instances,omitempty" yaml:"instances,omitempty"` Default []any `json:"default,omitempty" yaml:"default,omitempty"` // NOTE: had to change to inputParams as input is a blocktype name InputParams map[string]any `json:"inputParams,omitempty" yaml:"inputParams,omitempty"` Config any `json:"config,omitempty" yaml:"config,omitempty"` Value any `json:"value,omitempty" yaml:"value,omitempty"` }
type KformBlockSchema ¶
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
func (*Local) GetAttributes ¶
func (r *Local) GetAttributes() *KformBlockAttributes
func (*Local) GetBlockName ¶
func (*Local) GetBlockType ¶
func (r *Local) GetBlockType() string
func (*Local) GetContext ¶
func (*Local) GetDefault ¶
func (r *Local) GetDefault() []any
func (*Local) GetDependencies ¶
func (*Local) GetFileName ¶
func (r *Local) GetFileName() string
func (*Local) GetInputParams ¶
func (*Local) GetModDependencies ¶
func (*Local) GetModuleName ¶
func (r *Local) GetModuleName() string
func (*Local) ProcessBlock ¶
func (r *Local) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type MetaArgument ¶
type MetaArgument string
const ( MetaArgumentUnknown MetaArgument = "unknown" MetaArgumentSchema MetaArgument = "schema" MetaArgumentSource MetaArgument = "source" //MetaArgumentAlias MetaArgument = "alias" //MetaArgumentAliases MetaArgument = "aliases" MetaArgumentCount MetaArgument = "count" MetaArgumentForEach MetaArgument = "forEach" MetaArgumentProvider MetaArgument = "provider" MetaArgumentProviders MetaArgument = "providers" MetaArgumentDependsOn MetaArgument = "dependsOn" MetaArgumentLifecycle MetaArgument = "lifecycle" MetaArgumentPrecondition MetaArgument = "precondition" MetaArgumentPostcondition MetaArgument = "postcondition" MetaArgumentConnection MetaArgument = "connection" MetaArgumentProvisioner MetaArgument = "provisioner" MetaArgumentDescription MetaArgument = "description" MetaArgumentSensitive MetaArgument = "sensitive" MetaArgumentValidation MetaArgument = "validation" MetaArgumentHostname MetaArgument = "hostname" MetaArgumentOrganization MetaArgument = "organization" MetaArgumentWorkspaces MetaArgument = "workspaces" )
type Module ¶
type Module struct { NSN cache.NSN Kind ModuleKind SourceDir string Version string Backend *Backend ProviderRequirements cache.Cache[kformpkgmetav1alpha1.Provider] ProviderConfigs cache.Cache[*ProviderConfig] Inputs cache.Cache[*Input] Locals cache.Cache[*Local] Outputs cache.Cache[*Output] Resources cache.Cache[*Resource] ModuleCalls cache.Cache[*ModuleCall] DAG dag.DAG[*VertexContext] ProviderDAG dag.DAG[*VertexContext] // contains filtered or unexported fields }
func NewModule ¶
func NewModule(nsn cache.NSN, kind ModuleKind, recorder recorder.Recorder[diag.Diagnostic]) *Module
func (*Module) GenerateDAG ¶
func (*Module) GetModuleDependencies ¶
func (*Module) GetProviderRequirements ¶
func (*Module) GetProvidersFromResources ¶
func (*Module) ResolveDAGDependencies ¶
func (*Module) ResolveResource2ProviderConfig ¶
func (*Module) ValidateChildProviderConfigs ¶
type ModuleCall ¶
type ModuleCall struct {
// contains filtered or unexported fields
}
func (*ModuleCall) GetAttributes ¶
func (r *ModuleCall) GetAttributes() *KformBlockAttributes
func (*ModuleCall) GetBlockName ¶
func (r *ModuleCall) GetBlockName() string
func (*ModuleCall) GetBlockType ¶
func (r *ModuleCall) GetBlockType() string
func (*ModuleCall) GetContext ¶
func (*ModuleCall) GetDefault ¶
func (r *ModuleCall) GetDefault() []any
func (*ModuleCall) GetDependencies ¶
func (*ModuleCall) GetFileName ¶
func (r *ModuleCall) GetFileName() string
func (*ModuleCall) GetInputParams ¶
func (*ModuleCall) GetModDependencies ¶
func (*ModuleCall) GetModuleName ¶
func (r *ModuleCall) GetModuleName() string
func (*ModuleCall) GetProviders ¶
func (r *ModuleCall) GetProviders() map[string]string
func (*ModuleCall) ProcessBlock ¶
func (r *ModuleCall) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type ModuleKind ¶
type ModuleKind = string
const ( ModuleKindRoot ModuleKind = "root" ModuleKindChild ModuleKind = "child" )
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
func (*Output) GetAttributes ¶
func (r *Output) GetAttributes() *KformBlockAttributes
func (*Output) GetBlockName ¶
func (*Output) GetBlockType ¶
func (r *Output) GetBlockType() string
func (*Output) GetContext ¶
func (*Output) GetDefault ¶
func (r *Output) GetDefault() []any
func (*Output) GetDependencies ¶
func (*Output) GetFileName ¶
func (r *Output) GetFileName() string
func (*Output) GetInputParams ¶
func (*Output) GetModDependencies ¶
func (*Output) GetModuleName ¶
func (r *Output) GetModuleName() string
func (*Output) ProcessBlock ¶
func (r *Output) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type Provider ¶
type ProviderConfig ¶
type ProviderConfig struct {
// contains filtered or unexported fields
}
func (*ProviderConfig) GetAttributes ¶
func (r *ProviderConfig) GetAttributes() *KformBlockAttributes
func (*ProviderConfig) GetBlockName ¶
func (r *ProviderConfig) GetBlockName() string
func (*ProviderConfig) GetBlockType ¶
func (r *ProviderConfig) GetBlockType() string
func (*ProviderConfig) GetContext ¶
func (*ProviderConfig) GetDefault ¶
func (r *ProviderConfig) GetDefault() []any
func (*ProviderConfig) GetDependencies ¶
func (*ProviderConfig) GetFileName ¶
func (r *ProviderConfig) GetFileName() string
func (*ProviderConfig) GetInputParams ¶
func (*ProviderConfig) GetModDependencies ¶
func (*ProviderConfig) GetModuleName ¶
func (r *ProviderConfig) GetModuleName() string
func (*ProviderConfig) GetName ¶
func (r *ProviderConfig) GetName() string
func (*ProviderConfig) ProcessBlock ¶
func (r *ProviderConfig) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type Renderer ¶
type Renderer interface { GatherDependencies(ctx context.Context, x any) error GetDependencies() map[string]string GetModuleOutputDependencies() map[string]string }
func NewRenderer ¶
func NewRenderer() Renderer
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) GetAttributes ¶
func (r *Resource) GetAttributes() *KformBlockAttributes
func (*Resource) GetBlockName ¶
func (*Resource) GetBlockType ¶
func (r *Resource) GetBlockType() string
func (*Resource) GetContext ¶
func (*Resource) GetDefault ¶
func (r *Resource) GetDefault() []any
func (*Resource) GetDependencies ¶
func (*Resource) GetFileName ¶
func (r *Resource) GetFileName() string
func (*Resource) GetInputParams ¶
func (*Resource) GetModDependencies ¶
func (*Resource) GetModuleName ¶
func (r *Resource) GetModuleName() string
func (*Resource) GetProvider ¶
func (*Resource) ProcessBlock ¶
func (r *Resource) ProcessBlock(ctx context.Context, block *KformBlock) context.Context
type VertexContext ¶
type VertexContext struct { // FileName and Module provide context in which this FileName string ModuleName string // BlockType determines which function we need to execute BlockType BlockType // BlockName has syntx <namespace>.<name> BlockName string // schema relevant for this blockType GVK schema.GroupVersionKind // provides the contextual data BlockContext KformBlockContext Dependencies map[string]string ModDependencies map[string]string // only relevaant for blocktype resource and data Provider string // only relevant for blocktype module // can be either a regular DAG or a provider DAG DAG dag.DAG[*VertexContext] }
func (*VertexContext) AddDAG ¶
func (r *VertexContext) AddDAG(d dag.DAG[*VertexContext])
func (*VertexContext) GetBlockDependencies ¶
func (r *VertexContext) GetBlockDependencies() map[string]string
func (*VertexContext) GetDependencies ¶
func (r *VertexContext) GetDependencies() map[string]string
Source Files ¶
- api_interfaces.go
- api_types.go
- block_types.go
- context.go
- module.go
- process_block_backend.go
- process_block_input.go
- process_block_local.go
- process_block_module.go
- process_block_output.go
- process_block_provider.go
- process_block_resource.go
- process_blocktype_deps.go
- process_blocktype_generic.go
- provider.go
- vertex_context.go
Click to show internal directories.
Click to hide internal directories.