mirror of https://github.com/docker/docs.git
Change references to query values.
Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
parent
8b15839ee8
commit
0b0431a856
|
@ -12,10 +12,8 @@ import (
|
||||||
// ContainerCreate creates a new container based in the given configuration.
|
// ContainerCreate creates a new container based in the given configuration.
|
||||||
// It can be associated with a name, but it's not mandatory.
|
// It can be associated with a name, but it's not mandatory.
|
||||||
func (cli *Client) ContainerCreate(config *runconfig.ContainerConfigWrapper, containerName string) (types.ContainerCreateResponse, error) {
|
func (cli *Client) ContainerCreate(config *runconfig.ContainerConfigWrapper, containerName string) (types.ContainerCreateResponse, error) {
|
||||||
var (
|
var response types.ContainerCreateResponse
|
||||||
query url.Values
|
query := url.Values{}
|
||||||
response types.ContainerCreateResponse
|
|
||||||
)
|
|
||||||
if containerName != "" {
|
if containerName != "" {
|
||||||
query.Set("name", containerName)
|
query.Set("name", containerName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// ContainerList returns the list of containers in the docker host.
|
// ContainerList returns the list of containers in the docker host.
|
||||||
func (cli *Client) ContainerList(options types.ContainerListOptions) ([]types.Container, error) {
|
func (cli *Client) ContainerList(options types.ContainerListOptions) ([]types.Container, error) {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
|
|
||||||
if options.All {
|
if options.All {
|
||||||
query.Set("all", "1")
|
query.Set("all", "1")
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
// ContainerRemove kills and removes a container from the docker host.
|
// ContainerRemove kills and removes a container from the docker host.
|
||||||
func (cli *Client) ContainerRemove(options types.ContainerRemoveOptions) error {
|
func (cli *Client) ContainerRemove(options types.ContainerRemoveOptions) error {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
if options.RemoveVolumes {
|
if options.RemoveVolumes {
|
||||||
query.Set("v", "1")
|
query.Set("v", "1")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "net/url"
|
||||||
|
|
||||||
// ContainerRename changes the name of a given container.
|
// ContainerRename changes the name of a given container.
|
||||||
func (cli *Client) ContainerRename(containerID, newContainerName string) error {
|
func (cli *Client) ContainerRename(containerID, newContainerName string) error {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
query.Set("name", newContainerName)
|
query.Set("name", newContainerName)
|
||||||
resp, err := cli.POST("/containers/"+containerID+"/rename", query, nil, nil)
|
resp, err := cli.POST("/containers/"+containerID+"/rename", query, nil, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
// It makes the daemon to wait for the container to be up again for
|
// It makes the daemon to wait for the container to be up again for
|
||||||
// a specific amount of time, given the timeout.
|
// a specific amount of time, given the timeout.
|
||||||
func (cli *Client) ContainerRestart(containerID string, timeout int) error {
|
func (cli *Client) ContainerRestart(containerID string, timeout int) error {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
query.Set("t", strconv.Itoa(timeout))
|
query.Set("t", strconv.Itoa(timeout))
|
||||||
resp, err := cli.POST("/containers"+containerID+"/restart", query, nil, nil)
|
resp, err := cli.POST("/containers"+containerID+"/restart", query, nil, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
// ContainerStop stops a container without terminating the process.
|
// ContainerStop stops a container without terminating the process.
|
||||||
// The process is blocked until the container stops or the timeout expires.
|
// The process is blocked until the container stops or the timeout expires.
|
||||||
func (cli *Client) ContainerStop(containerID string, timeout int) error {
|
func (cli *Client) ContainerStop(containerID string, timeout int) error {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
query.Set("t", strconv.Itoa(timeout))
|
query.Set("t", strconv.Itoa(timeout))
|
||||||
resp, err := cli.POST("/containers/"+containerID+"/stop", query, nil, nil)
|
resp, err := cli.POST("/containers/"+containerID+"/stop", query, nil, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
|
|
|
@ -10,10 +10,8 @@ import (
|
||||||
|
|
||||||
// ContainerTop shows process information from within a container.
|
// ContainerTop shows process information from within a container.
|
||||||
func (cli *Client) ContainerTop(containerID string, arguments []string) (types.ContainerProcessList, error) {
|
func (cli *Client) ContainerTop(containerID string, arguments []string) (types.ContainerProcessList, error) {
|
||||||
var (
|
var response types.ContainerProcessList
|
||||||
query url.Values
|
query := url.Values{}
|
||||||
response types.ContainerProcessList
|
|
||||||
)
|
|
||||||
if len(arguments) > 0 {
|
if len(arguments) > 0 {
|
||||||
query.Set("ps_args", strings.Join(arguments, " "))
|
query.Set("ps_args", strings.Join(arguments, " "))
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
// ContainerStatPath returns Stat information about a path inside the container filesystem.
|
// ContainerStatPath returns Stat information about a path inside the container filesystem.
|
||||||
func (cli *Client) ContainerStatPath(containerID, path string) (types.ContainerPathStat, error) {
|
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.
|
query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
|
||||||
|
|
||||||
urlStr := fmt.Sprintf("/containers/%s/archive", containerID)
|
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.
|
// CopyToContainer copies content into the container filesystem.
|
||||||
func (cli *Client) CopyToContainer(options types.CopyToContainerOptions) error {
|
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.
|
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.
|
// Do not allow for an existing directory to be overwritten by a non-directory and vice versa.
|
||||||
if !options.AllowOverwriteDirWithFile {
|
if !options.AllowOverwriteDirWithFile {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
// Events returns a stream of events in the daemon in a ReadCloser.
|
// Events returns a stream of events in the daemon in a ReadCloser.
|
||||||
// It's up to the caller to close the stream.
|
// It's up to the caller to close the stream.
|
||||||
func (cli *Client) Events(options types.EventsOptions) (io.ReadCloser, error) {
|
func (cli *Client) Events(options types.EventsOptions) (io.ReadCloser, error) {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
ref := time.Now()
|
ref := time.Now()
|
||||||
|
|
||||||
if options.Since != "" {
|
if options.Since != "" {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
// ImageCreate creates a new image based in the parent options.
|
// ImageCreate creates a new image based in the parent options.
|
||||||
// It returns the JSON content in the response body.
|
// It returns the JSON content in the response body.
|
||||||
func (cli *Client) ImageCreate(options types.ImageCreateOptions) (io.ReadCloser, error) {
|
func (cli *Client) ImageCreate(options types.ImageCreateOptions) (io.ReadCloser, error) {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
query.Set("fromImage", options.Parent)
|
query.Set("fromImage", options.Parent)
|
||||||
query.Set("tag", options.Tag)
|
query.Set("tag", options.Tag)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
// ImageImport creates a new image based in the source options.
|
// ImageImport creates a new image based in the source options.
|
||||||
// It returns the JSON content in the response body.
|
// It returns the JSON content in the response body.
|
||||||
func (cli *Client) ImageImport(options types.ImageImportOptions) (io.ReadCloser, error) {
|
func (cli *Client) ImageImport(options types.ImageImportOptions) (io.ReadCloser, error) {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
query.Set("fromSrc", options.SourceName)
|
query.Set("fromSrc", options.SourceName)
|
||||||
query.Set("repo", options.RepositoryName)
|
query.Set("repo", options.RepositoryName)
|
||||||
query.Set("tag", options.Tag)
|
query.Set("tag", options.Tag)
|
||||||
|
|
|
@ -10,11 +10,8 @@ import (
|
||||||
|
|
||||||
// ImageList returns a list of images in the docker host.
|
// ImageList returns a list of images in the docker host.
|
||||||
func (cli *Client) ImageList(options types.ImageListOptions) ([]types.Image, error) {
|
func (cli *Client) ImageList(options types.ImageListOptions) ([]types.Image, error) {
|
||||||
var (
|
var images []types.Image
|
||||||
images []types.Image
|
query := url.Values{}
|
||||||
query url.Values
|
|
||||||
)
|
|
||||||
|
|
||||||
if options.Filters.Len() > 0 {
|
if options.Filters.Len() > 0 {
|
||||||
filterJSON, err := filters.ToParam(options.Filters)
|
filterJSON, err := filters.ToParam(options.Filters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
// ImageRemove removes an image from the docker host.
|
// ImageRemove removes an image from the docker host.
|
||||||
func (cli *Client) ImageRemove(options types.ImageRemoveOptions) ([]types.ImageDelete, error) {
|
func (cli *Client) ImageRemove(options types.ImageRemoveOptions) ([]types.ImageDelete, error) {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
|
|
||||||
if options.Force {
|
if options.Force {
|
||||||
query.Set("force", "1")
|
query.Set("force", "1")
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "net/url"
|
||||||
|
|
||||||
// ContainerKill terminates the container process but does not remove the container from the docker host.
|
// ContainerKill terminates the container process but does not remove the container from the docker host.
|
||||||
func (cli *Client) ContainerKill(containerID, signal string) error {
|
func (cli *Client) ContainerKill(containerID, signal string) error {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
query.Set("signal", signal)
|
query.Set("signal", signal)
|
||||||
|
|
||||||
resp, err := cli.POST("/containers/"+containerID+"/kill", query, nil, nil)
|
resp, err := cli.POST("/containers/"+containerID+"/kill", query, nil, nil)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
// ContainerLogs returns the logs generated by a container in an io.ReadCloser.
|
// ContainerLogs returns the logs generated by a container in an io.ReadCloser.
|
||||||
// It's up to the caller to close the stream.
|
// It's up to the caller to close the stream.
|
||||||
func (cli *Client) ContainerLogs(options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
func (cli *Client) ContainerLogs(options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
if options.ShowStdout {
|
if options.ShowStdout {
|
||||||
query.Set("stdout", "1")
|
query.Set("stdout", "1")
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
// VolumeList returns the volumes configured in the docker host.
|
// VolumeList returns the volumes configured in the docker host.
|
||||||
func (cli *Client) VolumeList(filter filters.Args) (types.VolumesListResponse, error) {
|
func (cli *Client) VolumeList(filter filters.Args) (types.VolumesListResponse, error) {
|
||||||
var volumes types.VolumesListResponse
|
var volumes types.VolumesListResponse
|
||||||
var query url.Values
|
query := url.Values{}
|
||||||
|
|
||||||
if filter.Len() > 0 {
|
if filter.Len() > 0 {
|
||||||
filterJSON, err := filters.ToParam(filter)
|
filterJSON, err := filters.ToParam(filter)
|
||||||
|
|
Loading…
Reference in New Issue