get.porter.sh/porter@v1.3.0/pkg/secrets/plugins/secrets_protocol.go (about)

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