parameters

package
v1.0.0-alpha.19 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionParameters = "parameters"
)
View Source
const (
	// SchemaVersion represents the version associated with the schema
	// for parameter set documents.
	SchemaVersion = schema.Version("1.0.1")
)

Variables

This section is empty.

Functions

func ParseVariableAssignments

func ParseVariableAssignments(params []string) (map[string]string, error)

ParseVariableAssignments converts a string array of variable assignments into a map of keys and values Example: [a=b c=abc1232=== d=banana d=pineapple] becomes map[a:b c:abc1232=== d:[pineapple]]

Types

type ParameterSet

type ParameterSet struct {
	ParameterSetSpec `yaml:",inline"`
	Status           ParameterSetStatus `json:"status" yaml:"status" toml:"status"`
}

ParameterSet represents a collection of parameters and their sources/strategies for value resolution

func NewParameterSet added in v0.28.0

func NewParameterSet(namespace string, name string, params ...secrets.Strategy) ParameterSet

NewParameterSet creates a new ParameterSet with the required fields initialized.

func (ParameterSet) DefaultDocumentFilter

func (s ParameterSet) DefaultDocumentFilter() interface{}

func (ParameterSet) String

func (s ParameterSet) String() string

func (ParameterSet) Validate

func (s ParameterSet) Validate() error

type ParameterSetSpec

type ParameterSetSpec struct {
	// SchemaVersion is the version of the parameter-set schema.
	SchemaVersion schema.Version `json:"schemaVersion" yaml:"schemaVersion" toml:"schemaVersion"`

	// Namespace to which the credential set is scoped.
	Namespace string `json:"namespace" yaml:"namespace" toml:"namespace"`

	// Name is the name of the parameter set.
	Name string `json:"name" yaml:"name" toml:"name"`

	// Labels applied to the parameter set.
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty" toml:"labels,omitempty"`

	// Parameters is a list of parameter specs.
	Parameters []secrets.Strategy `json:"parameters" yaml:"parameters" toml:"parameters"`
}

ParameterSetSpec represents the set of user-modifiable fields on a ParameterSet.

type ParameterSetStatus

type ParameterSetStatus struct {
	// Created timestamp of the parameter set.
	Created time.Time `json:"created" yaml:"created" toml:"created"`

	// Modified timestamp of the parameter set.
	Modified time.Time `json:"modified" yaml:"modified" toml:"modified"`
}

ParameterSetStatus contains additional status metadata that has been set by Porter.

type ParameterStore

type ParameterStore struct {
	Documents storage.Store
	Secrets   secrets.Store
}

ParameterStore provides access to parameter sets by instantiating plugins that implement CRUD storage.

func NewParameterStore

func NewParameterStore(storage storage.Store, secrets secrets.Store) *ParameterStore

func (ParameterStore) GetDataStore

func (s ParameterStore) GetDataStore() storage.Store

func (ParameterStore) GetParameterSet

func (s ParameterStore) GetParameterSet(namespace string, name string) (ParameterSet, error)

func (ParameterStore) Initialize

func (s ParameterStore) Initialize() error

Initialize the backend storage with any necessary schema changes, such as indexes.

func (ParameterStore) InsertParameterSet

func (s ParameterStore) InsertParameterSet(params ParameterSet) error

func (ParameterStore) ListParameterSets

func (s ParameterStore) ListParameterSets(namespace string, name string, labels map[string]string) ([]ParameterSet, error)

func (ParameterStore) RemoveParameterSet

func (s ParameterStore) RemoveParameterSet(namespace string, name string) error

func (ParameterStore) ResolveAll

func (s ParameterStore) ResolveAll(params ParameterSet) (secrets.Set, error)

func (ParameterStore) UpdateParameterSet

func (s ParameterStore) UpdateParameterSet(params ParameterSet) error

func (ParameterStore) UpsertParameterSet

func (s ParameterStore) UpsertParameterSet(params ParameterSet) error

func (ParameterStore) Validate

func (s ParameterStore) Validate(params ParameterSet) error

type Provider

type Provider interface {
	GetDataStore() storage.Store

	// ResolveAll parameter values in the parameter set.
	ResolveAll(params ParameterSet) (secrets.Set, error)

	// Validate the parameter set is defined properly.
	Validate(params ParameterSet) error

	InsertParameterSet(params ParameterSet) error
	ListParameterSets(namespace string, name string, labels map[string]string) ([]ParameterSet, error)
	GetParameterSet(namespace string, name string) (ParameterSet, error)
	UpdateParameterSet(params ParameterSet) error
	UpsertParameterSet(params ParameterSet) error
	RemoveParameterSet(namespace string, name string) error
}

Provider interface for managing sets of parameters.

type TestParameterProvider

type TestParameterProvider struct {
	*ParameterStore

	T *testing.T
	// TestSecrets allows you to set up secrets for unit testing
	TestSecrets   *inmemorysecrets.Store
	TestDocuments storage.Store
}

func NewTestParameterProvider

func NewTestParameterProvider(t *testing.T) *TestParameterProvider

func NewTestParameterProviderFor

func NewTestParameterProviderFor(t *testing.T, testStore storage.Store) *TestParameterProvider

func (TestParameterProvider) AddTestParameters

func (p TestParameterProvider) AddTestParameters(path string)

func (TestParameterProvider) AddTestParametersDirectory

func (p TestParameterProvider) AddTestParametersDirectory(dir string)

func (TestParameterProvider) Load

Load a ParameterSet from a test file at a given path.

It does not load the individual parameters.

func (TestParameterProvider) Teardown

func (p TestParameterProvider) Teardown() error

Jump to

Keyboard shortcuts

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