params

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEnvParamsForModule added in v0.12.0

func BuildEnvParamsForModule(moduleName, paramsStr, componentParams, envDir string) (string, error)

BuildEnvParamsForModule builds environment parameters for a specific module.

Given the following paramsStr and moduleName `app.project-1`, return only the parameters with that prefix. ```

{
	components: {
	  "app.project-1.deployment": {
		replicas: 1,
	  },
	  "infra.security.deployment": {
		name: "tool",
	  },
	  "deployment": {
		replicas: 3,
	  },
	},
  }

```

func DeleteFromObject

func DeleteFromObject(fieldPath []string, paramsData, key, root string) (string, error)

DeleteFromObject deletes a value from an object. `root` will generally be either `components` or `global`. `key` is the component name.

func EvaluateEnv

func EvaluateEnv(a app.App, sourcePath, paramsStr, envName, moduleName string) (string, error)

EvaluateEnv evaluates environment parameters.

func JsonnetEnvObject added in v0.12.0

func JsonnetEnvObject(a app.App, envName string) (string, error)

JsonnetEnvObject creates an object with the current ksonnet environment. This object includes the current server and namespace. The object is suitable to use as a Jsonnet ext code option.

func PatchJSON

func PatchJSON(jsonObject, patch, patchName string) (string, error)

PatchJSON patches components.

func SetInObject

func SetInObject(fieldPath []string, paramsData, key string, value interface{}, root string) (string, error)

SetInObject sets a value in an object. `root` will generally be either `components` or `global`. `key` is the component name.

func ToMap

func ToMap(componentName, src, root string) (map[string]interface{}, error)

ToMap converts a component's params to a map.

Types

type Entry added in v0.12.0

type Entry struct {
	// ComponentName is the component that owns this entry.
	ComponentName string
	// ParamName is the name of the parameter.
	ParamName string
	// Value is the value of the parameter.
	Value string
}

Entry is parameter entry. It uses to hold output when listing parameters.

type EnvComponentRemover

type EnvComponentRemover struct {
}

EnvComponentRemover removes param configuration for components from env params libsonnet files.

func NewEnvComponentRemover

func NewEnvComponentRemover() *EnvComponentRemover

NewEnvComponentRemover creates an instance of EnvComponentRemover.

func (*EnvComponentRemover) Remove

func (ecr *EnvComponentRemover) Remove(componentName, snippet string) (string, error)

Remove removes component name from the jsonnet snippet.

type EnvGlobalsSet

type EnvGlobalsSet struct {
}

EnvGlobalsSet sets environment globals.

func NewEnvGlobalsSet

func NewEnvGlobalsSet() *EnvGlobalsSet

NewEnvGlobalsSet creates an instance of EnvGlobalsSet.

func (*EnvGlobalsSet) Set

func (egs *EnvGlobalsSet) Set(snippet string, p params.Params) (string, error)

Set sets params in environment globals files.

type EnvGlobalsUnset

type EnvGlobalsUnset struct {
}

EnvGlobalsUnset un-sets global environment params.

func NewEnvGlobalsUnset

func NewEnvGlobalsUnset() *EnvGlobalsUnset

NewEnvGlobalsUnset creates an instance of EnvGlobalsUnset.

func (*EnvGlobalsUnset) Unset

func (epu *EnvGlobalsUnset) Unset(paramName, snippet string) (string, error)

Unset un-sets globals.

type EnvParamSet

type EnvParamSet struct {
}

EnvParamSet sets environment params for a component.

func NewEnvParamSet

func NewEnvParamSet() *EnvParamSet

NewEnvParamSet creates an instance of EnvParamSet.

func (*EnvParamSet) Set

func (epa *EnvParamSet) Set(componentName, snippet string, p params.Params) (string, error)

Set sets params in environment parameter files.

type EnvParamUnset

type EnvParamUnset struct {
}

EnvParamUnset unset param configuration for components from env params libsonnet files.

func NewEnvParamUnset

func NewEnvParamUnset() *EnvParamUnset

NewEnvParamUnset creates an instance of EnvParamUnset.

func (*EnvParamUnset) Unset

func (epu *EnvParamUnset) Unset(componentName, paramName, snippet string) (string, error)

Unset un-sets params.

type Lister added in v0.12.0

type Lister struct {
	// Destination is the cluster details.
	Destination app.EnvironmentDestinationSpec
	// AppRoot is the root path for the application.
	AppRoot string
	// contains filtered or unexported fields
}

Lister lists parameters.

func NewLister added in v0.12.0

func NewLister(appRoot string, destination app.EnvironmentDestinationSpec) *Lister

NewLister creates an instance of Lister.

func (*Lister) List added in v0.12.0

func (l *Lister) List(r io.Reader, componentName string) ([]Entry, error)

List lists parameters in a slice of Entry given parameters source in a reader.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL