Documentation
¶
Index ¶
- Constants
- func CapitalizeFirstLetterOfWord(word string) string
- func CurrentWorkingDir() string
- func IsAnyFormatNode(value cty.Value) bool
- func IsFormatConstraintNode(value cty.Value) bool
- func IsFormatKeyValNode(value cty.Value) bool
- func MergeMaps[T any](mapOne map[string]T, mapTwo map[string]T) map[string]T
- func PackageName(source string) string
- func Ptr[T any](t T) *T
- func SchemaFormatSpecType(schema cty.Value) cty.Type
- func ValidateValueAgainstSpec(val cty.Value, spec Spec, keyPath string) []error
- type DefaultOsManager
- type DefaultPluginManager
- func (pm *DefaultPluginManager) KillAllPlugins()
- func (pm *DefaultPluginManager) KillPlugin(name string) error
- func (pm *DefaultPluginManager) LoadPlugin(provider RequiredProviderBlock) error
- func (pm *DefaultPluginManager) LoadedPlugins() []string
- func (pm *DefaultPluginManager) PluginClient(name string) (*plugin.Client, error)
- func (pm *DefaultPluginManager) ProviderInstance(name string) (sbsdk.Provider, error)
- type ListSpec
- type MapSpec
- type ObjectSpec
- type OsManager
- type PluginConfig
- type PluginManager
- type PrimitiveSpec
- type ProviderBlock
- type RequiredProviderBlock
- type RootSwitchboardConfig
- type SchemaBlock
- type Spec
- type SwitchboardBlock
- type VariableBlock
- type VariantBlock
Constants ¶
const ( STRING = "string" NUMBER = "number" BOOLEAN = "bool" LIST = "list" OBJECT = "object" FORMAT_TYPE = "format_type" FORMAT_REQUIRED = "format_required" FORMAT_CHILDREN = "format_children" FORMAT_KEY = "format_key" )
Variables ¶
This section is empty.
Functions ¶
func CurrentWorkingDir ¶
func CurrentWorkingDir() string
CurrentWorkingDir returns the value of the working directory that the CLI is executed in.
func IsAnyFormatNode ¶
IsAnyFormatNode is a simple check to make sure a particular value conforms to one of the format node structures. This function does not deep check any nested children, just the top level.
func IsFormatConstraintNode ¶
IsFormatConstraintNode checks to see whether a value conforms to the structure of a constraint node, which will/should be true for all leaf nodes in a value object
func IsFormatKeyValNode ¶
IsFormatKeyValNode checks to see whether a value conforms to the structure of a key/val node where all values conform to the constraint node type. A KeyValNode should exist at the top level of the format value, and in some FORMAT_CHILDREN values (those that are "nested" objects)
func PackageName ¶
func SchemaFormatSpecType ¶
SchemaFormatSpecType is a recursive function that returns the full cty.Type from the root of the provided schema. All leafs will be structured to what schematic returns.
Types ¶
type DefaultOsManager ¶
type DefaultOsManager struct{}
func (*DefaultOsManager) CreateDirectoryIfNotExists ¶
func (d *DefaultOsManager) CreateDirectoryIfNotExists(path string) error
func (*DefaultOsManager) GetCurrentWorkingDirectory ¶
func (d *DefaultOsManager) GetCurrentWorkingDirectory() string
type DefaultPluginManager ¶
type DefaultPluginManager struct {
// contains filtered or unexported fields
}
func (*DefaultPluginManager) KillAllPlugins ¶
func (pm *DefaultPluginManager) KillAllPlugins()
func (*DefaultPluginManager) KillPlugin ¶
func (pm *DefaultPluginManager) KillPlugin(name string) error
func (*DefaultPluginManager) LoadPlugin ¶
func (pm *DefaultPluginManager) LoadPlugin(provider RequiredProviderBlock) error
func (*DefaultPluginManager) LoadedPlugins ¶
func (pm *DefaultPluginManager) LoadedPlugins() []string
func (*DefaultPluginManager) PluginClient ¶
func (pm *DefaultPluginManager) PluginClient(name string) (*plugin.Client, error)
func (*DefaultPluginManager) ProviderInstance ¶
func (pm *DefaultPluginManager) ProviderInstance(name string) (sbsdk.Provider, error)
type ListSpec ¶
type ListSpec struct {
// contains filtered or unexported fields
}
func (*ListSpec) IsRequired ¶
type MapSpec ¶
MapSpec allows us to solve the unique case of the root of all format objects and children being a key/val instead of a standard format schema-looking object.
func ShallowMergeMapSpecs ¶
ShallowMergeMapSpecs takes two specs and merges them, with the rightSpec taking precedent over any duplicates on the left.
func (*MapSpec) IsRequired ¶
type ObjectSpec ¶
type ObjectSpec struct {
// contains filtered or unexported fields
}
func (*ObjectSpec) Children ¶
func (s *ObjectSpec) Children() map[string]Spec
func (*ObjectSpec) IsKey ¶
func (s *ObjectSpec) IsKey() bool
func (*ObjectSpec) IsRequired ¶
func (s *ObjectSpec) IsRequired() bool
func (*ObjectSpec) Type ¶
func (s *ObjectSpec) Type() cty.Type
func (*ObjectSpec) Valid ¶
func (s *ObjectSpec) Valid() bool
type OsManager ¶
type OsManager interface { GetCurrentWorkingDirectory() string CreateDirectoryIfNotExists(path string) error }
func NewDefaultOsManager ¶
func NewDefaultOsManager() OsManager
type PluginConfig ¶
type PluginManager ¶
type PluginManager interface { LoadPlugin(RequiredProviderBlock) error PluginClient(string) (*plugin.Client, error) ProviderInstance(string) (sbsdk.Provider, error) KillPlugin(string) error KillAllPlugins() LoadedPlugins() []string }
func NewDefaultPluginManager ¶
func NewDefaultPluginManager() PluginManager
type PrimitiveSpec ¶
type PrimitiveSpec struct {
// contains filtered or unexported fields
}
func (*PrimitiveSpec) Children ¶
func (s *PrimitiveSpec) Children() map[string]Spec
func (*PrimitiveSpec) IsKey ¶
func (s *PrimitiveSpec) IsKey() bool
func (*PrimitiveSpec) IsRequired ¶
func (s *PrimitiveSpec) IsRequired() bool
func (*PrimitiveSpec) Type ¶
func (s *PrimitiveSpec) Type() cty.Type
func (*PrimitiveSpec) Valid ¶
func (s *PrimitiveSpec) Valid() bool
type ProviderBlock ¶
type ProviderBlock struct { // BlockName will match the first label of the config block. As a convention, this name // should map to a required_provider. If not, 'required_provider' should be set to explicitly // tell switchboard what required provider it should map to. BlockName string // ProviderName is the actual provider this block maps to. Will be the same as BlockName // if 'required_provider' field was not set ProviderName string // InitPayload includes all the provider-specific data passed in the config. This data will // be passed to the plugin on initialization. The schema is also validated against what the provider // plugin expects to be here (which happens during the parsing step) InitPayload cty.Value }
ProviderBlock block lets a user configure various settings for a particular provider, such as auth contexts and other provider-specific settings. Refer to an individual provider plugin documentation for more details
type RequiredProviderBlock ¶
RequiredProviderBlock tells us where a provider should be pulled from, and which version it should use.
type RootSwitchboardConfig ¶
type RootSwitchboardConfig struct { Variables []VariableBlock Switchboard SwitchboardBlock Providers []ProviderBlock Schemas []SchemaBlock }
RootSwitchboardConfig is a container for all fully parsed and decoded static config settings as provided by the user. They are the result of processing all hcl block types in isolation, in an appropriate order. Most values come as discrete primitives from the config, while others are computed expressions.
Certain attributes are not known at the config parsing stage, such as variables derived from triggers or workflow steps. These values will be evaluated during individual workflow cycles.
func (*RootSwitchboardConfig) EvalContext ¶
func (conf *RootSwitchboardConfig) EvalContext() *hcl.EvalContext
EvalContext is the high level evaluation context object used for evaluating expressions throughout the various blocks of the parent configuration. Note: The RootSwitchboardConfig.Variables should already be calculated and set before this can be used to evaluate other root blocks on the RootSwitchboardConfig object.
type SchemaBlock ¶
type SchemaBlock struct { Name string `hcl:"name,label"` IsList *bool `hcl:"name"` Format Spec `hcl:"format"` Variants []VariantBlock `hcl:"variant,block"` }
type Spec ¶
type Spec interface { IsRequired() bool IsKey() bool Type() cty.Type Children() map[string]Spec Valid() bool }
func SchemaFormatValueToSpec ¶
SchemaFormatValueToSpec transforms a format value to a Spec struct. This function should only be used after validating the format structure, given cty.Value is inherently dynamic
type SwitchboardBlock ¶
type SwitchboardBlock struct { Version string //Host HostBlock RequiredProviders []RequiredProviderBlock }
SwitchboardBlock contains the primary global configuration elements of all workflows, including the required providers, log settings, retry settings, and more.
type VariableBlock ¶
VariableBlock contains the final variable value as calculated by the Load command, which may contain a mixture of default and override values, as provided by the user.