secretbackend

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "CDS_SECRET_BACKEND_MAGIC_COOKIE",
	MagicCookieValue: "Q0RTX1NFQ1JFVF9CQUNLRU5EX01BR0lDX0NPT0tJRQ==",
}

Handshake is the HandshakeConfig used to configure clients and servers.

Functions

func Serve

func Serve(name string, s Driver)

Serve has to be called in main func of every plugin

Types

type CDSSecretBackendPlugin

type CDSSecretBackendPlugin struct {
	Driver
}

CDSSecretBackendPlugin is the implementation of plugin.Plugin so we can serve/consume this

func (CDSSecretBackendPlugin) Client

func (a CDSSecretBackendPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client must return an implementation of our interface that communicates over an RPC client. We return CDSActionRPC for this.

func (CDSSecretBackendPlugin) PluginName

func (a CDSSecretBackendPlugin) PluginName() string

PluginName is name for the plugin

func (CDSSecretBackendPlugin) Server

func (a CDSSecretBackendPlugin) Server(*plugin.MuxBroker) (interface{}, error)

Server must return an RPC server for this plugin type. We construct a CDSActionRPCServer for this.

type Client

type Client struct {
	*plugin.Client
	// contains filtered or unexported fields
}

Client must be used from client side to call the plugin. It's managing plugin instanciation and initializing

func NewClient

func NewClient(binary string, options map[string]string) *Client

NewClient has to be called every time we nedd to call a plugin

func (Client) Instance

func (p Client) Instance() (Driver, error)

Instance return a fresh instance of the plugin dispensed by a RPC server

type Driver

type Driver interface {
	Init(MapVar) error
	Name() string
	GetSecrets() Secrets
}

Driver is a plugin interface for retrieve CDS secrets

type MapVar

type MapVar interface {
	All() map[string]string
	Get(string) string
}

type Options

type Options struct {
	Data map[string]string
}

func NewOptions

func NewOptions(d map[string]string) *Options

func (Options) All

func (d Options) All() map[string]string

func (Options) Get

func (d Options) Get(k string) string

type RPCClient

type RPCClient struct {
	// contains filtered or unexported fields
}

RPCClient is the struct used by the CDS engine

func (*RPCClient) GetSecrets

func (c *RPCClient) GetSecrets() Secrets

GetSecrets makes rpc call to GetSecrets()

func (*RPCClient) Init

func (c *RPCClient) Init(opts MapVar) error

Init the plugin

func (*RPCClient) Name

func (c *RPCClient) Name() string

Name makes rpc call to Name()

type RPCServer

type RPCServer struct {
	Impl Driver
}

RPCServer is the struct called to serve the plugin

func (*RPCServer) GetSecrets

func (c *RPCServer) GetSecrets(args interface{}, resp *Secrets) error

GetSecrets serves rpc call to GetSecrets()

func (*RPCServer) Init

func (c *RPCServer) Init(args interface{}, resp *string) error

Init the rpc plugin

func (*RPCServer) Name

func (c *RPCServer) Name(args interface{}, resp *string) error

Name serves rpc call to Name()

type SecretError

type SecretError string

func Error

func Error(err error) *SecretError

func (SecretError) Error

func (e SecretError) Error() string

type Secrets

type Secrets struct {
	Data  map[string]string
	Error error
}

func NewSecrets

func NewSecrets(d map[string]string) *Secrets

func (Secrets) All

func (d Secrets) All() (map[string]string, error)

func (Secrets) Err

func (d Secrets) Err() error

func (Secrets) Get

func (d Secrets) Get(k string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL