Documentation ¶
Index ¶
- Constants
- Variables
- func Create(ksApp app.App, name, text string, params param.Params, ...) (string, error)
- func Delete(a app.App, name string) error
- func GenParamsContent() []byte
- func MakePaths(a app.App, env string) ([]string, error)
- func Path(a app.App, name string) (string, error)
- func ResolvePath(ksApp app.App, path string) (Module, Component, error)
- type Component
- type FilesystemModule
- func (m *FilesystemModule) Components() ([]Component, error)
- func (m *FilesystemModule) DeleteParam(path []string) error
- func (m *FilesystemModule) Dir() string
- func (m *FilesystemModule) Name() string
- func (m *FilesystemModule) Params(envName string) ([]ModuleParameter, error)
- func (m *FilesystemModule) ParamsPath() string
- func (m *FilesystemModule) Render(envName string, componentNames ...string) (*astext.Object, map[string]string, error)
- func (m *FilesystemModule) ResolvedParams() (string, error)
- func (m *FilesystemModule) SetParam(path []string, value interface{}) error
- type Jsonnet
- func (j *Jsonnet) DeleteParam(path []string) error
- func (j *Jsonnet) Name(wantsNameSpaced bool) string
- func (j *Jsonnet) Params(envName string) ([]ModuleParameter, error)
- func (j *Jsonnet) SetParam(path []string, value interface{}) error
- func (j *Jsonnet) Summarize() (Summary, error)
- func (j *Jsonnet) ToNode(envName string) (string, ast.Node, error)
- func (j *Jsonnet) Type() string
- type Manager
- type Module
- type ModuleParameter
- type ParamOptions
- type Summary
- type YAML
- func (y *YAML) DeleteParam(path []string) error
- func (y *YAML) Name(wantsNameSpaced bool) string
- func (y *YAML) Params(envName string) ([]ModuleParameter, error)
- func (y *YAML) SetParam(path []string, value interface{}) error
- func (y *YAML) Summarize() (Summary, error)
- func (y *YAML) ToNode(envName string) (string, ast.Node, error)
- func (y *YAML) Type() string
Constants ¶
const (
// TypeJsonnet is a Jsonnet component.
TypeJsonnet = "jsonnet"
)
const (
// TypeYAML is a YAML component.
TypeYAML = "yaml"
)
Variables ¶
var (
// DefaultManager is the default manager for components.
DefaultManager = &defaultManager{}
)
Functions ¶
func Create ¶
func Create(ksApp app.App, name, text string, params param.Params, templateType prototype.TemplateType) (string, error)
Create creates a component.
func Delete ¶
Delete deletes the component file and all references. Write operations will happen at the end to minimal-ize failures that leave the directory structure in a half-finished state.
func GenParamsContent ¶
func GenParamsContent() []byte
GenParamsContent is the default content for params.libsonnet.
Types ¶
type Component ¶
type Component interface { // DeleteParam deletes a component parameter. DeleteParam(path []string) error // Name is the component name. Name(wantsNamedSpaced bool) string // Params returns a list of all parameters for a component. If envName is a // blank string, it will report the local parameters. Params(envName string) ([]ModuleParameter, error) // SetParams sets a component paramaters. SetParam(path []string, value interface{}) error // Summarize returns a summary of the component. Summarize() (Summary, error) // ToNode converts a component to a Jsonnet node. ToNode(envName string) (string, ast.Node, error) // Type returns the type of component. Type() string }
Component is a ksonnet Component interface.
func ExtractComponent ¶
ExtractComponent extracts a component from a path.
type FilesystemModule ¶
type FilesystemModule struct {
// contains filtered or unexported fields
}
FilesystemModule is a component module that uses a filesystem for storage.
func NewModule ¶
func NewModule(ksApp app.App, path string) *FilesystemModule
NewModule creates an instance of module.
func (*FilesystemModule) Components ¶
func (m *FilesystemModule) Components() ([]Component, error)
Components returns the components in a module.
func (*FilesystemModule) DeleteParam ¶
func (m *FilesystemModule) DeleteParam(path []string) error
DeleteParam deletes params for a module.
func (*FilesystemModule) Dir ¶
func (m *FilesystemModule) Dir() string
Dir is the absolute directory for a module.
func (*FilesystemModule) Name ¶
func (m *FilesystemModule) Name() string
Name returns the module name.
func (*FilesystemModule) Params ¶
func (m *FilesystemModule) Params(envName string) ([]ModuleParameter, error)
Params returns the params for a module.
func (*FilesystemModule) ParamsPath ¶
func (m *FilesystemModule) ParamsPath() string
ParamsPath generates the path to params.libsonnet for a module.
func (*FilesystemModule) Render ¶
func (m *FilesystemModule) Render(envName string, componentNames ...string) (*astext.Object, map[string]string, error)
Render converts components to JSON. If there are component names, only include those components.
func (*FilesystemModule) ResolvedParams ¶
func (m *FilesystemModule) ResolvedParams() (string, error)
ResolvedParams resolves paramaters for a module. It returns a JSON encoded string of component parameters.
func (*FilesystemModule) SetParam ¶
func (m *FilesystemModule) SetParam(path []string, value interface{}) error
SetParam sets params for a module.
type Jsonnet ¶
type Jsonnet struct {
// contains filtered or unexported fields
}
Jsonnet is a component base on jsonnet.
func NewJsonnet ¶
NewJsonnet creates an instance of Jsonnet.
func (*Jsonnet) DeleteParam ¶
DeleteParam deletes a param.
func (*Jsonnet) Params ¶
func (j *Jsonnet) Params(envName string) ([]ModuleParameter, error)
Params returns params for a component.
type Manager ¶
type Manager interface { Components(ns Module) ([]Component, error) Component(ksApp app.App, module, componentName string) (Component, error) CreateComponent(ksApp app.App, name, text string, params param.Params, templateType prototype.TemplateType) (string, error) CreateModule(ksApp app.App, name string) error Module(ksApp app.App, moduleName string) (Module, error) Modules(ksApp app.App, envName string) ([]Module, error) NSResolveParams(ns Module) (string, error) }
Manager is an interface for interating with components.
type Module ¶
type Module interface { Components() ([]Component, error) DeleteParam(path []string) error Dir() string Name() string Params(envName string) ([]ModuleParameter, error) ParamsPath() string Render(envName string, componentNames ...string) (*astext.Object, map[string]string, error) ResolvedParams() (string, error) SetParam(path []string, value interface{}) error }
Module is a component module
func ExtractModuleComponent ¶
ExtractModuleComponent extracts a module and a component from a path.
type ModuleParameter ¶
ModuleParameter is a module parameter.
func (*ModuleParameter) IsSameType ¶
func (mp *ModuleParameter) IsSameType(other ModuleParameter) bool
IsSameType returns true if the other ModuleParams is the same type. The types are the same if the component, index, and key match.
type YAML ¶
type YAML struct {
// contains filtered or unexported fields
}
YAML represents a YAML component. Since JSON is a subset of YAML, it can handle JSON as well.
func (*YAML) DeleteParam ¶
DeleteParam deletes a param.
func (*YAML) Params ¶
func (y *YAML) Params(envName string) ([]ModuleParameter, error)
Params returns params for a component.
func (*YAML) Summarize ¶
Summarize generates a summary for a YAML component. For each manifest, it will return a slice of summaries of resources described.