Documentation
¶
Index ¶
- Variables
- type Secret
- type SecretsDriver
- type SecretsManager
- func (s *SecretsManager) Delete(nameOrID string) (string, error)
- func (s *SecretsManager) List() ([]Secret, error)
- func (s *SecretsManager) Lookup(nameOrID string) (*Secret, error)
- func (s *SecretsManager) LookupSecretData(nameOrID string) (*Secret, []byte, error)
- func (s *SecretsManager) Store(name string, data []byte, driverType string, options StoreOptions) (string, error)
- type StoreOptions
Constants ¶
This section is empty.
Variables ¶
var ErrNoSuchSecret = errors.New("no such secret")
ErrNoSuchSecret indicates that the secret does not exist
Functions ¶
This section is empty.
Types ¶
type Secret ¶
type Secret struct {
// Name is the name of the secret
Name string `json:"name"`
// ID is the unique secret ID
ID string `json:"id"`
// Labels are labels on the secret
Labels map[string]string `json:"labels,omitempty"`
// Metadata stores other metadata on the secret
Metadata map[string]string `json:"metadata,omitempty"`
// CreatedAt is when the secret was created
CreatedAt time.Time `json:"createdAt"`
// UpdatedAt is when the secret was updated
UpdatedAt time.Time `json:"updatedAt"`
// Driver is the driver used to store secret data
Driver string `json:"driver"`
// DriverOptions are extra options used to run this driver
DriverOptions map[string]string `json:"driverOptions"`
}
Secret defines a secret
type SecretsDriver ¶
type SecretsDriver interface {
// List lists all secret ids in the secrets data store
List() ([]string, error)
// Lookup gets the secret's data bytes
Lookup(id string) ([]byte, error)
// Store stores the secret's data bytes
Store(id string, data []byte) error
// Delete deletes a secret's data from the driver
Delete(id string) error
}
SecretsDriver interfaces with the secrets data store. The driver stores the actual bytes of secret data, as opposed to the secret metadata. Currently only the unencrypted filedriver is implemented.
revive does not like the name because the package is already called secrets
type SecretsManager ¶
type SecretsManager struct {
// contains filtered or unexported fields
}
SecretsManager holds information on handling secrets
revive does not like the name because the package is already called secrets
func NewManager ¶
func NewManager(rootPath string) (*SecretsManager, error)
NewManager creates a new secrets manager rootPath is the directory where the secrets data file resides
func (*SecretsManager) Delete ¶
func (s *SecretsManager) Delete(nameOrID string) (string, error)
Delete removes all secret metadata and secret data associated with the specified secret. Delete takes a name, ID, or partial ID.
func (*SecretsManager) List ¶
func (s *SecretsManager) List() ([]Secret, error)
List lists all secrets.
func (*SecretsManager) Lookup ¶
func (s *SecretsManager) Lookup(nameOrID string) (*Secret, error)
Lookup gives a secret's metadata given its name, ID, or partial ID.
func (*SecretsManager) LookupSecretData ¶
func (s *SecretsManager) LookupSecretData(nameOrID string) (*Secret, []byte, error)
LookupSecretData returns secret metadata as well as secret data in bytes. The secret data can be looked up using its name, ID, or partial ID.
func (*SecretsManager) Store ¶
func (s *SecretsManager) Store(name string, data []byte, driverType string, options StoreOptions) (string, error)
Store takes a name, creates a secret and stores the secret metadata and the secret payload. It returns a generated ID that is associated with the secret. The max size for secret data is 512kB.
type StoreOptions ¶ added in v0.50.0
type StoreOptions struct {
// DriverOptions are extra options used to run this driver
DriverOpts map[string]string
// Metadata stores extra metadata on the secret
Metadata map[string]string
// Labels are labels on the secret
Labels map[string]string
// Replace existing secret
Replace bool
}
StoreOptions are optional metadata fields that can be set when storing a new secret