{"modulePath":"github.com/hyperhq/hypercli","version":"v1.10.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugins\n\nPackage plugins provides structures and helper functions to manage Docker plugins.\n\nDocker discovers plugins by looking for them in the plugin directory whenever a user or container tries to use one by name. UNIX domain socket files must be located under /run/docker/plugins, whereas spec files can be located either under /etc/docker/plugins or /usr/lib/docker/plugins. This is handled by the Registry interface, which lets you list all plugins or get a plugin by its name if it exists.\n\nThe plugins need to implement an HTTP server and bind this to the UNIX socket or the address specified in the spec files. A handshake is send at /Plugin.Activate, and plugins are expected to return a Manifest with a list of of Docker subsystems which this plugin implements.\n\nIn order to use a plugins, you can use the “Get“ with the name of the plugin and the subsystem it implements.\n\n\tplugin, err := plugins.Get(\"example\", \"VolumeDriver\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error looking up volume plugin example: %v\", err)\n\t}\n\n## Variables\n\n```go\nvar (\n\t// ErrNotFound plugin not found\n\tErrNotFound = errors.New(\"plugin not found\")\n)\n```\n\n```go\nvar (\n\t// ErrNotImplements is returned if the plugin does not implement the requested driver.\n\tErrNotImplements = errors.New(\"Plugin does not implement the requested driver\")\n)\n```\n\n## Functions\n\n```go\nfunc Handle(iface string, fn func(string, *Client))\n```\nHandle adds the specified function to the extpointHandlers.\n\n```go\nfunc IsNotFound(err error) bool\n```\nIsNotFound indicates if the passed in error is from an http.StatusNotFound from the plugin\n\n```go\nfunc Scan() ([]string, error)\n```\nScan scans all the plugin paths and returns all the names it found\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient represents a plugin client.\n\n```go\nfunc NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error)\n```\nNewClient creates a new plugin client (http).\n\n```go\nfunc (c *Client) Call(serviceMethod string, args interface{}, ret interface{}) error\n```\nCall calls the specified method with the specified arguments for the plugin. It will retry for 30 seconds if a failure occurs when calling.\n\n```go\nfunc (c *Client) SendFile(serviceMethod string, data io.Reader, ret interface{}) error\n```\nSendFile calls the specified method, and passes through the IO stream\n\n```go\nfunc (c *Client) Stream(serviceMethod string, args interface{}) (io.ReadCloser, error)\n```\nStream calls the specified method with the specified arguments for the plugin and returns the response body\n\n```go\ntype Manifest struct {\n\t// List of subsystem the plugin implements.\n\tImplements []string\n}\n```\nManifest lists what a plugin implements.\n\n```go\ntype Plugin struct {\n\t// Name of the plugin\n\tName string `json:\"-\"`\n\t// Address of the plugin\n\tAddr string\n\t// TLS configuration of the plugin\n\tTLSConfig tlsconfig.Options\n\t// Client attached to the plugin\n\tClient *Client `json:\"-\"`\n\t// Manifest of the plugin (see above)\n\tManifest *Manifest `json:\"-\"`\n\t// contains filtered or unexported fields\n}\n```\nPlugin is the definition of a docker plugin.\n\n```go\nfunc Get(name, imp string) (*Plugin, error)\n```\nGet returns the plugin given the specified name and requested implementation.\n\n```go\nfunc GetAll(imp string) ([]*Plugin, error)\n```\nGetAll returns all the plugins for the specified implementation\n\n","path":"github.com/hyperhq/hypercli/pkg/plugins","name":"plugins","synopsis":"Package plugins provides structures and helper functions to manage Docker plugins.","isRedistributable":true}
