Documentation ¶
Index ¶
- type K8sSecrets
- type KubeSecretsClient
- func (c *KubeSecretsClient) AddSecret(secretName string, secretData k8sSecretData)
- func (c *KubeSecretsClient) InspectSecret(secretName string) map[string][]byte
- func (c *KubeSecretsClient) RetrieveSecret(_ string, secretName string) (*v1.Secret, error)
- func (c *KubeSecretsClient) UpdateSecret(_ string, secretName string, originalK8sSecret *v1.Secret, ...) error
- type Logger
- func (l *Logger) ClearInfo()
- func (l *Logger) Debug(msg string, args ...interface{})
- func (l *Logger) DebugWasLogged(debug string) bool
- func (l *Logger) Error(msg string, args ...interface{})
- func (l *Logger) ErrorWasLogged(errStr string) bool
- func (l *Logger) Info(msg string, args ...interface{})
- func (l *Logger) InfoWasLogged(info string) bool
- func (l *Logger) RecordedError(msg string, args ...interface{}) error
- func (l *Logger) Warn(msg string, args ...interface{})
- func (l *Logger) WarningWasLogged(warning string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type K8sSecrets ¶
type K8sSecrets map[string]k8sSecretData
K8sSecrets represents a collection of Kubernetes Secrets to be populated into the mock Kubernetes client's database. The logical hierarchy represented by this structure is:
- Each Kubernetes Secret contains a 'Data' field.
- Each 'Data' field contains one or more entries that are key/value pairs.
- The value in each 'Data' field entry can be a nested set of key/value pairs. In particular, for the entry with the key 'conjur-info', the value is expected to be a mapping of application secret names to the corresponding Conjur variable ID (or policy path) that should be used to retrieve the secret value.
type KubeSecretsClient ¶
type KubeSecretsClient struct { ErrOnRetrieve error ErrOnUpdate error // contains filtered or unexported fields }
KubeSecretsClient implements a mock Kubernetes client for testing Kubernetes Secrets access by the Secrets Provider. This client provides: - A Kubernetes Secret retrieve function - A Kubernetes Secret update function Kubernetes Secrets are populated for this mock client via the AddSecret method. Retrieval and update errors can be simulated for testing by mapping 'ErrOnRetrieve' and 'ErrOnUpdate' (respectively) to a custom error.
func NewKubeSecretsClient ¶
func NewKubeSecretsClient() *KubeSecretsClient
NewKubeSecretsClient creates an instance of a KubeSecretsClient
func (*KubeSecretsClient) AddSecret ¶
func (c *KubeSecretsClient) AddSecret( secretName string, secretData k8sSecretData, )
AddSecret adds a Kubernetes Secret to the mock Kubernetes Secrets client's database.
func (*KubeSecretsClient) InspectSecret ¶
func (c *KubeSecretsClient) InspectSecret(secretName string) map[string][]byte
InspectSecret provides a way for unit tests to view the 'Data' field content of a Kubernetes Secret by reading this content directly from the mock client's database.
func (*KubeSecretsClient) RetrieveSecret ¶
RetrieveSecret retrieves a Kubernetes Secret from the mock Kubernetes Secrets client's database.
func (*KubeSecretsClient) UpdateSecret ¶
func (c *KubeSecretsClient) UpdateSecret( _ string, secretName string, originalK8sSecret *v1.Secret, stringDataEntriesMap map[string][]byte) error
UpdateSecret updates a Kubernetes Secret in the mock Kubernetes Secrets client's database.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is used to implement logging functions for testing the Kubernetes Secrets storage provider.
func (*Logger) DebugWasLogged ¶
DebugWasLogged determines if a debug string appears in any debug messages that have been logged.
func (*Logger) ErrorWasLogged ¶
ErrorWasLogged determines if an error string appears in any errors that have been logged.
func (*Logger) InfoWasLogged ¶
InfoWasLogged determines if a warning string appears in any info messages that have been logged.
func (*Logger) RecordedError ¶
RecordedError logs that an error has occurred and returns a new error with the given error message.
func (*Logger) WarningWasLogged ¶
WarningWasLogged determines if a warning string appears in any warning messages that have been logged.