2016-10-04 15:01:19 -04:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|