Documentation ¶
Index ¶
- Constants
- Variables
- func IsInternal(param string, bun bundle.Bundle) bool
- func ParseVariableAssignments(params []string) (map[string]string, error)
- type ParameterProvider
- type ParameterSet
- type ParameterStorage
- type ParameterStore
- type ParametersStore
- type SecretsStore
- type Store
- type TestParameterProvider
Constants ¶
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) )
const ItemType = "parameters"
ItemType is the location in the backing store where parameters are persisted.
const PorterInternal = "porter-internal"
PorterInternal is a string that can be used to designate a parameter as internal to Porter
Variables ¶
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
IsInternal determines if the provided param is an internal parameter to Porter after analyzing the provided bundle
func ParseVariableAssignments ¶
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) GetBackingStore ¶ added in v0.28.0
func (s Store) GetBackingStore() crud.ManagedStore
GetBackingStore returns the data store behind this credentials store.
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)