1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Change references to query values.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-12-04 21:06:12 -05:00
parent 8b15839ee8
commit 0b0431a856
16 changed files with 20 additions and 27 deletions

View file

@ -12,10 +12,8 @@ import (
// ContainerCreate creates a new container based in the given configuration.
// It can be associated with a name, but it's not mandatory.
func (cli *Client) ContainerCreate(config *runconfig.ContainerConfigWrapper, containerName string) (types.ContainerCreateResponse, error) {
var (
query url.Values
response types.ContainerCreateResponse
)
var response types.ContainerCreateResponse
query := url.Values{}
if containerName != "" {
query.Set("name", containerName)
}

View file

@ -11,7 +11,7 @@ import (
// ContainerList returns the list of containers in the docker host.
func (cli *Client) ContainerList(options types.ContainerListOptions) ([]types.Container, error) {
var query url.Values
query := url.Values{}
if options.All {
query.Set("all", "1")

View file

@ -8,7 +8,7 @@ import (
// ContainerRemove kills and removes a container from the docker host.
func (cli *Client) ContainerRemove(options types.ContainerRemoveOptions) error {
var query url.Values
query := url.Values{}
if options.RemoveVolumes {
query.Set("v", "1")
}

View file

@ -4,7 +4,7 @@ import "net/url"
// ContainerRename changes the name of a given container.
func (cli *Client) ContainerRename(containerID, newContainerName string) error {
var query url.Values
query := url.Values{}
query.Set("name", newContainerName)
resp, err := cli.POST("/containers/"+containerID+"/rename", query, nil, nil)
ensureReaderClosed(resp)

View file

@ -9,7 +9,7 @@ import (
// It makes the daemon to wait for the container to be up again for
// a specific amount of time, given the timeout.
func (cli *Client) ContainerRestart(containerID string, timeout int) error {
var query url.Values
query := url.Values{}
query.Set("t", strconv.Itoa(timeout))
resp, err := cli.POST("/containers"+containerID+"/restart", query, nil, nil)
ensureReaderClosed(resp)

View file

@ -8,7 +8,7 @@ import (
// ContainerStop stops a container without terminating the process.
// The process is blocked until the container stops or the timeout expires.
func (cli *Client) ContainerStop(containerID string, timeout int) error {
var query url.Values
query := url.Values{}
query.Set("t", strconv.Itoa(timeout))
resp, err := cli.POST("/containers/"+containerID+"/stop", query, nil, nil)
ensureReaderClosed(resp)

View file

@ -10,10 +10,8 @@ import (
// ContainerTop shows process information from within a container.
func (cli *Client) ContainerTop(containerID string, arguments []string) (types.ContainerProcessList, error) {
var (
query url.Values
response types.ContainerProcessList
)
var response types.ContainerProcessList
query := url.Values{}
if len(arguments) > 0 {
query.Set("ps_args", strings.Join(arguments, " "))
}

View file

@ -15,7 +15,7 @@ import (
// ContainerStatPath returns Stat information about a path inside the container filesystem.
func (cli *Client) ContainerStatPath(containerID, path string) (types.ContainerPathStat, error) {
query := make(url.Values, 1)
query := url.Values{}
query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
urlStr := fmt.Sprintf("/containers/%s/archive", containerID)
@ -29,7 +29,7 @@ func (cli *Client) ContainerStatPath(containerID, path string) (types.ContainerP
// CopyToContainer copies content into the container filesystem.
func (cli *Client) CopyToContainer(options types.CopyToContainerOptions) error {
var query url.Values
query := url.Values{}
query.Set("path", filepath.ToSlash(options.Path)) // Normalize the paths used in the API.
// Do not allow for an existing directory to be overwritten by a non-directory and vice versa.
if !options.AllowOverwriteDirWithFile {

View file

@ -13,7 +13,7 @@ import (
// Events returns a stream of events in the daemon in a ReadCloser.
// It's up to the caller to close the stream.
func (cli *Client) Events(options types.EventsOptions) (io.ReadCloser, error) {
var query url.Values
query := url.Values{}
ref := time.Now()
if options.Since != "" {

View file

@ -10,7 +10,7 @@ import (
// ImageCreate creates a new image based in the parent options.
// It returns the JSON content in the response body.
func (cli *Client) ImageCreate(options types.ImageCreateOptions) (io.ReadCloser, error) {
var query url.Values
query := url.Values{}
query.Set("fromImage", options.Parent)
query.Set("tag", options.Tag)

View file

@ -10,7 +10,7 @@ import (
// ImageImport creates a new image based in the source options.
// It returns the JSON content in the response body.
func (cli *Client) ImageImport(options types.ImageImportOptions) (io.ReadCloser, error) {
var query url.Values
query := url.Values{}
query.Set("fromSrc", options.SourceName)
query.Set("repo", options.RepositoryName)
query.Set("tag", options.Tag)

View file

@ -10,11 +10,8 @@ import (
// ImageList returns a list of images in the docker host.
func (cli *Client) ImageList(options types.ImageListOptions) ([]types.Image, error) {
var (
images []types.Image
query url.Values
)
var images []types.Image
query := url.Values{}
if options.Filters.Len() > 0 {
filterJSON, err := filters.ToParam(options.Filters)
if err != nil {

View file

@ -9,7 +9,7 @@ import (
// ImageRemove removes an image from the docker host.
func (cli *Client) ImageRemove(options types.ImageRemoveOptions) ([]types.ImageDelete, error) {
var query url.Values
query := url.Values{}
if options.Force {
query.Set("force", "1")

View file

@ -4,7 +4,7 @@ import "net/url"
// ContainerKill terminates the container process but does not remove the container from the docker host.
func (cli *Client) ContainerKill(containerID, signal string) error {
var query url.Values
query := url.Values{}
query.Set("signal", signal)
resp, err := cli.POST("/containers/"+containerID+"/kill", query, nil, nil)

View file

@ -12,7 +12,7 @@ import (
// ContainerLogs returns the logs generated by a container in an io.ReadCloser.
// It's up to the caller to close the stream.
func (cli *Client) ContainerLogs(options types.ContainerLogsOptions) (io.ReadCloser, error) {
var query url.Values
query := url.Values{}
if options.ShowStdout {
query.Set("stdout", "1")
}

View file

@ -11,7 +11,7 @@ import (
// VolumeList returns the volumes configured in the docker host.
func (cli *Client) VolumeList(filter filters.Args) (types.VolumesListResponse, error) {
var volumes types.VolumesListResponse
var query url.Values
query := url.Values{}
if filter.Len() > 0 {
filterJSON, err := filters.ToParam(filter)