Documentation
¶
Index ¶
- Variables
- func LoadFromYamlBytes(raw []byte, cfg conf.Config) (types.ProjectionMapping, error)
- type DataSource
- type ProjectionMapping
- func (m *ProjectionMapping) GetEncryptionConfig() conf.Encryption
- func (m *ProjectionMapping) GetName() string
- func (m *ProjectionMapping) GetNamespace() string
- func (m *ProjectionMapping) GetRepo() string
- func (m *ProjectionMapping) ProjectSecret(credsPath string) (*v1.Secret, error)
- func (m *ProjectionMapping) ProjectSecretAsYAMLString(credsPath string) (string, error)
- func (m *ProjectionMapping) String() string
- type Secret
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedStructuredOutputFormat is thrown when the output format requested isnt satisfiable by the projection method ErrUnsupportedStructuredOutputFormat = errors.New("output format requested is structured, but the input source type does not support structured output") // ErrUnsupportedUnstructuredOutputFormat is thrown when the output format requested isnt satisfiable by the projection method ErrUnsupportedUnstructuredOutputFormat = errors.New("output format requested is raw, but the input source type is structured") // ErrUnsupportedOutputFormat is thrown when the output format requested isnt satisfiable by the projection method ErrUnsupportedOutputFormat = errors.New("unsupported output format") // ErrMissingJSONPathSelector is thrown when a structured projection doesnt specify jsonpath or jsonpaths ErrMissingJSONPathSelector = errors.New("either JSONPath or JSONPaths need to be defined") // ErrMultipleJSONPathSelector is thrown when a structured projection specifies both jsonpath and jsonpaths ErrMultipleJSONPathSelector = errors.New("only JSONPath or JSONPaths need to be defined") )
var ( // ErrEncryptionRequestedButNoEncryptionConfigSpecified if user asks to encrypt a data item, but // didnt specify an encryption config for the projection manifest, we dont know _how_ the user wants // this stuff encrypted ErrEncryptionRequestedButNoEncryptionConfigSpecified = fmt.Errorf("encryption of a data element was requested, but no encryption_config was found to instantiate an encryptio n module") // DecryptionKeysPrefix is the prefix used for injecting the decryption keys JSON into a Secret when Encryption.IncludeDecryptionKeys is true DecryptionKeysPrefix = "keys_" )
Functions ¶
func LoadFromYamlBytes ¶
LoadFromYamlBytes parses a ProjectionMapping from a string
Types ¶
type DataSource ¶
type DataSource struct { JSON string `json:"json,omitempty",yaml:"json,omitempty"` YAML string `json:"yaml,omitempty",yaml:"yaml,omitempty"` Raw string `json:"raw,omitempty",yaml:"raw,omitempty"` // Format is the desired output format for the secret. This defaults to the input format // unless overridden. See OutputFormat() Format types.OutputFormat `json:"format,omitempty",yaml:"format,omitempty"` JSONPath string `json:"jsonpath,omitempty",yaml:"jsonpath,omitempty"` // JSONPaths is different from the singular path, it represents one (or more) json elements // being selected from a datasource and exported into a single file // the key is the label it should be defined as, the value is the jsonpath JSONPaths map[string]types.JSONPathSelector `json:"jsonpath,omitempty",yaml:"jsonpath,omitempty"` }
DataSource is a source of data that will be projected into a secret it specifies its source, output format (optional), and fields to extract from the source.
func (*DataSource) OutputFormat ¶
func (d *DataSource) OutputFormat() (types.OutputFormat, error)
OutputFormat returns the inferred/requested output format given the source format and extracted fields.
func (*DataSource) Project ¶
func (d *DataSource) Project(credsPath string) ([]byte, error)
Project will resolve the data pointed to by this DataSource, and return the data referenced by it as a string
func (*DataSource) String ¶
func (d *DataSource) String() string
String returns a string representation of the datasource
func (*DataSource) Type ¶
func (d *DataSource) Type() types.DataSourceType
Type returns the type of the datasource
type ProjectionMapping ¶
type ProjectionMapping struct { Name string `json:"name",yaml:"name"` Namespace string `json:"namespace",yaml:"namespace"` Repo string `json:"repo",yaml:"repo"` Data []Secret `json:"data",yaml:"data"` //data: Encryption conf.Encryption `yaml:"encryption",json:"encryption"` // contains filtered or unexported fields }
ProjectionMapping is a v1 implementation of the struct that joins a declaration of dependency on a set of secrets, with the secrets sourced from a secret repository
func (*ProjectionMapping) GetEncryptionConfig ¶
func (m *ProjectionMapping) GetEncryptionConfig() conf.Encryption
GetEncryptionConfig is the encryption configuration for this projection
func (*ProjectionMapping) GetName ¶
func (m *ProjectionMapping) GetName() string
GetName is the name of a ProjectionMapping
func (*ProjectionMapping) GetNamespace ¶
func (m *ProjectionMapping) GetNamespace() string
GetNamespace is the namespace the ProjectionMapping is bound to
func (*ProjectionMapping) GetRepo ¶
func (m *ProjectionMapping) GetRepo() string
GetRepo returns the creds source repository for this ProjectionMapping
func (*ProjectionMapping) ProjectSecret ¶
func (m *ProjectionMapping) ProjectSecret(credsPath string) (*v1.Secret, error)
ProjectSecret will take a ProjectionMapping and return the k8s secret resource
func (*ProjectionMapping) ProjectSecretAsYAMLString ¶
func (m *ProjectionMapping) ProjectSecretAsYAMLString(credsPath string) (string, error)
ProjectSecretAsYAMLString will take a ProjectionMapping and return the k8s secret resource as a YAML representation in string form
func (*ProjectionMapping) String ¶
func (m *ProjectionMapping) String() string