Files
docker-cli/components/engine/integration-cli/fixtures/plugin/plugin.go
wangguoliang eec1d4ef54 Optimize some wrong usage and spelling
Signed-off-by: wgliang <liangcszzu@163.com>
Upstream-commit: 94cefa21459a0c620e5a9c2da04df6d3a43dae17
Component: engine
2017-09-07 09:44:08 +08:00

35 lines
876 B
Go

package plugin
import (
"io"
"github.com/docker/docker/api/types"
"golang.org/x/net/context"
)
// CreateOpt is is passed used to change the default plugin config before
// creating it
type CreateOpt func(*Config)
// Config wraps types.PluginConfig to provide some extra state for options
// extra customizations on the plugin details, such as using a custom binary to
// create the plugin with.
type Config struct {
*types.PluginConfig
binPath string
}
// WithBinary is a CreateOpt to set an custom binary to create the plugin with.
// This binary must be statically compiled.
func WithBinary(bin string) CreateOpt {
return func(cfg *Config) {
cfg.binPath = bin
}
}
// CreateClient is the interface used for `BuildPlugin` to interact with the
// daemon.
type CreateClient interface {
PluginCreate(context.Context, io.Reader, types.PluginCreateOptions) error
}