2018-02-05 16:05:59 -05:00
|
|
|
package client // import "github.com/docker/docker/client"
|
2016-10-04 15:01:19 -04:00
|
|
|
|
|
|
|
import (
|
2018-04-19 18:30:59 -04:00
|
|
|
"context"
|
2016-10-04 15:01:19 -04: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 16:15:27 -05:00
|
|
|
headers.Set("Content-Type", "application/x-tar")
|
2016-10-04 15:01:19 -04: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
|
|
|
|
}
|