2018-02-05 21:05:59 +00:00
|
|
|
package client // import "github.com/docker/docker/client"
|
2016-10-04 19:01:19 +00:00
|
|
|
|
|
|
|
import (
|
2018-04-19 22:30:59 +00:00
|
|
|
"context"
|
2016-10-04 19:01:19 +00:00
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PluginCreate creates a plugin
|
|
|
|
func (cli *Client) PluginCreate(ctx context.Context, createContext io.Reader, createOptions types.PluginCreateOptions) error {
|
|
|
|
headers := http.Header(make(map[string][]string))
|
2016-12-06 21:15:27 +00:00
|
|
|
headers.Set("Content-Type", "application/x-tar")
|
2016-10-04 19:01:19 +00:00
|
|
|
|
|
|
|
query := url.Values{}
|
|
|
|
query.Set("name", createOptions.RepoName)
|
|
|
|
|
|
|
|
resp, err := cli.postRaw(ctx, "/plugins/create", query, createContext, headers)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
ensureReaderClosed(resp)
|
|
|
|
return err
|
|
|
|
}
|