/
secrets_protocol.go
27 lines (24 loc) · 1.12 KB
/
secrets_protocol.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package plugins
import "context"
// SecretsProtocol is the interface that secrets plugins must implement.
// This defines the protocol used to communicate with secrets plugins.
type SecretsProtocol interface {
// Resolve a secret value from a secret store
// - keyName is name of the key where the secret can be found.
// - keyValue is the value of the key.
// if keyName can not be reolved by a plugin implementation, the plugin will
// fall back to use the host plugin.
// Examples:
// - keyName=env, keyValue=CONN_STRING
// - keyName=key, keyValue=conn-string
// - keyName=path, keyValue=/tmp/connstring.txt
Resolve(ctx context.Context, keyName string, keyValue string) (string, error)
// Create stores a secret value in a secret store.
// - keyName is name of the key where the secret can be found.
// - keyValue is the value of the key.
// Examples:
// - keyName=env, keyValue=CONN_STRING, value=redis://foo
// - keyName=key, keyValue=conn-string, value=redis://foo
// - keyName=path, keyValue=/tmp/connstring.txt, value=redis://foo
Create(ctx context.Context, keyName string, keyValue string, value string) error
}