parameters

package
v0.34.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSchemaVersion is the default SchemaVersion value
	// set on new ParameterSet instances, and is the semver portion
	// of CNABSpecVersion.
	DefaultSchemaVersion = schema.Version("1.0.0-DRAFT+TODO")

	// CNABSpecVersion represents the CNAB Spec version of the Parameters
	// that this library implements.
	// This value is prefixed with e.g. `cnab-parametersets-` so isn't itself valid semver.
	CNABSpecVersion string = "cnab-parametersets-" + string(DefaultSchemaVersion)
)
View Source
const ItemType = "parameters"

ItemType is the location in the backing store where parameters are persisted.

View Source
const PorterInternal = "porter-internal"

PorterInternal is a string that can be used to designate a parameter as internal to Porter

Variables

View Source
var ErrNotFound = errors.New("Parameter set does not exist")

ErrNotFound represents a parameter set not found in storage

Functions

func IsInternal added in v0.28.0

func IsInternal(param string, bun bundle.Bundle) bool

IsInternal determines if the provided param is an internal parameter to Porter after analyzing the provided bundle

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 ParameterProvider

type ParameterProvider interface {
	ParameterStore
	ResolveAll(creds ParameterSet) (valuesource.Set, error)
	Validate(ParameterSet) error
}

ParameterProvider interface for managing sets of parameters.

type ParameterSet

type ParameterSet struct {
	// SchemaVersion is the version of the parameter-set schema.
	SchemaVersion schema.Version `json:"schemaVersion" yaml:"schemaVersion"`
	// Name is the name of the parameter set.
	Name string `json:"name" yaml:"name"`
	// Created timestamp of the parameter set.
	Created time.Time `json:"created" yaml:"created"`
	// Modified timestamp of the parameter set.
	Modified time.Time `json:"modified" yaml:"modified"`
	// Parameters is a list of parameter specs.
	Parameters []valuesource.Strategy `json:"parameters" yaml:"parameters"`
}

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

func Load

func Load(path string) (ParameterSet, error)

Load a ParameterSet from a file at a given path.

It does not load the individual parameters.

func NewParameterSet added in v0.28.0

func NewParameterSet(name string, params ...valuesource.Strategy) ParameterSet

NewParameterSet creates a new ParameterSet with the required fields initialized.

type ParameterStorage

type ParameterStorage struct {
	*config.Config
	ParametersStore
	SecretsStore
}

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

func NewParameterStorage

func NewParameterStorage(storage *storage.Manager) *ParameterStorage

func (ParameterStorage) ResolveAll

func (s ParameterStorage) ResolveAll(params ParameterSet) (valuesource.Set, error)

func (ParameterStorage) Validate

func (s ParameterStorage) Validate(params ParameterSet) error

type ParameterStore

type ParameterStore interface {
	List() ([]string, error)
	Save(ParameterSet) error
	Read(name string) (ParameterSet, error)
	ReadAll() ([]ParameterSet, error)
	Delete(name string) error
}

ParameterStore is an interface representing parameters.Store

type ParametersStore

type ParametersStore = Store

type SecretsStore

type SecretsStore = cnabsecrets.Store

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a persistent store for parameter sets.

func NewParameterStore

func NewParameterStore(store crud.ManagedStore) Store

NewParameterStore creates a persistent store for parameter sets using the specified backing key-blob store.

func (Store) Delete

func (s Store) Delete(name string) error

Delete deletes a parameter set from the store.

func (Store) GetBackingStore added in v0.28.0

func (s Store) GetBackingStore() crud.ManagedStore

GetBackingStore returns the data store behind this credentials store.

func (Store) List

func (s Store) List() ([]string, error)

List the names of the stored parameter sets.

func (Store) Read

func (s Store) Read(name string) (ParameterSet, error)

Read loads the parameter set with the given name from the store.

func (Store) ReadAll

func (s Store) ReadAll() ([]ParameterSet, error)

ReadAll retrieves all the parameter sets.

func (Store) Save

func (s Store) Save(param ParameterSet) error

Save a parameter set. Any previous version of the parameter set is overwritten.

type TestParameterProvider

type TestParameterProvider struct {
	T          *testing.T
	TestConfig *config.TestConfig
	// TestSecrets allows you to set up secrets for unit testing
	TestSecrets *inmemorysecrets.Store
	*ParameterStorage
}

func NewTestParameterProvider

func NewTestParameterProvider(t *testing.T, tc *config.TestConfig) TestParameterProvider

func (*TestParameterProvider) AddTestParameters

func (p *TestParameterProvider) AddTestParameters(path string)

func (*TestParameterProvider) AddTestParametersDirectory

func (p *TestParameterProvider) AddTestParametersDirectory(dir string)

Jump to

Keyboard shortcuts

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