Documentation ¶
Index ¶
- Constants
- func Builder(ctx context.Context, c any) (secrets.Keeper, error)
- func Validate(ctx context.Context, c any) error
- type Cache
- func (c *Cache) CopySecret(context.Context, string, string) (secrets.Secret, error)
- func (c *Cache) DeleteSecret(ctx context.Context, id string) error
- func (c *Cache) GetSecret(ctx context.Context, id string) (secrets.Secret, error)
- func (c *Cache) GetSecretsByName(ctx context.Context, name string) ([]secrets.Secret, error)
- func (c *Cache) ListLocations(ctx context.Context) ([]string, error)
- func (c *Cache) ListSecrets(ctx context.Context, loc string) ([]string, error)
- func (c *Cache) MoveSecret(context.Context, string, string) (secrets.Secret, error)
- func (c *Cache) SetSecret(context.Context, secrets.Secret) (secrets.Secret, error)
- type Config
Constants ¶
const ConfigType = "cache"
ConfigType is the type name for the cache keeper.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct { secrets.Keeper // the secret keeper to cache *memory.Memory // the memory keeper used to store cached secrets // contains filtered or unexported fields }
Cache is a secret keeper that wraps another secret keeper and caches secrets in memory. Writing to it directly is not permitted.
func New ¶
New creates a new caching secret keeper. The keeper will cache secrets in memory and will wrap the given secret keeper. The touchOnRead flag will cause the last modified date of secrets to be updated on GetSecret* calls.
func (*Cache) CopySecret ¶
CopySecret cannot be used and always fails with an error.
func (*Cache) DeleteSecret ¶
DeleteSecret deletes the secret with the given ID from the cache only. This does not delete the secret from the wrapped secret keeper.
func (*Cache) GetSecret ¶
GetSecret returns the secret with the given ID from the wrapped secret keeper on first call. Subsequent calls will return the cached secret. If the touchOnRead flag is set, the last modified date of the secret will be updated on each call.
func (*Cache) GetSecretsByName ¶
GetSecretsByName returns the list of secrets with the given name from the wrapped secret keeper on first call. Subsequent calls will return the cached list of secrets. If the touchOnRead flag is set, the last modified date of the secrets will be updated on each call.
func (*Cache) ListLocations ¶
ListLocations returns the list of locations in the wrapped secret keeper.
func (*Cache) ListSecrets ¶
ListSecrets returns the list of secrets in the wrapped secret keeper.
func (*Cache) MoveSecret ¶
MoveSecret cannot be used and always fails with an error.
type Config ¶
type Config struct { // Keeper is the name of the keeper to cache. Keeper string `mapstructure:"keeper"` // TouchOnRead will cause the last modified date of secrets to be updated // on GetSecret* calls. TouchOnRead bool `mapstructure:"touch_on_read"` }
Config is the configuration for the cache keeper.