product

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2016 License: Apache-2.0 Imports: 8 Imported by: 26

Documentation

Overview

Package product is the API for the V1 product interface.

Index

Constants

View Source
const PluginsMapHash = "product"

PluginsMapHash is an identifier for plugins registered with the go-plugin library.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  2,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

HandshakeConfig is the configuration for establishing communication between the CLI plugins.

Functions

func Run

func Run(p Deployer)

Run runs a ProductDeployer as an RPC server. It should be called from a plugin's func main.

Types

type Args

type Args struct {
	Args        []string
	CloudConfig []byte
	CredStore   cred.Store
}

Args contains the args for a GetProduct call.

type Deployer added in v1.0.0

type Deployer interface {
	GetProduct(args []string, cloudConfig []byte, cs cred.Store) ([]byte, error)
	GetMeta() Meta
	GetFlags() []pcli.Flag
}

Deployer is the interface implemented by V1 product plugins.

type Meta added in v1.0.0

type Meta struct {
	Name       string
	Properties map[string]interface{}
	Releases   []enaml.Release
	Stemcell   enaml.Stemcell
}

Meta is the metadata for a product plugin.

type Plugin added in v1.0.0

type Plugin struct {
	Plugin Deployer
}

Plugin wraps up the RPC server and client into a single type.

func NewProductPlugin

func NewProductPlugin(pd Deployer) Plugin

NewProductPlugin decorates a ProductDeployer with the RPC functionality requried to operate as a product plugin.

func (Plugin) Client added in v1.0.0

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

Client returns an RPC client that implements the ProductDeployer interface.

func (Plugin) Server added in v1.0.0

func (p Plugin) Server(*plugin.MuxBroker) (interface{}, error)

Server returns an RPC server that implements the ProductDeployer interface.

type RPC added in v1.0.0

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

RPC is an implementation of Deployer that talks over RPC.

func (*RPC) GetFlags added in v1.0.0

func (p *RPC) GetFlags() []pcli.Flag

GetFlags calls a plugin's GetFlags method over RPC.

func (*RPC) GetMeta added in v1.0.0

func (p *RPC) GetMeta() Meta

GetMeta calls a plugin's GetMeta method over RPC.

func (*RPC) GetProduct added in v1.0.0

func (p *RPC) GetProduct(args []string, cloudConfig []byte, cs cred.Store) ([]byte, error)

GetProduct calls a plugin's GetProduct method over RPC.

type RPCServer added in v1.0.0

type RPCServer struct {
	Impl Deployer
}

RPCServer is the RPC server that ProductRPC connects to. It conforms to the requirements of net/rpc.

func (*RPCServer) GetFlags added in v1.0.0

func (s *RPCServer) GetFlags(args interface{}, resp *[]pcli.Flag) error

GetFlags forwards the RPC request to the plugin's GetFlags method and sends back the results.

func (*RPCServer) GetMeta added in v1.0.0

func (s *RPCServer) GetMeta(args interface{}, resp *Meta) error

GetMeta forwards the RPC request to the plugin's GetMeta method and sends back the results.

func (*RPCServer) GetProduct added in v1.0.0

func (p *RPCServer) GetProduct(args Args, resp *Response) error

GetProduct forwards the RPC request to the plugin's GetProduct method and sends back the results.

type Response

type Response struct {
	Bytes  []byte
	ErrRes string
}

Response contains the results of a GetProduct call.

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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