Upgrade docker sdk
This commit is contained in:
parent
c5e5adb0e2
commit
c1263487a5
@ -98,7 +98,7 @@ func getClusterKubeConfigPath(cluster string) (string, error) {
|
|||||||
|
|
||||||
func createKubeConfigFile(cluster string) error {
|
func createKubeConfigFile(cluster string) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ func getClusterStatus(server types.Container, workers []types.Container) string
|
|||||||
// be empty if no matching cluster is found.
|
// be empty if no matching cluster is found.
|
||||||
func getClusters(all bool, name string) (map[string]cluster, error) {
|
func getClusters(all bool, name string) (map[string]cluster, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return nil, fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ const (
|
|||||||
func CheckTools(c *cli.Context) error {
|
func CheckTools(c *cli.Context) error {
|
||||||
log.Print("Checking docker...")
|
log.Print("Checking docker...")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ func CreateCluster(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ func StopCluster(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ func StartCluster(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,13 @@ type ClusterSpec struct {
|
|||||||
func startContainer(verbose bool, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (string, error) {
|
func startContainer(verbose bool, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (string, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return "", fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := docker.ContainerCreate(ctx, config, hostConfig, networkingConfig, containerName)
|
resp, err := docker.ContainerCreate(ctx, config, hostConfig, networkingConfig, containerName)
|
||||||
if client.IsErrImageNotFound(err) {
|
if client.IsErrNotFound(err) {
|
||||||
log.Printf("Pulling image %s...\n", config.Image)
|
log.Printf("Pulling image %s...\n", config.Image)
|
||||||
reader, err := docker.ImagePull(ctx, config.Image, types.ImagePullOptions{})
|
reader, err := docker.ImagePull(ctx, config.Image, types.ImagePullOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -219,7 +219,7 @@ func createWorker(spec *ClusterSpec, postfix int) (string, error) {
|
|||||||
// removeContainer tries to rm a container, selected by Docker ID, and does a rm -f if it fails (e.g. if container is still running)
|
// removeContainer tries to rm a container, selected by Docker ID, and does a rm -f if it fails (e.g. if container is still running)
|
||||||
func removeContainer(ID string) error {
|
func removeContainer(ID string) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ const (
|
|||||||
func importImage(clusterName string, images []string, noRemove bool) error {
|
func importImage(clusterName string, images []string, noRemove bool) error {
|
||||||
// get a docker client
|
// get a docker client
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
@ -142,7 +142,10 @@ func importImage(clusterName string, images []string, noRemove bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attach to exec process in container
|
// attach to exec process in container
|
||||||
containerConnection, err := docker.ContainerExecAttach(ctx, execResponse.ID, execAttachConfig)
|
containerConnection, err := docker.ContainerExecAttach(ctx, execResponse.ID, types.ExecStartCheck{
|
||||||
|
Detach: execAttachConfig.Detach,
|
||||||
|
Tty: execAttachConfig.Tty,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't attach to container [%s]\n%+v", containerName, err)
|
return fmt.Errorf("ERROR: couldn't attach to container [%s]\n%+v", containerName, err)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ func k3dNetworkName(clusterName string) string {
|
|||||||
// to let the server and worker containers communicate with each other easily.
|
// to let the server and worker containers communicate with each other easily.
|
||||||
func createClusterNetwork(clusterName string) (string, error) {
|
func createClusterNetwork(clusterName string) (string, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return "", fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ func createClusterNetwork(clusterName string) (string, error) {
|
|||||||
// deleteClusterNetwork deletes a docker network based on the name of a cluster it belongs to
|
// deleteClusterNetwork deletes a docker network based on the name of a cluster it belongs to
|
||||||
func deleteClusterNetwork(clusterName string) error {
|
func deleteClusterNetwork(clusterName string) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,14 @@ func createImageVolume(clusterName string) (types.Volume, error) {
|
|||||||
var vol types.Volume
|
var vol types.Volume
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return vol, fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return vol, fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
volName := fmt.Sprintf("k3d-%s-images", clusterName)
|
volName := fmt.Sprintf("k3d-%s-images", clusterName)
|
||||||
|
|
||||||
volumeCreateOptions := volume.VolumesCreateBody{
|
volumeCreateOptions := volume.VolumeCreateBody{
|
||||||
Name: volName,
|
Name: volName,
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"app": "k3d",
|
"app": "k3d",
|
||||||
@ -44,7 +44,7 @@ func createImageVolume(clusterName string) (types.Volume, error) {
|
|||||||
func deleteImageVolume(clusterName string) error {
|
func deleteImageVolume(clusterName string) error {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ func getImageVolume(clusterName string) (types.Volume, error) {
|
|||||||
volName := fmt.Sprintf("k3d-%s-images", clusterName)
|
volName := fmt.Sprintf("k3d-%s-images", clusterName)
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
docker, err := client.NewEnvClient()
|
docker, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.38"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return vol, fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
return vol, fmt.Errorf("ERROR: couldn't create docker client\n%+v", err)
|
||||||
}
|
}
|
||||||
|
7
go.mod
7
go.mod
@ -4,16 +4,21 @@ go 1.12
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Microsoft/go-winio v0.4.12 // indirect
|
github.com/Microsoft/go-winio v0.4.12 // indirect
|
||||||
|
github.com/containerd/containerd v1.2.7 // indirect
|
||||||
github.com/docker/distribution v2.7.1+incompatible // indirect
|
github.com/docker/distribution v2.7.1+incompatible // indirect
|
||||||
github.com/docker/docker v1.13.1
|
github.com/docker/docker v0.7.3-0.20190723064612-a9dc697fd2a5
|
||||||
github.com/docker/go-connections v0.4.0
|
github.com/docker/go-connections v0.4.0
|
||||||
github.com/docker/go-units v0.3.3 // indirect
|
github.com/docker/go-units v0.3.3 // indirect
|
||||||
|
github.com/gogo/protobuf v1.2.1 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
github.com/olekukonko/tablewriter v0.0.1
|
github.com/olekukonko/tablewriter v0.0.1
|
||||||
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
|
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
|
||||||
|
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||||
github.com/pkg/errors v0.8.1 // indirect
|
github.com/pkg/errors v0.8.1 // indirect
|
||||||
|
github.com/sirupsen/logrus v1.4.2 // indirect
|
||||||
github.com/stretchr/testify v1.3.0 // indirect
|
github.com/stretchr/testify v1.3.0 // indirect
|
||||||
github.com/urfave/cli v1.20.0
|
github.com/urfave/cli v1.20.0
|
||||||
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b // indirect
|
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b // indirect
|
||||||
|
google.golang.org/grpc v1.22.0 // indirect
|
||||||
)
|
)
|
||||||
|
40
go.sum
40
go.sum
@ -1,15 +1,34 @@
|
|||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc=
|
github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc=
|
||||||
github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/containerd/containerd v1.2.7 h1:8lqLbl7u1j3MmiL9cJ/O275crSq7bfwUayvvatEupQk=
|
||||||
|
github.com/containerd/containerd v1.2.7/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
|
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
|
||||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
|
github.com/docker/docker v0.7.3-0.20190723064612-a9dc697fd2a5 h1:7gpSLDzIX1hABRGvQdm+lBSHxpsHunr5m77wK/VxvNY=
|
||||||
|
github.com/docker/docker v0.7.3-0.20190723064612-a9dc697fd2a5/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
|
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
|
||||||
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||||
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||||
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
|
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
|
||||||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||||
|
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
|
||||||
|
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
||||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||||
@ -18,18 +37,39 @@ github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8u
|
|||||||
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||||
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
|
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
|
||||||
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||||
|
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
||||||
|
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||||
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b h1:/zjbcJPEGAyu6Is/VBOALsgdi4z9+kz/Vtdm6S+beD0=
|
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b h1:/zjbcJPEGAyu6Is/VBOALsgdi4z9+kz/Vtdm6S+beD0=
|
||||||
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
|
||||||
|
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||||
|
google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=
|
||||||
|
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
191
vendor/github.com/containerd/containerd/LICENSE
generated
vendored
Normal file
191
vendor/github.com/containerd/containerd/LICENSE
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
https://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Copyright The containerd Authors
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
16
vendor/github.com/containerd/containerd/NOTICE
generated
vendored
Normal file
16
vendor/github.com/containerd/containerd/NOTICE
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Docker
|
||||||
|
Copyright 2012-2015 Docker, Inc.
|
||||||
|
|
||||||
|
This product includes software developed at Docker, Inc. (https://www.docker.com).
|
||||||
|
|
||||||
|
The following is courtesy of our legal counsel:
|
||||||
|
|
||||||
|
|
||||||
|
Use and transfer of Docker may be subject to certain restrictions by the
|
||||||
|
United States and other governments.
|
||||||
|
It is your responsibility to ensure that your use and/or transfer does not
|
||||||
|
violate applicable laws.
|
||||||
|
|
||||||
|
For more information, please see https://www.bis.doc.gov
|
||||||
|
|
||||||
|
See also https://www.apache.org/dev/crypto.html and/or seek legal counsel.
|
78
vendor/github.com/containerd/containerd/errdefs/errors.go
generated
vendored
Normal file
78
vendor/github.com/containerd/containerd/errdefs/errors.go
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package errdefs defines the common errors used throughout containerd
|
||||||
|
// packages.
|
||||||
|
//
|
||||||
|
// Use with errors.Wrap and error.Wrapf to add context to an error.
|
||||||
|
//
|
||||||
|
// To detect an error class, use the IsXXX functions to tell whether an error
|
||||||
|
// is of a certain type.
|
||||||
|
//
|
||||||
|
// The functions ToGRPC and FromGRPC can be used to map server-side and
|
||||||
|
// client-side errors to the correct types.
|
||||||
|
package errdefs
|
||||||
|
|
||||||
|
import "github.com/pkg/errors"
|
||||||
|
|
||||||
|
// Definitions of common error types used throughout containerd. All containerd
|
||||||
|
// errors returned by most packages will map into one of these errors classes.
|
||||||
|
// Packages should return errors of these types when they want to instruct a
|
||||||
|
// client to take a particular action.
|
||||||
|
//
|
||||||
|
// For the most part, we just try to provide local grpc errors. Most conditions
|
||||||
|
// map very well to those defined by grpc.
|
||||||
|
var (
|
||||||
|
ErrUnknown = errors.New("unknown") // used internally to represent a missed mapping.
|
||||||
|
ErrInvalidArgument = errors.New("invalid argument")
|
||||||
|
ErrNotFound = errors.New("not found")
|
||||||
|
ErrAlreadyExists = errors.New("already exists")
|
||||||
|
ErrFailedPrecondition = errors.New("failed precondition")
|
||||||
|
ErrUnavailable = errors.New("unavailable")
|
||||||
|
ErrNotImplemented = errors.New("not implemented") // represents not supported and unimplemented
|
||||||
|
)
|
||||||
|
|
||||||
|
// IsInvalidArgument returns true if the error is due to an invalid argument
|
||||||
|
func IsInvalidArgument(err error) bool {
|
||||||
|
return errors.Cause(err) == ErrInvalidArgument
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsNotFound returns true if the error is due to a missing object
|
||||||
|
func IsNotFound(err error) bool {
|
||||||
|
return errors.Cause(err) == ErrNotFound
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsAlreadyExists returns true if the error is due to an already existing
|
||||||
|
// metadata item
|
||||||
|
func IsAlreadyExists(err error) bool {
|
||||||
|
return errors.Cause(err) == ErrAlreadyExists
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsFailedPrecondition returns true if an operation could not proceed to the
|
||||||
|
// lack of a particular condition
|
||||||
|
func IsFailedPrecondition(err error) bool {
|
||||||
|
return errors.Cause(err) == ErrFailedPrecondition
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsUnavailable returns true if the error is due to a resource being unavailable
|
||||||
|
func IsUnavailable(err error) bool {
|
||||||
|
return errors.Cause(err) == ErrUnavailable
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsNotImplemented returns true if the error is due to not being implemented
|
||||||
|
func IsNotImplemented(err error) bool {
|
||||||
|
return errors.Cause(err) == ErrNotImplemented
|
||||||
|
}
|
138
vendor/github.com/containerd/containerd/errdefs/grpc.go
generated
vendored
Normal file
138
vendor/github.com/containerd/containerd/errdefs/grpc.go
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package errdefs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ToGRPC will attempt to map the backend containerd error into a grpc error,
|
||||||
|
// using the original error message as a description.
|
||||||
|
//
|
||||||
|
// Further information may be extracted from certain errors depending on their
|
||||||
|
// type.
|
||||||
|
//
|
||||||
|
// If the error is unmapped, the original error will be returned to be handled
|
||||||
|
// by the regular grpc error handling stack.
|
||||||
|
func ToGRPC(err error) error {
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if isGRPCError(err) {
|
||||||
|
// error has already been mapped to grpc
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case IsInvalidArgument(err):
|
||||||
|
return status.Errorf(codes.InvalidArgument, err.Error())
|
||||||
|
case IsNotFound(err):
|
||||||
|
return status.Errorf(codes.NotFound, err.Error())
|
||||||
|
case IsAlreadyExists(err):
|
||||||
|
return status.Errorf(codes.AlreadyExists, err.Error())
|
||||||
|
case IsFailedPrecondition(err):
|
||||||
|
return status.Errorf(codes.FailedPrecondition, err.Error())
|
||||||
|
case IsUnavailable(err):
|
||||||
|
return status.Errorf(codes.Unavailable, err.Error())
|
||||||
|
case IsNotImplemented(err):
|
||||||
|
return status.Errorf(codes.Unimplemented, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToGRPCf maps the error to grpc error codes, assembling the formatting string
|
||||||
|
// and combining it with the target error string.
|
||||||
|
//
|
||||||
|
// This is equivalent to errors.ToGRPC(errors.Wrapf(err, format, args...))
|
||||||
|
func ToGRPCf(err error, format string, args ...interface{}) error {
|
||||||
|
return ToGRPC(errors.Wrapf(err, format, args...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromGRPC returns the underlying error from a grpc service based on the grpc error code
|
||||||
|
func FromGRPC(err error) error {
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var cls error // divide these into error classes, becomes the cause
|
||||||
|
|
||||||
|
switch code(err) {
|
||||||
|
case codes.InvalidArgument:
|
||||||
|
cls = ErrInvalidArgument
|
||||||
|
case codes.AlreadyExists:
|
||||||
|
cls = ErrAlreadyExists
|
||||||
|
case codes.NotFound:
|
||||||
|
cls = ErrNotFound
|
||||||
|
case codes.Unavailable:
|
||||||
|
cls = ErrUnavailable
|
||||||
|
case codes.FailedPrecondition:
|
||||||
|
cls = ErrFailedPrecondition
|
||||||
|
case codes.Unimplemented:
|
||||||
|
cls = ErrNotImplemented
|
||||||
|
default:
|
||||||
|
cls = ErrUnknown
|
||||||
|
}
|
||||||
|
|
||||||
|
msg := rebaseMessage(cls, err)
|
||||||
|
if msg != "" {
|
||||||
|
err = errors.Wrapf(cls, msg)
|
||||||
|
} else {
|
||||||
|
err = errors.WithStack(cls)
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// rebaseMessage removes the repeats for an error at the end of an error
|
||||||
|
// string. This will happen when taking an error over grpc then remapping it.
|
||||||
|
//
|
||||||
|
// Effectively, we just remove the string of cls from the end of err if it
|
||||||
|
// appears there.
|
||||||
|
func rebaseMessage(cls error, err error) string {
|
||||||
|
desc := errDesc(err)
|
||||||
|
clss := cls.Error()
|
||||||
|
if desc == clss {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimSuffix(desc, ": "+clss)
|
||||||
|
}
|
||||||
|
|
||||||
|
func isGRPCError(err error) bool {
|
||||||
|
_, ok := status.FromError(err)
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func code(err error) codes.Code {
|
||||||
|
if s, ok := status.FromError(err); ok {
|
||||||
|
return s.Code()
|
||||||
|
}
|
||||||
|
return codes.Unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
func errDesc(err error) string {
|
||||||
|
if s, ok := status.FromError(err); ok {
|
||||||
|
return s.Message()
|
||||||
|
}
|
||||||
|
return err.Error()
|
||||||
|
}
|
267
vendor/github.com/docker/distribution/registry/api/errcode/errors.go
generated
vendored
Normal file
267
vendor/github.com/docker/distribution/registry/api/errcode/errors.go
generated
vendored
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
package errcode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ErrorCoder is the base interface for ErrorCode and Error allowing
|
||||||
|
// users of each to just call ErrorCode to get the real ID of each
|
||||||
|
type ErrorCoder interface {
|
||||||
|
ErrorCode() ErrorCode
|
||||||
|
}
|
||||||
|
|
||||||
|
// ErrorCode represents the error type. The errors are serialized via strings
|
||||||
|
// and the integer format may change and should *never* be exported.
|
||||||
|
type ErrorCode int
|
||||||
|
|
||||||
|
var _ error = ErrorCode(0)
|
||||||
|
|
||||||
|
// ErrorCode just returns itself
|
||||||
|
func (ec ErrorCode) ErrorCode() ErrorCode {
|
||||||
|
return ec
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error returns the ID/Value
|
||||||
|
func (ec ErrorCode) Error() string {
|
||||||
|
// NOTE(stevvooe): Cannot use message here since it may have unpopulated args.
|
||||||
|
return strings.ToLower(strings.Replace(ec.String(), "_", " ", -1))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Descriptor returns the descriptor for the error code.
|
||||||
|
func (ec ErrorCode) Descriptor() ErrorDescriptor {
|
||||||
|
d, ok := errorCodeToDescriptors[ec]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
return ErrorCodeUnknown.Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns the canonical identifier for this error code.
|
||||||
|
func (ec ErrorCode) String() string {
|
||||||
|
return ec.Descriptor().Value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Message returned the human-readable error message for this error code.
|
||||||
|
func (ec ErrorCode) Message() string {
|
||||||
|
return ec.Descriptor().Message
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalText encodes the receiver into UTF-8-encoded text and returns the
|
||||||
|
// result.
|
||||||
|
func (ec ErrorCode) MarshalText() (text []byte, err error) {
|
||||||
|
return []byte(ec.String()), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalText decodes the form generated by MarshalText.
|
||||||
|
func (ec *ErrorCode) UnmarshalText(text []byte) error {
|
||||||
|
desc, ok := idToDescriptors[string(text)]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
desc = ErrorCodeUnknown.Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
*ec = desc.Code
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithMessage creates a new Error struct based on the passed-in info and
|
||||||
|
// overrides the Message property.
|
||||||
|
func (ec ErrorCode) WithMessage(message string) Error {
|
||||||
|
return Error{
|
||||||
|
Code: ec,
|
||||||
|
Message: message,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDetail creates a new Error struct based on the passed-in info and
|
||||||
|
// set the Detail property appropriately
|
||||||
|
func (ec ErrorCode) WithDetail(detail interface{}) Error {
|
||||||
|
return Error{
|
||||||
|
Code: ec,
|
||||||
|
Message: ec.Message(),
|
||||||
|
}.WithDetail(detail)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithArgs creates a new Error struct and sets the Args slice
|
||||||
|
func (ec ErrorCode) WithArgs(args ...interface{}) Error {
|
||||||
|
return Error{
|
||||||
|
Code: ec,
|
||||||
|
Message: ec.Message(),
|
||||||
|
}.WithArgs(args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error provides a wrapper around ErrorCode with extra Details provided.
|
||||||
|
type Error struct {
|
||||||
|
Code ErrorCode `json:"code"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
Detail interface{} `json:"detail,omitempty"`
|
||||||
|
|
||||||
|
// TODO(duglin): See if we need an "args" property so we can do the
|
||||||
|
// variable substitution right before showing the message to the user
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ error = Error{}
|
||||||
|
|
||||||
|
// ErrorCode returns the ID/Value of this Error
|
||||||
|
func (e Error) ErrorCode() ErrorCode {
|
||||||
|
return e.Code
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error returns a human readable representation of the error.
|
||||||
|
func (e Error) Error() string {
|
||||||
|
return fmt.Sprintf("%s: %s", e.Code.Error(), e.Message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDetail will return a new Error, based on the current one, but with
|
||||||
|
// some Detail info added
|
||||||
|
func (e Error) WithDetail(detail interface{}) Error {
|
||||||
|
return Error{
|
||||||
|
Code: e.Code,
|
||||||
|
Message: e.Message,
|
||||||
|
Detail: detail,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithArgs uses the passed-in list of interface{} as the substitution
|
||||||
|
// variables in the Error's Message string, but returns a new Error
|
||||||
|
func (e Error) WithArgs(args ...interface{}) Error {
|
||||||
|
return Error{
|
||||||
|
Code: e.Code,
|
||||||
|
Message: fmt.Sprintf(e.Code.Message(), args...),
|
||||||
|
Detail: e.Detail,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ErrorDescriptor provides relevant information about a given error code.
|
||||||
|
type ErrorDescriptor struct {
|
||||||
|
// Code is the error code that this descriptor describes.
|
||||||
|
Code ErrorCode
|
||||||
|
|
||||||
|
// Value provides a unique, string key, often captilized with
|
||||||
|
// underscores, to identify the error code. This value is used as the
|
||||||
|
// keyed value when serializing api errors.
|
||||||
|
Value string
|
||||||
|
|
||||||
|
// Message is a short, human readable decription of the error condition
|
||||||
|
// included in API responses.
|
||||||
|
Message string
|
||||||
|
|
||||||
|
// Description provides a complete account of the errors purpose, suitable
|
||||||
|
// for use in documentation.
|
||||||
|
Description string
|
||||||
|
|
||||||
|
// HTTPStatusCode provides the http status code that is associated with
|
||||||
|
// this error condition.
|
||||||
|
HTTPStatusCode int
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseErrorCode returns the value by the string error code.
|
||||||
|
// `ErrorCodeUnknown` will be returned if the error is not known.
|
||||||
|
func ParseErrorCode(value string) ErrorCode {
|
||||||
|
ed, ok := idToDescriptors[value]
|
||||||
|
if ok {
|
||||||
|
return ed.Code
|
||||||
|
}
|
||||||
|
|
||||||
|
return ErrorCodeUnknown
|
||||||
|
}
|
||||||
|
|
||||||
|
// Errors provides the envelope for multiple errors and a few sugar methods
|
||||||
|
// for use within the application.
|
||||||
|
type Errors []error
|
||||||
|
|
||||||
|
var _ error = Errors{}
|
||||||
|
|
||||||
|
func (errs Errors) Error() string {
|
||||||
|
switch len(errs) {
|
||||||
|
case 0:
|
||||||
|
return "<nil>"
|
||||||
|
case 1:
|
||||||
|
return errs[0].Error()
|
||||||
|
default:
|
||||||
|
msg := "errors:\n"
|
||||||
|
for _, err := range errs {
|
||||||
|
msg += err.Error() + "\n"
|
||||||
|
}
|
||||||
|
return msg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Len returns the current number of errors.
|
||||||
|
func (errs Errors) Len() int {
|
||||||
|
return len(errs)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON converts slice of error, ErrorCode or Error into a
|
||||||
|
// slice of Error - then serializes
|
||||||
|
func (errs Errors) MarshalJSON() ([]byte, error) {
|
||||||
|
var tmpErrs struct {
|
||||||
|
Errors []Error `json:"errors,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, daErr := range errs {
|
||||||
|
var err Error
|
||||||
|
|
||||||
|
switch daErr.(type) {
|
||||||
|
case ErrorCode:
|
||||||
|
err = daErr.(ErrorCode).WithDetail(nil)
|
||||||
|
case Error:
|
||||||
|
err = daErr.(Error)
|
||||||
|
default:
|
||||||
|
err = ErrorCodeUnknown.WithDetail(daErr)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the Error struct was setup and they forgot to set the
|
||||||
|
// Message field (meaning its "") then grab it from the ErrCode
|
||||||
|
msg := err.Message
|
||||||
|
if msg == "" {
|
||||||
|
msg = err.Code.Message()
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpErrs.Errors = append(tmpErrs.Errors, Error{
|
||||||
|
Code: err.Code,
|
||||||
|
Message: msg,
|
||||||
|
Detail: err.Detail,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return json.Marshal(tmpErrs)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON deserializes []Error and then converts it into slice of
|
||||||
|
// Error or ErrorCode
|
||||||
|
func (errs *Errors) UnmarshalJSON(data []byte) error {
|
||||||
|
var tmpErrs struct {
|
||||||
|
Errors []Error
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := json.Unmarshal(data, &tmpErrs); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var newErrs Errors
|
||||||
|
for _, daErr := range tmpErrs.Errors {
|
||||||
|
// If Message is empty or exactly matches the Code's message string
|
||||||
|
// then just use the Code, no need for a full Error struct
|
||||||
|
if daErr.Detail == nil && (daErr.Message == "" || daErr.Message == daErr.Code.Message()) {
|
||||||
|
// Error's w/o details get converted to ErrorCode
|
||||||
|
newErrs = append(newErrs, daErr.Code)
|
||||||
|
} else {
|
||||||
|
// Error's w/ details are untouched
|
||||||
|
newErrs = append(newErrs, Error{
|
||||||
|
Code: daErr.Code,
|
||||||
|
Message: daErr.Message,
|
||||||
|
Detail: daErr.Detail,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*errs = newErrs
|
||||||
|
return nil
|
||||||
|
}
|
40
vendor/github.com/docker/distribution/registry/api/errcode/handler.go
generated
vendored
Normal file
40
vendor/github.com/docker/distribution/registry/api/errcode/handler.go
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package errcode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ServeJSON attempts to serve the errcode in a JSON envelope. It marshals err
|
||||||
|
// and sets the content-type header to 'application/json'. It will handle
|
||||||
|
// ErrorCoder and Errors, and if necessary will create an envelope.
|
||||||
|
func ServeJSON(w http.ResponseWriter, err error) error {
|
||||||
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
var sc int
|
||||||
|
|
||||||
|
switch errs := err.(type) {
|
||||||
|
case Errors:
|
||||||
|
if len(errs) < 1 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if err, ok := errs[0].(ErrorCoder); ok {
|
||||||
|
sc = err.ErrorCode().Descriptor().HTTPStatusCode
|
||||||
|
}
|
||||||
|
case ErrorCoder:
|
||||||
|
sc = errs.ErrorCode().Descriptor().HTTPStatusCode
|
||||||
|
err = Errors{err} // create an envelope.
|
||||||
|
default:
|
||||||
|
// We just have an unhandled error type, so just place in an envelope
|
||||||
|
// and move along.
|
||||||
|
err = Errors{err}
|
||||||
|
}
|
||||||
|
|
||||||
|
if sc == 0 {
|
||||||
|
sc = http.StatusInternalServerError
|
||||||
|
}
|
||||||
|
|
||||||
|
w.WriteHeader(sc)
|
||||||
|
|
||||||
|
return json.NewEncoder(w).Encode(err)
|
||||||
|
}
|
138
vendor/github.com/docker/distribution/registry/api/errcode/register.go
generated
vendored
Normal file
138
vendor/github.com/docker/distribution/registry/api/errcode/register.go
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
package errcode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"sort"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
errorCodeToDescriptors = map[ErrorCode]ErrorDescriptor{}
|
||||||
|
idToDescriptors = map[string]ErrorDescriptor{}
|
||||||
|
groupToDescriptors = map[string][]ErrorDescriptor{}
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrorCodeUnknown is a generic error that can be used as a last
|
||||||
|
// resort if there is no situation-specific error message that can be used
|
||||||
|
ErrorCodeUnknown = Register("errcode", ErrorDescriptor{
|
||||||
|
Value: "UNKNOWN",
|
||||||
|
Message: "unknown error",
|
||||||
|
Description: `Generic error returned when the error does not have an
|
||||||
|
API classification.`,
|
||||||
|
HTTPStatusCode: http.StatusInternalServerError,
|
||||||
|
})
|
||||||
|
|
||||||
|
// ErrorCodeUnsupported is returned when an operation is not supported.
|
||||||
|
ErrorCodeUnsupported = Register("errcode", ErrorDescriptor{
|
||||||
|
Value: "UNSUPPORTED",
|
||||||
|
Message: "The operation is unsupported.",
|
||||||
|
Description: `The operation was unsupported due to a missing
|
||||||
|
implementation or invalid set of parameters.`,
|
||||||
|
HTTPStatusCode: http.StatusMethodNotAllowed,
|
||||||
|
})
|
||||||
|
|
||||||
|
// ErrorCodeUnauthorized is returned if a request requires
|
||||||
|
// authentication.
|
||||||
|
ErrorCodeUnauthorized = Register("errcode", ErrorDescriptor{
|
||||||
|
Value: "UNAUTHORIZED",
|
||||||
|
Message: "authentication required",
|
||||||
|
Description: `The access controller was unable to authenticate
|
||||||
|
the client. Often this will be accompanied by a
|
||||||
|
Www-Authenticate HTTP response header indicating how to
|
||||||
|
authenticate.`,
|
||||||
|
HTTPStatusCode: http.StatusUnauthorized,
|
||||||
|
})
|
||||||
|
|
||||||
|
// ErrorCodeDenied is returned if a client does not have sufficient
|
||||||
|
// permission to perform an action.
|
||||||
|
ErrorCodeDenied = Register("errcode", ErrorDescriptor{
|
||||||
|
Value: "DENIED",
|
||||||
|
Message: "requested access to the resource is denied",
|
||||||
|
Description: `The access controller denied access for the
|
||||||
|
operation on a resource.`,
|
||||||
|
HTTPStatusCode: http.StatusForbidden,
|
||||||
|
})
|
||||||
|
|
||||||
|
// ErrorCodeUnavailable provides a common error to report unavailability
|
||||||
|
// of a service or endpoint.
|
||||||
|
ErrorCodeUnavailable = Register("errcode", ErrorDescriptor{
|
||||||
|
Value: "UNAVAILABLE",
|
||||||
|
Message: "service unavailable",
|
||||||
|
Description: "Returned when a service is not available",
|
||||||
|
HTTPStatusCode: http.StatusServiceUnavailable,
|
||||||
|
})
|
||||||
|
|
||||||
|
// ErrorCodeTooManyRequests is returned if a client attempts too many
|
||||||
|
// times to contact a service endpoint.
|
||||||
|
ErrorCodeTooManyRequests = Register("errcode", ErrorDescriptor{
|
||||||
|
Value: "TOOMANYREQUESTS",
|
||||||
|
Message: "too many requests",
|
||||||
|
Description: `Returned when a client attempts to contact a
|
||||||
|
service too many times`,
|
||||||
|
HTTPStatusCode: http.StatusTooManyRequests,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
var nextCode = 1000
|
||||||
|
var registerLock sync.Mutex
|
||||||
|
|
||||||
|
// Register will make the passed-in error known to the environment and
|
||||||
|
// return a new ErrorCode
|
||||||
|
func Register(group string, descriptor ErrorDescriptor) ErrorCode {
|
||||||
|
registerLock.Lock()
|
||||||
|
defer registerLock.Unlock()
|
||||||
|
|
||||||
|
descriptor.Code = ErrorCode(nextCode)
|
||||||
|
|
||||||
|
if _, ok := idToDescriptors[descriptor.Value]; ok {
|
||||||
|
panic(fmt.Sprintf("ErrorValue %q is already registered", descriptor.Value))
|
||||||
|
}
|
||||||
|
if _, ok := errorCodeToDescriptors[descriptor.Code]; ok {
|
||||||
|
panic(fmt.Sprintf("ErrorCode %v is already registered", descriptor.Code))
|
||||||
|
}
|
||||||
|
|
||||||
|
groupToDescriptors[group] = append(groupToDescriptors[group], descriptor)
|
||||||
|
errorCodeToDescriptors[descriptor.Code] = descriptor
|
||||||
|
idToDescriptors[descriptor.Value] = descriptor
|
||||||
|
|
||||||
|
nextCode++
|
||||||
|
return descriptor.Code
|
||||||
|
}
|
||||||
|
|
||||||
|
type byValue []ErrorDescriptor
|
||||||
|
|
||||||
|
func (a byValue) Len() int { return len(a) }
|
||||||
|
func (a byValue) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
|
func (a byValue) Less(i, j int) bool { return a[i].Value < a[j].Value }
|
||||||
|
|
||||||
|
// GetGroupNames returns the list of Error group names that are registered
|
||||||
|
func GetGroupNames() []string {
|
||||||
|
keys := []string{}
|
||||||
|
|
||||||
|
for k := range groupToDescriptors {
|
||||||
|
keys = append(keys, k)
|
||||||
|
}
|
||||||
|
sort.Strings(keys)
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetErrorCodeGroup returns the named group of error descriptors
|
||||||
|
func GetErrorCodeGroup(name string) []ErrorDescriptor {
|
||||||
|
desc := groupToDescriptors[name]
|
||||||
|
sort.Sort(byValue(desc))
|
||||||
|
return desc
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetErrorAllDescriptors returns a slice of all ErrorDescriptors that are
|
||||||
|
// registered, irrespective of what group they're in
|
||||||
|
func GetErrorAllDescriptors() []ErrorDescriptor {
|
||||||
|
result := []ErrorDescriptor{}
|
||||||
|
|
||||||
|
for _, group := range GetGroupNames() {
|
||||||
|
result = append(result, GetErrorCodeGroup(group)...)
|
||||||
|
}
|
||||||
|
sort.Sort(byValue(result))
|
||||||
|
return result
|
||||||
|
}
|
690
vendor/github.com/docker/docker/AUTHORS
generated
vendored
690
vendor/github.com/docker/docker/AUTHORS
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/github.com/docker/docker/LICENSE
generated
vendored
2
vendor/github.com/docker/docker/LICENSE
generated
vendored
@ -176,7 +176,7 @@
|
|||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
Copyright 2013-2016 Docker, Inc.
|
Copyright 2013-2018 Docker, Inc.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
2
vendor/github.com/docker/docker/NOTICE
generated
vendored
2
vendor/github.com/docker/docker/NOTICE
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
Docker
|
Docker
|
||||||
Copyright 2012-2016 Docker, Inc.
|
Copyright 2012-2017 Docker, Inc.
|
||||||
|
|
||||||
This product includes software developed at Docker, Inc. (https://www.docker.com).
|
This product includes software developed at Docker, Inc. (https://www.docker.com).
|
||||||
|
|
||||||
|
42
vendor/github.com/docker/docker/api/README.md
generated
vendored
Normal file
42
vendor/github.com/docker/docker/api/README.md
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Working on the Engine API
|
||||||
|
|
||||||
|
The Engine API is an HTTP API used by the command-line client to communicate with the daemon. It can also be used by third-party software to control the daemon.
|
||||||
|
|
||||||
|
It consists of various components in this repository:
|
||||||
|
|
||||||
|
- `api/swagger.yaml` A Swagger definition of the API.
|
||||||
|
- `api/types/` Types shared by both the client and server, representing various objects, options, responses, etc. Most are written manually, but some are automatically generated from the Swagger definition. See [#27919](https://github.com/docker/docker/issues/27919) for progress on this.
|
||||||
|
- `cli/` The command-line client.
|
||||||
|
- `client/` The Go client used by the command-line client. It can also be used by third-party Go programs.
|
||||||
|
- `daemon/` The daemon, which serves the API.
|
||||||
|
|
||||||
|
## Swagger definition
|
||||||
|
|
||||||
|
The API is defined by the [Swagger](http://swagger.io/specification/) definition in `api/swagger.yaml`. This definition can be used to:
|
||||||
|
|
||||||
|
1. Automatically generate documentation.
|
||||||
|
2. Automatically generate the Go server and client. (A work-in-progress.)
|
||||||
|
3. Provide a machine readable version of the API for introspecting what it can do, automatically generating clients for other languages, etc.
|
||||||
|
|
||||||
|
## Updating the API documentation
|
||||||
|
|
||||||
|
The API documentation is generated entirely from `api/swagger.yaml`. If you make updates to the API, edit this file to represent the change in the documentation.
|
||||||
|
|
||||||
|
The file is split into two main sections:
|
||||||
|
|
||||||
|
- `definitions`, which defines re-usable objects used in requests and responses
|
||||||
|
- `paths`, which defines the API endpoints (and some inline objects which don't need to be reusable)
|
||||||
|
|
||||||
|
To make an edit, first look for the endpoint you want to edit under `paths`, then make the required edits. Endpoints may reference reusable objects with `$ref`, which can be found in the `definitions` section.
|
||||||
|
|
||||||
|
There is hopefully enough example material in the file for you to copy a similar pattern from elsewhere in the file (e.g. adding new fields or endpoints), but for the full reference, see the [Swagger specification](https://github.com/docker/docker/issues/27919).
|
||||||
|
|
||||||
|
`swagger.yaml` is validated by `hack/validate/swagger` to ensure it is a valid Swagger definition. This is useful when making edits to ensure you are doing the right thing.
|
||||||
|
|
||||||
|
## Viewing the API documentation
|
||||||
|
|
||||||
|
When you make edits to `swagger.yaml`, you may want to check the generated API documentation to ensure it renders correctly.
|
||||||
|
|
||||||
|
Run `make swagger-docs` and a preview will be running at `http://localhost`. Some of the styling may be incorrect, but you'll be able to ensure that it is generating the correct documentation.
|
||||||
|
|
||||||
|
The production documentation is generated by vendoring `swagger.yaml` into [docker/docker.github.io](https://github.com/docker/docker.github.io).
|
11
vendor/github.com/docker/docker/api/common.go
generated
vendored
Normal file
11
vendor/github.com/docker/docker/api/common.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package api // import "github.com/docker/docker/api"
|
||||||
|
|
||||||
|
// Common constants for daemon and client.
|
||||||
|
const (
|
||||||
|
// DefaultVersion of Current REST API
|
||||||
|
DefaultVersion = "1.41"
|
||||||
|
|
||||||
|
// NoBaseImageSpecifier is the symbol used by the FROM
|
||||||
|
// command to specify that no base image is to be used.
|
||||||
|
NoBaseImageSpecifier = "scratch"
|
||||||
|
)
|
6
vendor/github.com/docker/docker/api/common_unix.go
generated
vendored
Normal file
6
vendor/github.com/docker/docker/api/common_unix.go
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package api // import "github.com/docker/docker/api"
|
||||||
|
|
||||||
|
// MinVersion represents Minimum REST API version supported
|
||||||
|
const MinVersion = "1.12"
|
8
vendor/github.com/docker/docker/api/common_windows.go
generated
vendored
Normal file
8
vendor/github.com/docker/docker/api/common_windows.go
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package api // import "github.com/docker/docker/api"
|
||||||
|
|
||||||
|
// MinVersion represents Minimum REST API version supported
|
||||||
|
// Technically the first daemon API version released on Windows is v1.25 in
|
||||||
|
// engine version 1.13. However, some clients are explicitly using downlevel
|
||||||
|
// APIs (e.g. docker-compose v2.1 file format) and that is just too restrictive.
|
||||||
|
// Hence also allowing 1.24 on Windows.
|
||||||
|
const MinVersion string = "1.24"
|
12
vendor/github.com/docker/docker/api/swagger-gen.yaml
generated
vendored
Normal file
12
vendor/github.com/docker/docker/api/swagger-gen.yaml
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
layout:
|
||||||
|
models:
|
||||||
|
- name: definition
|
||||||
|
source: asset:model
|
||||||
|
target: "{{ joinFilePath .Target .ModelPackage }}"
|
||||||
|
file_name: "{{ (snakize (pascalize .Name)) }}.go"
|
||||||
|
operations:
|
||||||
|
- name: handler
|
||||||
|
source: asset:serverOperation
|
||||||
|
target: "{{ joinFilePath .Target .APIPackage .Package }}"
|
||||||
|
file_name: "{{ (snakize (pascalize .Name)) }}.go"
|
10453
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
Normal file
10453
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
vendor/github.com/docker/docker/api/types/auth.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/auth.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
// AuthConfig contains authorization information for connecting to a Registry
|
// AuthConfig contains authorization information for connecting to a Registry
|
||||||
type AuthConfig struct {
|
type AuthConfig struct {
|
||||||
|
2
vendor/github.com/docker/docker/api/types/blkiodev/blkio.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/blkiodev/blkio.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package blkiodev
|
package blkiodev // import "github.com/docker/docker/api/types/blkiodev"
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
107
vendor/github.com/docker/docker/api/types/client.go
generated
vendored
107
vendor/github.com/docker/docker/api/types/client.go
generated
vendored
@ -1,14 +1,13 @@
|
|||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckpointCreateOptions holds parameters to create a checkpoint from a container
|
// CheckpointCreateOptions holds parameters to create a checkpoint from a container
|
||||||
@ -75,6 +74,7 @@ type ContainerLogsOptions struct {
|
|||||||
ShowStdout bool
|
ShowStdout bool
|
||||||
ShowStderr bool
|
ShowStderr bool
|
||||||
Since string
|
Since string
|
||||||
|
Until string
|
||||||
Timestamps bool
|
Timestamps bool
|
||||||
Follow bool
|
Follow bool
|
||||||
Tail string
|
Tail string
|
||||||
@ -98,6 +98,7 @@ type ContainerStartOptions struct {
|
|||||||
// about files to copy into a container
|
// about files to copy into a container
|
||||||
type CopyToContainerOptions struct {
|
type CopyToContainerOptions struct {
|
||||||
AllowOverwriteDirWithFile bool
|
AllowOverwriteDirWithFile bool
|
||||||
|
CopyUIDGID bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// EventsOptions holds parameters to filter events with.
|
// EventsOptions holds parameters to filter events with.
|
||||||
@ -160,9 +161,10 @@ type ImageBuildOptions struct {
|
|||||||
ShmSize int64
|
ShmSize int64
|
||||||
Dockerfile string
|
Dockerfile string
|
||||||
Ulimits []*units.Ulimit
|
Ulimits []*units.Ulimit
|
||||||
// See the parsing of buildArgs in api/server/router/build/build_routes.go
|
// BuildArgs needs to be a *string instead of just a string so that
|
||||||
// for an explaination of why BuildArgs needs to use *string instead of
|
// we can tell the difference between "" (empty string) and no value
|
||||||
// just a string
|
// at all (nil). See the parsing of buildArgs in
|
||||||
|
// api/server/router/build/build_routes.go for even more info.
|
||||||
BuildArgs map[string]*string
|
BuildArgs map[string]*string
|
||||||
AuthConfigs map[string]AuthConfig
|
AuthConfigs map[string]AuthConfig
|
||||||
Context io.Reader
|
Context io.Reader
|
||||||
@ -175,8 +177,37 @@ type ImageBuildOptions struct {
|
|||||||
// specified here do not need to have a valid parent chain to match cache.
|
// specified here do not need to have a valid parent chain to match cache.
|
||||||
CacheFrom []string
|
CacheFrom []string
|
||||||
SecurityOpt []string
|
SecurityOpt []string
|
||||||
|
ExtraHosts []string // List of extra hosts
|
||||||
|
Target string
|
||||||
|
SessionID string
|
||||||
|
Platform string
|
||||||
|
// Version specifies the version of the unerlying builder to use
|
||||||
|
Version BuilderVersion
|
||||||
|
// BuildID is an optional identifier that can be passed together with the
|
||||||
|
// build request. The same identifier can be used to gracefully cancel the
|
||||||
|
// build with the cancel request.
|
||||||
|
BuildID string
|
||||||
|
// Outputs defines configurations for exporting build results. Only supported
|
||||||
|
// in BuildKit mode
|
||||||
|
Outputs []ImageBuildOutput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ImageBuildOutput defines configuration for exporting a build result
|
||||||
|
type ImageBuildOutput struct {
|
||||||
|
Type string
|
||||||
|
Attrs map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuilderVersion sets the version of underlying builder to use
|
||||||
|
type BuilderVersion string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// BuilderV1 is the first generation builder in docker daemon
|
||||||
|
BuilderV1 BuilderVersion = "1"
|
||||||
|
// BuilderBuildKit is builder based on moby/buildkit project
|
||||||
|
BuilderBuildKit = "2"
|
||||||
|
)
|
||||||
|
|
||||||
// ImageBuildResponse holds information
|
// ImageBuildResponse holds information
|
||||||
// returned by a server after building
|
// returned by a server after building
|
||||||
// an image.
|
// an image.
|
||||||
@ -187,20 +218,22 @@ type ImageBuildResponse struct {
|
|||||||
|
|
||||||
// ImageCreateOptions holds information to create images.
|
// ImageCreateOptions holds information to create images.
|
||||||
type ImageCreateOptions struct {
|
type ImageCreateOptions struct {
|
||||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry.
|
||||||
|
Platform string // Platform is the target platform of the image if it needs to be pulled from the registry.
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageImportSource holds source information for ImageImport
|
// ImageImportSource holds source information for ImageImport
|
||||||
type ImageImportSource struct {
|
type ImageImportSource struct {
|
||||||
Source io.Reader // Source is the data to send to the server to create this image from (mutually exclusive with SourceName)
|
Source io.Reader // Source is the data to send to the server to create this image from. You must set SourceName to "-" to leverage this.
|
||||||
SourceName string // SourceName is the name of the image to pull (mutually exclusive with Source)
|
SourceName string // SourceName is the name of the image to pull. Set to "-" to leverage the Source attribute.
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageImportOptions holds information to import images from the client host.
|
// ImageImportOptions holds information to import images from the client host.
|
||||||
type ImageImportOptions struct {
|
type ImageImportOptions struct {
|
||||||
Tag string // Tag is the name to tag this image with. This attribute is deprecated.
|
Tag string // Tag is the name to tag this image with. This attribute is deprecated.
|
||||||
Message string // Message is the message to tag the image with
|
Message string // Message is the message to tag the image with
|
||||||
Changes []string // Changes are the raw changes to apply to this image
|
Changes []string // Changes are the raw changes to apply to this image
|
||||||
|
Platform string // Platform is the target platform of the image
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageListOptions holds parameters to filter the list of images with.
|
// ImageListOptions holds parameters to filter the list of images with.
|
||||||
@ -221,6 +254,7 @@ type ImagePullOptions struct {
|
|||||||
All bool
|
All bool
|
||||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
||||||
PrivilegeFunc RequestPrivilegeFunc
|
PrivilegeFunc RequestPrivilegeFunc
|
||||||
|
Platform string
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestPrivilegeFunc is a function interface that
|
// RequestPrivilegeFunc is a function interface that
|
||||||
@ -256,18 +290,6 @@ type ResizeOptions struct {
|
|||||||
Width uint
|
Width uint
|
||||||
}
|
}
|
||||||
|
|
||||||
// VersionResponse holds version information for the client and the server
|
|
||||||
type VersionResponse struct {
|
|
||||||
Client *Version
|
|
||||||
Server *Version
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServerOK returns true when the client could connect to the docker server
|
|
||||||
// and parse the information received. It returns false otherwise.
|
|
||||||
func (v VersionResponse) ServerOK() bool {
|
|
||||||
return v.Server != nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeListOptions holds parameters to list nodes with.
|
// NodeListOptions holds parameters to list nodes with.
|
||||||
type NodeListOptions struct {
|
type NodeListOptions struct {
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
@ -285,6 +307,12 @@ type ServiceCreateOptions struct {
|
|||||||
//
|
//
|
||||||
// This field follows the format of the X-Registry-Auth header.
|
// This field follows the format of the X-Registry-Auth header.
|
||||||
EncodedRegistryAuth string
|
EncodedRegistryAuth string
|
||||||
|
|
||||||
|
// QueryRegistry indicates whether the service update requires
|
||||||
|
// contacting a registry. A registry may be contacted to retrieve
|
||||||
|
// the image digest and manifest, which in turn can be used to update
|
||||||
|
// platform or other information about the service.
|
||||||
|
QueryRegistry bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServiceCreateResponse contains the information returned to a client
|
// ServiceCreateResponse contains the information returned to a client
|
||||||
@ -318,14 +346,32 @@ type ServiceUpdateOptions struct {
|
|||||||
// credentials if they are not given in EncodedRegistryAuth. Valid
|
// credentials if they are not given in EncodedRegistryAuth. Valid
|
||||||
// values are "spec" and "previous-spec".
|
// values are "spec" and "previous-spec".
|
||||||
RegistryAuthFrom string
|
RegistryAuthFrom string
|
||||||
|
|
||||||
|
// Rollback indicates whether a server-side rollback should be
|
||||||
|
// performed. When this is set, the provided spec will be ignored.
|
||||||
|
// The valid values are "previous" and "none". An empty value is the
|
||||||
|
// same as "none".
|
||||||
|
Rollback string
|
||||||
|
|
||||||
|
// QueryRegistry indicates whether the service update requires
|
||||||
|
// contacting a registry. A registry may be contacted to retrieve
|
||||||
|
// the image digest and manifest, which in turn can be used to update
|
||||||
|
// platform or other information about the service.
|
||||||
|
QueryRegistry bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServiceListOptions holds parameters to list services with.
|
// ServiceListOptions holds parameters to list services with.
|
||||||
type ServiceListOptions struct {
|
type ServiceListOptions struct {
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskListOptions holds parameters to list tasks with.
|
// ServiceInspectOptions holds parameters related to the "service inspect"
|
||||||
|
// operation.
|
||||||
|
type ServiceInspectOptions struct {
|
||||||
|
InsertDefaults bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// TaskListOptions holds parameters to list tasks with.
|
||||||
type TaskListOptions struct {
|
type TaskListOptions struct {
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
}
|
}
|
||||||
@ -356,15 +402,6 @@ type PluginInstallOptions struct {
|
|||||||
Args []string
|
Args []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecretRequestOption is a type for requesting secrets
|
|
||||||
type SecretRequestOption struct {
|
|
||||||
Source string
|
|
||||||
Target string
|
|
||||||
UID string
|
|
||||||
GID string
|
|
||||||
Mode os.FileMode
|
|
||||||
}
|
|
||||||
|
|
||||||
// SwarmUnlockKeyResponse contains the response for Engine API:
|
// SwarmUnlockKeyResponse contains the response for Engine API:
|
||||||
// GET /swarm/unlockkey
|
// GET /swarm/unlockkey
|
||||||
type SwarmUnlockKeyResponse struct {
|
type SwarmUnlockKeyResponse struct {
|
||||||
|
23
vendor/github.com/docker/docker/api/types/configs.go
generated
vendored
23
vendor/github.com/docker/docker/api/types/configs.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
@ -25,19 +25,6 @@ type ContainerRmConfig struct {
|
|||||||
ForceRemove, RemoveVolume, RemoveLink bool
|
ForceRemove, RemoveVolume, RemoveLink bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerCommitConfig contains build configs for commit operation,
|
|
||||||
// and is used when making a commit with the current state of the container.
|
|
||||||
type ContainerCommitConfig struct {
|
|
||||||
Pause bool
|
|
||||||
Repo string
|
|
||||||
Tag string
|
|
||||||
Author string
|
|
||||||
Comment string
|
|
||||||
// merge container config into commit config before commit
|
|
||||||
MergeConfigs bool
|
|
||||||
Config *container.Config
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExecConfig is a small subset of the Config struct that holds the configuration
|
// ExecConfig is a small subset of the Config struct that holds the configuration
|
||||||
// for the exec feature of docker.
|
// for the exec feature of docker.
|
||||||
type ExecConfig struct {
|
type ExecConfig struct {
|
||||||
@ -50,6 +37,7 @@ type ExecConfig struct {
|
|||||||
Detach bool // Execute in detach mode
|
Detach bool // Execute in detach mode
|
||||||
DetachKeys string // Escape keys for detach
|
DetachKeys string // Escape keys for detach
|
||||||
Env []string // Environment variables
|
Env []string // Environment variables
|
||||||
|
WorkingDir string // Working directory
|
||||||
Cmd []string // Execution commands and args
|
Cmd []string // Execution commands and args
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,3 +55,10 @@ type PluginEnableConfig struct {
|
|||||||
type PluginDisableConfig struct {
|
type PluginDisableConfig struct {
|
||||||
ForceDisable bool
|
ForceDisable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkListConfig stores the options available for listing networks
|
||||||
|
type NetworkListConfig struct {
|
||||||
|
// TODO(@cpuguy83): naming is hard, this is pulled from what was being used in the router before moving here
|
||||||
|
Detailed bool
|
||||||
|
Verbose bool
|
||||||
|
}
|
||||||
|
15
vendor/github.com/docker/docker/api/types/container/config.go
generated
vendored
15
vendor/github.com/docker/docker/api/types/container/config.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
@ -7,6 +7,12 @@ import (
|
|||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// MinimumDuration puts a minimum on user configured duration.
|
||||||
|
// This is to prevent API error on time unit. For example, API may
|
||||||
|
// set 3 as healthcheck interval with intention of 3 seconds, but
|
||||||
|
// Docker interprets it as 3 nanoseconds.
|
||||||
|
const MinimumDuration = 1 * time.Millisecond
|
||||||
|
|
||||||
// HealthConfig holds configuration settings for the HEALTHCHECK feature.
|
// HealthConfig holds configuration settings for the HEALTHCHECK feature.
|
||||||
type HealthConfig struct {
|
type HealthConfig struct {
|
||||||
// Test is the test to perform to check that the container is healthy.
|
// Test is the test to perform to check that the container is healthy.
|
||||||
@ -19,8 +25,9 @@ type HealthConfig struct {
|
|||||||
Test []string `json:",omitempty"`
|
Test []string `json:",omitempty"`
|
||||||
|
|
||||||
// Zero means to inherit. Durations are expressed as integer nanoseconds.
|
// Zero means to inherit. Durations are expressed as integer nanoseconds.
|
||||||
Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
|
Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
|
||||||
Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
|
Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
|
||||||
|
StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.
|
||||||
|
|
||||||
// Retries is the number of consecutive failures needed to consider a container as unhealthy.
|
// Retries is the number of consecutive failures needed to consider a container as unhealthy.
|
||||||
// Zero means inherit.
|
// Zero means inherit.
|
||||||
@ -47,7 +54,7 @@ type Config struct {
|
|||||||
Env []string // List of environment variable to set in the container
|
Env []string // List of environment variable to set in the container
|
||||||
Cmd strslice.StrSlice // Command to run when starting the container
|
Cmd strslice.StrSlice // Command to run when starting the container
|
||||||
Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
|
Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
|
||||||
ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific)
|
ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (meaning treat as a command line) (Windows specific).
|
||||||
Image string // Name of the image as it was passed by the operator (e.g. could be symbolic)
|
Image string // Name of the image as it was passed by the operator (e.g. could be symbolic)
|
||||||
Volumes map[string]struct{} // List of volumes (mounts) used for the container
|
Volumes map[string]struct{} // List of volumes (mounts) used for the container
|
||||||
WorkingDir string // Current directory (PWD) in the command will be launched
|
WorkingDir string // Current directory (PWD) in the command will be launched
|
||||||
|
21
vendor/github.com/docker/docker/api/types/container/container_changes.go
generated
vendored
Normal file
21
vendor/github.com/docker/docker/api/types/container/container_changes.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// DO NOT EDIT THIS FILE
|
||||||
|
// This file was generated by `swagger generate operation`
|
||||||
|
//
|
||||||
|
// See hack/generate-swagger-api.sh
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ContainerChangeResponseItem change item in response to ContainerChanges operation
|
||||||
|
// swagger:model ContainerChangeResponseItem
|
||||||
|
type ContainerChangeResponseItem struct {
|
||||||
|
|
||||||
|
// Kind of change
|
||||||
|
// Required: true
|
||||||
|
Kind uint8 `json:"Kind"`
|
||||||
|
|
||||||
|
// Path to file that has changed
|
||||||
|
// Required: true
|
||||||
|
Path string `json:"Path"`
|
||||||
|
}
|
6
vendor/github.com/docker/docker/api/types/container/container_create.go
generated
vendored
6
vendor/github.com/docker/docker/api/types/container/container_create.go
generated
vendored
@ -1,13 +1,13 @@
|
|||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// DO NOT EDIT THIS FILE
|
// DO NOT EDIT THIS FILE
|
||||||
// This file was generated by `swagger generate operation`
|
// This file was generated by `swagger generate operation`
|
||||||
//
|
//
|
||||||
// See hack/swagger-gen.sh
|
// See hack/generate-swagger-api.sh
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ContainerCreateCreatedBody container create created body
|
// ContainerCreateCreatedBody OK response to ContainerCreate operation
|
||||||
// swagger:model ContainerCreateCreatedBody
|
// swagger:model ContainerCreateCreatedBody
|
||||||
type ContainerCreateCreatedBody struct {
|
type ContainerCreateCreatedBody struct {
|
||||||
|
|
||||||
|
21
vendor/github.com/docker/docker/api/types/container/container_top.go
generated
vendored
Normal file
21
vendor/github.com/docker/docker/api/types/container/container_top.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// DO NOT EDIT THIS FILE
|
||||||
|
// This file was generated by `swagger generate operation`
|
||||||
|
//
|
||||||
|
// See hack/generate-swagger-api.sh
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// ContainerTopOKBody OK response to ContainerTop operation
|
||||||
|
// swagger:model ContainerTopOKBody
|
||||||
|
type ContainerTopOKBody struct {
|
||||||
|
|
||||||
|
// Each process running in the container, where each is process is an array of values corresponding to the titles
|
||||||
|
// Required: true
|
||||||
|
Processes [][]string `json:"Processes"`
|
||||||
|
|
||||||
|
// The ps column titles
|
||||||
|
// Required: true
|
||||||
|
Titles []string `json:"Titles"`
|
||||||
|
}
|
6
vendor/github.com/docker/docker/api/types/container/container_update.go
generated
vendored
6
vendor/github.com/docker/docker/api/types/container/container_update.go
generated
vendored
@ -1,13 +1,13 @@
|
|||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// DO NOT EDIT THIS FILE
|
// DO NOT EDIT THIS FILE
|
||||||
// This file was generated by `swagger generate operation`
|
// This file was generated by `swagger generate operation`
|
||||||
//
|
//
|
||||||
// See hack/swagger-gen.sh
|
// See hack/generate-swagger-api.sh
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ContainerUpdateOKBody container update o k body
|
// ContainerUpdateOKBody OK response to ContainerUpdate operation
|
||||||
// swagger:model ContainerUpdateOKBody
|
// swagger:model ContainerUpdateOKBody
|
||||||
type ContainerUpdateOKBody struct {
|
type ContainerUpdateOKBody struct {
|
||||||
|
|
||||||
|
18
vendor/github.com/docker/docker/api/types/container/container_wait.go
generated
vendored
18
vendor/github.com/docker/docker/api/types/container/container_wait.go
generated
vendored
@ -1,16 +1,28 @@
|
|||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// DO NOT EDIT THIS FILE
|
// DO NOT EDIT THIS FILE
|
||||||
// This file was generated by `swagger generate operation`
|
// This file was generated by `swagger generate operation`
|
||||||
//
|
//
|
||||||
// See hack/swagger-gen.sh
|
// See hack/generate-swagger-api.sh
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ContainerWaitOKBody container wait o k body
|
// ContainerWaitOKBodyError container waiting error, if any
|
||||||
|
// swagger:model ContainerWaitOKBodyError
|
||||||
|
type ContainerWaitOKBodyError struct {
|
||||||
|
|
||||||
|
// Details of an error
|
||||||
|
Message string `json:"Message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerWaitOKBody OK response to ContainerWait operation
|
||||||
// swagger:model ContainerWaitOKBody
|
// swagger:model ContainerWaitOKBody
|
||||||
type ContainerWaitOKBody struct {
|
type ContainerWaitOKBody struct {
|
||||||
|
|
||||||
|
// error
|
||||||
|
// Required: true
|
||||||
|
Error *ContainerWaitOKBodyError `json:"Error"`
|
||||||
|
|
||||||
// Exit code of the container
|
// Exit code of the container
|
||||||
// Required: true
|
// Required: true
|
||||||
StatusCode int64 `json:"StatusCode"`
|
StatusCode int64 `json:"StatusCode"`
|
||||||
|
165
vendor/github.com/docker/docker/api/types/container/host_config.go
generated
vendored
165
vendor/github.com/docker/docker/api/types/container/host_config.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
@ -10,8 +10,28 @@ import (
|
|||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetworkMode represents the container network stack.
|
// CgroupnsMode represents the cgroup namespace mode of the container
|
||||||
type NetworkMode string
|
type CgroupnsMode string
|
||||||
|
|
||||||
|
// IsPrivate indicates whether the container uses its own private cgroup namespace
|
||||||
|
func (c CgroupnsMode) IsPrivate() bool {
|
||||||
|
return c == "private"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsHost indicates whether the container shares the host's cgroup namespace
|
||||||
|
func (c CgroupnsMode) IsHost() bool {
|
||||||
|
return c == "host"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsEmpty indicates whether the container cgroup namespace mode is unset
|
||||||
|
func (c CgroupnsMode) IsEmpty() bool {
|
||||||
|
return c == ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valid indicates whether the cgroup namespace mode is valid
|
||||||
|
func (c CgroupnsMode) Valid() bool {
|
||||||
|
return c.IsEmpty() || c.IsPrivate() || c.IsHost()
|
||||||
|
}
|
||||||
|
|
||||||
// Isolation represents the isolation technology of a container. The supported
|
// Isolation represents the isolation technology of a container. The supported
|
||||||
// values are platform specific
|
// values are platform specific
|
||||||
@ -23,42 +43,101 @@ func (i Isolation) IsDefault() bool {
|
|||||||
return strings.ToLower(string(i)) == "default" || string(i) == ""
|
return strings.ToLower(string(i)) == "default" || string(i) == ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsHyperV indicates the use of a Hyper-V partition for isolation
|
||||||
|
func (i Isolation) IsHyperV() bool {
|
||||||
|
return strings.ToLower(string(i)) == "hyperv"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsProcess indicates the use of process isolation
|
||||||
|
func (i Isolation) IsProcess() bool {
|
||||||
|
return strings.ToLower(string(i)) == "process"
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// IsolationEmpty is unspecified (same behavior as default)
|
||||||
|
IsolationEmpty = Isolation("")
|
||||||
|
// IsolationDefault is the default isolation mode on current daemon
|
||||||
|
IsolationDefault = Isolation("default")
|
||||||
|
// IsolationProcess is process isolation mode
|
||||||
|
IsolationProcess = Isolation("process")
|
||||||
|
// IsolationHyperV is HyperV isolation mode
|
||||||
|
IsolationHyperV = Isolation("hyperv")
|
||||||
|
)
|
||||||
|
|
||||||
// IpcMode represents the container ipc stack.
|
// IpcMode represents the container ipc stack.
|
||||||
type IpcMode string
|
type IpcMode string
|
||||||
|
|
||||||
// IsPrivate indicates whether the container uses its private ipc stack.
|
// IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared.
|
||||||
func (n IpcMode) IsPrivate() bool {
|
func (n IpcMode) IsPrivate() bool {
|
||||||
return !(n.IsHost() || n.IsContainer())
|
return n == "private"
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsHost indicates whether the container uses the host's ipc stack.
|
// IsHost indicates whether the container shares the host's ipc namespace.
|
||||||
func (n IpcMode) IsHost() bool {
|
func (n IpcMode) IsHost() bool {
|
||||||
return n == "host"
|
return n == "host"
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsContainer indicates whether the container uses a container's ipc stack.
|
// IsShareable indicates whether the container's ipc namespace can be shared with another container.
|
||||||
|
func (n IpcMode) IsShareable() bool {
|
||||||
|
return n == "shareable"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsContainer indicates whether the container uses another container's ipc namespace.
|
||||||
func (n IpcMode) IsContainer() bool {
|
func (n IpcMode) IsContainer() bool {
|
||||||
parts := strings.SplitN(string(n), ":", 2)
|
parts := strings.SplitN(string(n), ":", 2)
|
||||||
return len(parts) > 1 && parts[0] == "container"
|
return len(parts) > 1 && parts[0] == "container"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid indicates whether the ipc stack is valid.
|
// IsNone indicates whether container IpcMode is set to "none".
|
||||||
|
func (n IpcMode) IsNone() bool {
|
||||||
|
return n == "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsEmpty indicates whether container IpcMode is empty
|
||||||
|
func (n IpcMode) IsEmpty() bool {
|
||||||
|
return n == ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valid indicates whether the ipc mode is valid.
|
||||||
func (n IpcMode) Valid() bool {
|
func (n IpcMode) Valid() bool {
|
||||||
parts := strings.Split(string(n), ":")
|
return n.IsEmpty() || n.IsNone() || n.IsPrivate() || n.IsHost() || n.IsShareable() || n.IsContainer()
|
||||||
switch mode := parts[0]; mode {
|
|
||||||
case "", "host":
|
|
||||||
case "container":
|
|
||||||
if len(parts) != 2 || parts[1] == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container returns the name of the container ipc stack is going to be used.
|
// Container returns the name of the container ipc stack is going to be used.
|
||||||
func (n IpcMode) Container() string {
|
func (n IpcMode) Container() string {
|
||||||
|
parts := strings.SplitN(string(n), ":", 2)
|
||||||
|
if len(parts) > 1 && parts[0] == "container" {
|
||||||
|
return parts[1]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// NetworkMode represents the container network stack.
|
||||||
|
type NetworkMode string
|
||||||
|
|
||||||
|
// IsNone indicates whether container isn't using a network stack.
|
||||||
|
func (n NetworkMode) IsNone() bool {
|
||||||
|
return n == "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsDefault indicates whether container uses the default network stack.
|
||||||
|
func (n NetworkMode) IsDefault() bool {
|
||||||
|
return n == "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsPrivate indicates whether container uses its private network stack.
|
||||||
|
func (n NetworkMode) IsPrivate() bool {
|
||||||
|
return !(n.IsHost() || n.IsContainer())
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsContainer indicates whether container uses a container network stack.
|
||||||
|
func (n NetworkMode) IsContainer() bool {
|
||||||
|
parts := strings.SplitN(string(n), ":", 2)
|
||||||
|
return len(parts) > 1 && parts[0] == "container"
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConnectedContainer is the id of the container which network this container is connected to.
|
||||||
|
func (n NetworkMode) ConnectedContainer() string {
|
||||||
parts := strings.SplitN(string(n), ":", 2)
|
parts := strings.SplitN(string(n), ":", 2)
|
||||||
if len(parts) > 1 {
|
if len(parts) > 1 {
|
||||||
return parts[1]
|
return parts[1]
|
||||||
@ -66,6 +145,14 @@ func (n IpcMode) Container() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//UserDefined indicates user-created network
|
||||||
|
func (n NetworkMode) UserDefined() string {
|
||||||
|
if n.IsUserDefined() {
|
||||||
|
return string(n)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// UsernsMode represents userns mode in the container.
|
// UsernsMode represents userns mode in the container.
|
||||||
type UsernsMode string
|
type UsernsMode string
|
||||||
|
|
||||||
@ -180,6 +267,16 @@ func (n PidMode) Container() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeviceRequest represents a request for devices from a device driver.
|
||||||
|
// Used by GPU device drivers.
|
||||||
|
type DeviceRequest struct {
|
||||||
|
Driver string // Name of device driver
|
||||||
|
Count int // Number of devices to request (-1 = All)
|
||||||
|
DeviceIDs []string // List of device IDs as recognizable by the device driver
|
||||||
|
Capabilities [][]string // An OR list of AND lists of device capabilities (e.g. "gpu")
|
||||||
|
Options map[string]string // Options to pass onto the device driver
|
||||||
|
}
|
||||||
|
|
||||||
// DeviceMapping represents the device mapping between the host and the container.
|
// DeviceMapping represents the device mapping between the host and the container.
|
||||||
type DeviceMapping struct {
|
type DeviceMapping struct {
|
||||||
PathOnHost string
|
PathOnHost string
|
||||||
@ -223,6 +320,17 @@ func (rp *RestartPolicy) IsSame(tp *RestartPolicy) bool {
|
|||||||
return rp.Name == tp.Name && rp.MaximumRetryCount == tp.MaximumRetryCount
|
return rp.Name == tp.Name && rp.MaximumRetryCount == tp.MaximumRetryCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LogMode is a type to define the available modes for logging
|
||||||
|
// These modes affect how logs are handled when log messages start piling up.
|
||||||
|
type LogMode string
|
||||||
|
|
||||||
|
// Available logging modes
|
||||||
|
const (
|
||||||
|
LogModeUnset = ""
|
||||||
|
LogModeBlocking LogMode = "blocking"
|
||||||
|
LogModeNonBlock LogMode = "non-blocking"
|
||||||
|
)
|
||||||
|
|
||||||
// LogConfig represents the logging configuration of the container.
|
// LogConfig represents the logging configuration of the container.
|
||||||
type LogConfig struct {
|
type LogConfig struct {
|
||||||
Type string
|
Type string
|
||||||
@ -251,13 +359,15 @@ type Resources struct {
|
|||||||
CpusetCpus string // CpusetCpus 0-2, 0,1
|
CpusetCpus string // CpusetCpus 0-2, 0,1
|
||||||
CpusetMems string // CpusetMems 0-2, 0,1
|
CpusetMems string // CpusetMems 0-2, 0,1
|
||||||
Devices []DeviceMapping // List of devices to map inside the container
|
Devices []DeviceMapping // List of devices to map inside the container
|
||||||
DiskQuota int64 // Disk limit (in bytes)
|
DeviceCgroupRules []string // List of rule to be added to the device cgroup
|
||||||
|
DeviceRequests []DeviceRequest // List of device requests for device drivers
|
||||||
KernelMemory int64 // Kernel memory limit (in bytes)
|
KernelMemory int64 // Kernel memory limit (in bytes)
|
||||||
|
KernelMemoryTCP int64 // Hard limit for kernel TCP buffer memory (in bytes)
|
||||||
MemoryReservation int64 // Memory soft limit (in bytes)
|
MemoryReservation int64 // Memory soft limit (in bytes)
|
||||||
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
||||||
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
|
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
|
||||||
OomKillDisable *bool // Whether to disable OOM Killer or not
|
OomKillDisable *bool // Whether to disable OOM Killer or not
|
||||||
PidsLimit int64 // Setting pids limit for a container
|
PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change.
|
||||||
Ulimits []*units.Ulimit // List of ulimits to be set in the container
|
Ulimits []*units.Ulimit // List of ulimits to be set in the container
|
||||||
|
|
||||||
// Applicable to Windows
|
// Applicable to Windows
|
||||||
@ -293,6 +403,8 @@ type HostConfig struct {
|
|||||||
// Applicable to UNIX platforms
|
// Applicable to UNIX platforms
|
||||||
CapAdd strslice.StrSlice // List of kernel capabilities to add to the container
|
CapAdd strslice.StrSlice // List of kernel capabilities to add to the container
|
||||||
CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container
|
CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container
|
||||||
|
Capabilities []string `json:"Capabilities"` // List of kernel capabilities to be available for container (this overrides the default set)
|
||||||
|
CgroupnsMode CgroupnsMode // Cgroup namespace mode to use for the container
|
||||||
DNS []string `json:"Dns"` // List of DNS server to lookup
|
DNS []string `json:"Dns"` // List of DNS server to lookup
|
||||||
DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for
|
DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for
|
||||||
DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for
|
DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for
|
||||||
@ -317,7 +429,7 @@ type HostConfig struct {
|
|||||||
|
|
||||||
// Applicable to Windows
|
// Applicable to Windows
|
||||||
ConsoleSize [2]uint // Initial console size (height,width)
|
ConsoleSize [2]uint // Initial console size (height,width)
|
||||||
Isolation Isolation // Isolation technology of the container (eg default, hyperv)
|
Isolation Isolation // Isolation technology of the container (e.g. default, hyperv)
|
||||||
|
|
||||||
// Contains container's resources (cgroups, ulimits)
|
// Contains container's resources (cgroups, ulimits)
|
||||||
Resources
|
Resources
|
||||||
@ -325,9 +437,12 @@ type HostConfig struct {
|
|||||||
// Mounts specs used by the container
|
// Mounts specs used by the container
|
||||||
Mounts []mount.Mount `json:",omitempty"`
|
Mounts []mount.Mount `json:",omitempty"`
|
||||||
|
|
||||||
|
// MaskedPaths is the list of paths to be masked inside the container (this overrides the default set of paths)
|
||||||
|
MaskedPaths []string
|
||||||
|
|
||||||
|
// ReadonlyPaths is the list of paths to be set as read-only inside the container (this overrides the default set of paths)
|
||||||
|
ReadonlyPaths []string
|
||||||
|
|
||||||
// Run a custom init inside the container, if null, use the daemon's configured settings
|
// Run a custom init inside the container, if null, use the daemon's configured settings
|
||||||
Init *bool `json:",omitempty"`
|
Init *bool `json:",omitempty"`
|
||||||
|
|
||||||
// Custom init path
|
|
||||||
InitPath string `json:",omitempty"`
|
|
||||||
}
|
}
|
||||||
|
42
vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
generated
vendored
42
vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
generated
vendored
@ -1,24 +1,12 @@
|
|||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
import "strings"
|
|
||||||
|
|
||||||
// IsValid indicates if an isolation technology is valid
|
// IsValid indicates if an isolation technology is valid
|
||||||
func (i Isolation) IsValid() bool {
|
func (i Isolation) IsValid() bool {
|
||||||
return i.IsDefault()
|
return i.IsDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsPrivate indicates whether container uses its private network stack.
|
|
||||||
func (n NetworkMode) IsPrivate() bool {
|
|
||||||
return !(n.IsHost() || n.IsContainer())
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsDefault indicates whether container uses the default network stack.
|
|
||||||
func (n NetworkMode) IsDefault() bool {
|
|
||||||
return n == "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
// NetworkName returns the name of the network stack.
|
// NetworkName returns the name of the network stack.
|
||||||
func (n NetworkMode) NetworkName() string {
|
func (n NetworkMode) NetworkName() string {
|
||||||
if n.IsBridge() {
|
if n.IsBridge() {
|
||||||
@ -47,35 +35,7 @@ func (n NetworkMode) IsHost() bool {
|
|||||||
return n == "host"
|
return n == "host"
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsContainer indicates whether container uses a container network stack.
|
|
||||||
func (n NetworkMode) IsContainer() bool {
|
|
||||||
parts := strings.SplitN(string(n), ":", 2)
|
|
||||||
return len(parts) > 1 && parts[0] == "container"
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsNone indicates whether container isn't using a network stack.
|
|
||||||
func (n NetworkMode) IsNone() bool {
|
|
||||||
return n == "none"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConnectedContainer is the id of the container which network this container is connected to.
|
|
||||||
func (n NetworkMode) ConnectedContainer() string {
|
|
||||||
parts := strings.SplitN(string(n), ":", 2)
|
|
||||||
if len(parts) > 1 {
|
|
||||||
return parts[1]
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsUserDefined indicates user-created network
|
// IsUserDefined indicates user-created network
|
||||||
func (n NetworkMode) IsUserDefined() bool {
|
func (n NetworkMode) IsUserDefined() bool {
|
||||||
return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer()
|
return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer()
|
||||||
}
|
}
|
||||||
|
|
||||||
//UserDefined indicates user-created network
|
|
||||||
func (n NetworkMode) UserDefined() string {
|
|
||||||
if n.IsUserDefined() {
|
|
||||||
return string(n)
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
55
vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go
generated
vendored
55
vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go
generated
vendored
@ -1,24 +1,4 @@
|
|||||||
package container
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IsDefault indicates whether container uses the default network stack.
|
|
||||||
func (n NetworkMode) IsDefault() bool {
|
|
||||||
return n == "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsNone indicates whether container isn't using a network stack.
|
|
||||||
func (n NetworkMode) IsNone() bool {
|
|
||||||
return n == "none"
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsContainer indicates whether container uses a container network stack.
|
|
||||||
// Returns false as windows doesn't support this mode
|
|
||||||
func (n NetworkMode) IsContainer() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsBridge indicates whether container uses the bridge network stack
|
// IsBridge indicates whether container uses the bridge network stack
|
||||||
// in windows it is given the name NAT
|
// in windows it is given the name NAT
|
||||||
@ -32,30 +12,9 @@ func (n NetworkMode) IsHost() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsPrivate indicates whether container uses its private network stack.
|
|
||||||
func (n NetworkMode) IsPrivate() bool {
|
|
||||||
return !(n.IsHost() || n.IsContainer())
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConnectedContainer is the id of the container which network this container is connected to.
|
|
||||||
// Returns blank string on windows
|
|
||||||
func (n NetworkMode) ConnectedContainer() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsUserDefined indicates user-created network
|
// IsUserDefined indicates user-created network
|
||||||
func (n NetworkMode) IsUserDefined() bool {
|
func (n NetworkMode) IsUserDefined() bool {
|
||||||
return !n.IsDefault() && !n.IsNone() && !n.IsBridge()
|
return !n.IsDefault() && !n.IsNone() && !n.IsBridge() && !n.IsContainer()
|
||||||
}
|
|
||||||
|
|
||||||
// IsHyperV indicates the use of a Hyper-V partition for isolation
|
|
||||||
func (i Isolation) IsHyperV() bool {
|
|
||||||
return strings.ToLower(string(i)) == "hyperv"
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsProcess indicates the use of process isolation
|
|
||||||
func (i Isolation) IsProcess() bool {
|
|
||||||
return strings.ToLower(string(i)) == "process"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValid indicates if an isolation technology is valid
|
// IsValid indicates if an isolation technology is valid
|
||||||
@ -71,17 +30,11 @@ func (n NetworkMode) NetworkName() string {
|
|||||||
return "nat"
|
return "nat"
|
||||||
} else if n.IsNone() {
|
} else if n.IsNone() {
|
||||||
return "none"
|
return "none"
|
||||||
|
} else if n.IsContainer() {
|
||||||
|
return "container"
|
||||||
} else if n.IsUserDefined() {
|
} else if n.IsUserDefined() {
|
||||||
return n.UserDefined()
|
return n.UserDefined()
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
//UserDefined indicates user-created network
|
|
||||||
func (n NetworkMode) UserDefined() string {
|
|
||||||
if n.IsUserDefined() {
|
|
||||||
return string(n)
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
22
vendor/github.com/docker/docker/api/types/container/waitcondition.go
generated
vendored
Normal file
22
vendor/github.com/docker/docker/api/types/container/waitcondition.go
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package container // import "github.com/docker/docker/api/types/container"
|
||||||
|
|
||||||
|
// WaitCondition is a type used to specify a container state for which
|
||||||
|
// to wait.
|
||||||
|
type WaitCondition string
|
||||||
|
|
||||||
|
// Possible WaitCondition Values.
|
||||||
|
//
|
||||||
|
// WaitConditionNotRunning (default) is used to wait for any of the non-running
|
||||||
|
// states: "created", "exited", "dead", "removing", or "removed".
|
||||||
|
//
|
||||||
|
// WaitConditionNextExit is used to wait for the next time the state changes
|
||||||
|
// to a non-running state. If the state is currently "created" or "exited",
|
||||||
|
// this would cause Wait() to block until either the container runs and exits
|
||||||
|
// or is removed.
|
||||||
|
//
|
||||||
|
// WaitConditionRemoved is used to wait for the container to be removed.
|
||||||
|
const (
|
||||||
|
WaitConditionNotRunning WaitCondition = "not-running"
|
||||||
|
WaitConditionNextExit WaitCondition = "next-exit"
|
||||||
|
WaitConditionRemoved WaitCondition = "removed"
|
||||||
|
)
|
6
vendor/github.com/docker/docker/api/types/error_response_ext.go
generated
vendored
Normal file
6
vendor/github.com/docker/docker/api/types/error_response_ext.go
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
// Error returns the error message
|
||||||
|
func (e ErrorResponse) Error() string {
|
||||||
|
return e.Message
|
||||||
|
}
|
12
vendor/github.com/docker/docker/api/types/events/events.go
generated
vendored
12
vendor/github.com/docker/docker/api/types/events/events.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package events
|
package events // import "github.com/docker/docker/api/types/events"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ContainerEventType is the event type that containers generate
|
// ContainerEventType is the event type that containers generate
|
||||||
@ -13,6 +13,14 @@ const (
|
|||||||
PluginEventType = "plugin"
|
PluginEventType = "plugin"
|
||||||
// VolumeEventType is the event type that volumes generate
|
// VolumeEventType is the event type that volumes generate
|
||||||
VolumeEventType = "volume"
|
VolumeEventType = "volume"
|
||||||
|
// ServiceEventType is the event type that services generate
|
||||||
|
ServiceEventType = "service"
|
||||||
|
// NodeEventType is the event type that nodes generate
|
||||||
|
NodeEventType = "node"
|
||||||
|
// SecretEventType is the event type that secrets generate
|
||||||
|
SecretEventType = "secret"
|
||||||
|
// ConfigEventType is the event type that configs generate
|
||||||
|
ConfigEventType = "config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Actor describes something that generates events,
|
// Actor describes something that generates events,
|
||||||
@ -36,6 +44,8 @@ type Message struct {
|
|||||||
Type string
|
Type string
|
||||||
Action string
|
Action string
|
||||||
Actor Actor
|
Actor Actor
|
||||||
|
// Engine events are local scope. Cluster events are swarm scope.
|
||||||
|
Scope string `json:"scope,omitempty"`
|
||||||
|
|
||||||
Time int64 `json:"time,omitempty"`
|
Time int64 `json:"time,omitempty"`
|
||||||
TimeNano int64 `json:"timeNano,omitempty"`
|
TimeNano int64 `json:"timeNano,omitempty"`
|
||||||
|
287
vendor/github.com/docker/docker/api/types/filters/parse.go
generated
vendored
287
vendor/github.com/docker/docker/api/types/filters/parse.go
generated
vendored
@ -1,126 +1,111 @@
|
|||||||
// Package filters provides helper function to parse and handle command line
|
/*Package filters provides tools for encoding a mapping of keys to a set of
|
||||||
// filter, used for example in docker ps or docker images commands.
|
multiple values.
|
||||||
package filters
|
*/
|
||||||
|
package filters // import "github.com/docker/docker/api/types/filters"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Args stores filter arguments as map key:{map key: bool}.
|
// Args stores a mapping of keys to a set of multiple values.
|
||||||
// It contains an aggregation of the map of arguments (which are in the form
|
|
||||||
// of -f 'key=value') based on the key, and stores values for the same key
|
|
||||||
// in a map with string keys and boolean values.
|
|
||||||
// e.g given -f 'label=label1=1' -f 'label=label2=2' -f 'image.name=ubuntu'
|
|
||||||
// the args will be {"image.name":{"ubuntu":true},"label":{"label1=1":true,"label2=2":true}}
|
|
||||||
type Args struct {
|
type Args struct {
|
||||||
fields map[string]map[string]bool
|
fields map[string]map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewArgs initializes a new Args struct.
|
// KeyValuePair are used to initialize a new Args
|
||||||
func NewArgs() Args {
|
type KeyValuePair struct {
|
||||||
return Args{fields: map[string]map[string]bool{}}
|
Key string
|
||||||
|
Value string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseFlag parses the argument to the filter flag. Like
|
// Arg creates a new KeyValuePair for initializing Args
|
||||||
//
|
func Arg(key, value string) KeyValuePair {
|
||||||
// `docker ps -f 'created=today' -f 'image.name=ubuntu*'`
|
return KeyValuePair{Key: key, Value: value}
|
||||||
//
|
|
||||||
// If prev map is provided, then it is appended to, and returned. By default a new
|
|
||||||
// map is created.
|
|
||||||
func ParseFlag(arg string, prev Args) (Args, error) {
|
|
||||||
filters := prev
|
|
||||||
if len(arg) == 0 {
|
|
||||||
return filters, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.Contains(arg, "=") {
|
|
||||||
return filters, ErrBadFormat
|
|
||||||
}
|
|
||||||
|
|
||||||
f := strings.SplitN(arg, "=", 2)
|
|
||||||
|
|
||||||
name := strings.ToLower(strings.TrimSpace(f[0]))
|
|
||||||
value := strings.TrimSpace(f[1])
|
|
||||||
|
|
||||||
filters.Add(name, value)
|
|
||||||
|
|
||||||
return filters, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrBadFormat is an error returned in case of bad format for a filter.
|
// NewArgs returns a new Args populated with the initial args
|
||||||
var ErrBadFormat = errors.New("bad format of filter (expected name=value)")
|
func NewArgs(initialArgs ...KeyValuePair) Args {
|
||||||
|
args := Args{fields: map[string]map[string]bool{}}
|
||||||
|
for _, arg := range initialArgs {
|
||||||
|
args.Add(arg.Key, arg.Value)
|
||||||
|
}
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
// ToParam packs the Args into a string for easy transport from client to server.
|
// MarshalJSON returns a JSON byte representation of the Args
|
||||||
func ToParam(a Args) (string, error) {
|
func (args Args) MarshalJSON() ([]byte, error) {
|
||||||
// this way we don't URL encode {}, just empty space
|
if len(args.fields) == 0 {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
return json.Marshal(args.fields)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToJSON returns the Args as a JSON encoded string
|
||||||
|
func ToJSON(a Args) (string, error) {
|
||||||
if a.Len() == 0 {
|
if a.Len() == 0 {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
buf, err := json.Marshal(a)
|
||||||
buf, err := json.Marshal(a.fields)
|
return string(buf), err
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return string(buf), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToParamWithVersion packs the Args into a string for easy transport from client to server.
|
// ToParamWithVersion encodes Args as a JSON string. If version is less than 1.22
|
||||||
// The generated string will depend on the specified version (corresponding to the API version).
|
// then the encoded format will use an older legacy format where the values are a
|
||||||
|
// list of strings, instead of a set.
|
||||||
|
//
|
||||||
|
// Deprecated: Use ToJSON
|
||||||
func ToParamWithVersion(version string, a Args) (string, error) {
|
func ToParamWithVersion(version string, a Args) (string, error) {
|
||||||
// this way we don't URL encode {}, just empty space
|
|
||||||
if a.Len() == 0 {
|
if a.Len() == 0 {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// for daemons older than v1.10, filter must be of the form map[string][]string
|
|
||||||
buf := []byte{}
|
|
||||||
err := errors.New("")
|
|
||||||
if version != "" && versions.LessThan(version, "1.22") {
|
if version != "" && versions.LessThan(version, "1.22") {
|
||||||
buf, err = json.Marshal(convertArgsToSlice(a.fields))
|
buf, err := json.Marshal(convertArgsToSlice(a.fields))
|
||||||
} else {
|
return string(buf), err
|
||||||
buf, err = json.Marshal(a.fields)
|
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return "", err
|
return ToJSON(a)
|
||||||
}
|
|
||||||
return string(buf), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromParam unpacks the filter Args.
|
// FromJSON decodes a JSON encoded string into Args
|
||||||
func FromParam(p string) (Args, error) {
|
func FromJSON(p string) (Args, error) {
|
||||||
if len(p) == 0 {
|
args := NewArgs()
|
||||||
return NewArgs(), nil
|
|
||||||
|
if p == "" {
|
||||||
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
r := strings.NewReader(p)
|
raw := []byte(p)
|
||||||
d := json.NewDecoder(r)
|
err := json.Unmarshal(raw, &args)
|
||||||
|
if err == nil {
|
||||||
m := map[string]map[string]bool{}
|
return args, nil
|
||||||
if err := d.Decode(&m); err != nil {
|
|
||||||
r.Seek(0, 0)
|
|
||||||
|
|
||||||
// Allow parsing old arguments in slice format.
|
|
||||||
// Because other libraries might be sending them in this format.
|
|
||||||
deprecated := map[string][]string{}
|
|
||||||
if deprecatedErr := d.Decode(&deprecated); deprecatedErr == nil {
|
|
||||||
m = deprecatedArgs(deprecated)
|
|
||||||
} else {
|
|
||||||
return NewArgs(), err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Args{m}, nil
|
|
||||||
|
// Fallback to parsing arguments in the legacy slice format
|
||||||
|
deprecated := map[string][]string{}
|
||||||
|
if legacyErr := json.Unmarshal(raw, &deprecated); legacyErr != nil {
|
||||||
|
return args, err
|
||||||
|
}
|
||||||
|
|
||||||
|
args.fields = deprecatedArgs(deprecated)
|
||||||
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the list of values associates with a field.
|
// UnmarshalJSON populates the Args from JSON encode bytes
|
||||||
// It returns a slice of strings to keep backwards compatibility with old code.
|
func (args Args) UnmarshalJSON(raw []byte) error {
|
||||||
func (filters Args) Get(field string) []string {
|
if len(raw) == 0 {
|
||||||
values := filters.fields[field]
|
return nil
|
||||||
|
}
|
||||||
|
return json.Unmarshal(raw, &args.fields)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns the list of values associated with the key
|
||||||
|
func (args Args) Get(key string) []string {
|
||||||
|
values := args.fields[key]
|
||||||
if values == nil {
|
if values == nil {
|
||||||
return make([]string, 0)
|
return make([]string, 0)
|
||||||
}
|
}
|
||||||
@ -131,37 +116,34 @@ func (filters Args) Get(field string) []string {
|
|||||||
return slice
|
return slice
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add adds a new value to a filter field.
|
// Add a new value to the set of values
|
||||||
func (filters Args) Add(name, value string) {
|
func (args Args) Add(key, value string) {
|
||||||
if _, ok := filters.fields[name]; ok {
|
if _, ok := args.fields[key]; ok {
|
||||||
filters.fields[name][value] = true
|
args.fields[key][value] = true
|
||||||
} else {
|
} else {
|
||||||
filters.fields[name] = map[string]bool{value: true}
|
args.fields[key] = map[string]bool{value: true}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Del removes a value from a filter field.
|
// Del removes a value from the set
|
||||||
func (filters Args) Del(name, value string) {
|
func (args Args) Del(key, value string) {
|
||||||
if _, ok := filters.fields[name]; ok {
|
if _, ok := args.fields[key]; ok {
|
||||||
delete(filters.fields[name], value)
|
delete(args.fields[key], value)
|
||||||
if len(filters.fields[name]) == 0 {
|
if len(args.fields[key]) == 0 {
|
||||||
delete(filters.fields, name)
|
delete(args.fields, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Len returns the number of fields in the arguments.
|
// Len returns the number of keys in the mapping
|
||||||
func (filters Args) Len() int {
|
func (args Args) Len() int {
|
||||||
return len(filters.fields)
|
return len(args.fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatchKVList returns true if the values for the specified field matches the ones
|
// MatchKVList returns true if all the pairs in sources exist as key=value
|
||||||
// from the sources.
|
// pairs in the mapping at key, or if there are no values at key.
|
||||||
// e.g. given Args are {'label': {'label1=1','label2=1'}, 'image.name', {'ubuntu'}},
|
func (args Args) MatchKVList(key string, sources map[string]string) bool {
|
||||||
// field is 'label' and sources are {'label1': '1', 'label2': '2'}
|
fieldValues := args.fields[key]
|
||||||
// it returns true.
|
|
||||||
func (filters Args) MatchKVList(field string, sources map[string]string) bool {
|
|
||||||
fieldValues := filters.fields[field]
|
|
||||||
|
|
||||||
//do not filter if there is no filter set or cannot determine filter
|
//do not filter if there is no filter set or cannot determine filter
|
||||||
if len(fieldValues) == 0 {
|
if len(fieldValues) == 0 {
|
||||||
@ -172,8 +154,8 @@ func (filters Args) MatchKVList(field string, sources map[string]string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for name2match := range fieldValues {
|
for value := range fieldValues {
|
||||||
testKV := strings.SplitN(name2match, "=", 2)
|
testKV := strings.SplitN(value, "=", 2)
|
||||||
|
|
||||||
v, ok := sources[testKV[0]]
|
v, ok := sources[testKV[0]]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -187,16 +169,13 @@ func (filters Args) MatchKVList(field string, sources map[string]string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match returns true if the values for the specified field matches the source string
|
// Match returns true if any of the values at key match the source string
|
||||||
// e.g. given Args are {'label': {'label1=1','label2=1'}, 'image.name', {'ubuntu'}},
|
func (args Args) Match(field, source string) bool {
|
||||||
// field is 'image.name' and source is 'ubuntu'
|
if args.ExactMatch(field, source) {
|
||||||
// it returns true.
|
|
||||||
func (filters Args) Match(field, source string) bool {
|
|
||||||
if filters.ExactMatch(field, source) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldValues := filters.fields[field]
|
fieldValues := args.fields[field]
|
||||||
for name2match := range fieldValues {
|
for name2match := range fieldValues {
|
||||||
match, err := regexp.MatchString(name2match, source)
|
match, err := regexp.MatchString(name2match, source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -209,9 +188,9 @@ func (filters Args) Match(field, source string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExactMatch returns true if the source matches exactly one of the filters.
|
// ExactMatch returns true if the source matches exactly one of the values.
|
||||||
func (filters Args) ExactMatch(field, source string) bool {
|
func (args Args) ExactMatch(key, source string) bool {
|
||||||
fieldValues, ok := filters.fields[field]
|
fieldValues, ok := args.fields[key]
|
||||||
//do not filter if there is no filter set or cannot determine filter
|
//do not filter if there is no filter set or cannot determine filter
|
||||||
if !ok || len(fieldValues) == 0 {
|
if !ok || len(fieldValues) == 0 {
|
||||||
return true
|
return true
|
||||||
@ -221,14 +200,15 @@ func (filters Args) ExactMatch(field, source string) bool {
|
|||||||
return fieldValues[source]
|
return fieldValues[source]
|
||||||
}
|
}
|
||||||
|
|
||||||
// UniqueExactMatch returns true if there is only one filter and the source matches exactly this one.
|
// UniqueExactMatch returns true if there is only one value and the source
|
||||||
func (filters Args) UniqueExactMatch(field, source string) bool {
|
// matches exactly the value.
|
||||||
fieldValues := filters.fields[field]
|
func (args Args) UniqueExactMatch(key, source string) bool {
|
||||||
|
fieldValues := args.fields[key]
|
||||||
//do not filter if there is no filter set or cannot determine filter
|
//do not filter if there is no filter set or cannot determine filter
|
||||||
if len(fieldValues) == 0 {
|
if len(fieldValues) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if len(filters.fields[field]) != 1 {
|
if len(args.fields[key]) != 1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,14 +216,14 @@ func (filters Args) UniqueExactMatch(field, source string) bool {
|
|||||||
return fieldValues[source]
|
return fieldValues[source]
|
||||||
}
|
}
|
||||||
|
|
||||||
// FuzzyMatch returns true if the source matches exactly one of the filters,
|
// FuzzyMatch returns true if the source matches exactly one value, or the
|
||||||
// or the source has one of the filters as a prefix.
|
// source has one of the values as a prefix.
|
||||||
func (filters Args) FuzzyMatch(field, source string) bool {
|
func (args Args) FuzzyMatch(key, source string) bool {
|
||||||
if filters.ExactMatch(field, source) {
|
if args.ExactMatch(key, source) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldValues := filters.fields[field]
|
fieldValues := args.fields[key]
|
||||||
for prefix := range fieldValues {
|
for prefix := range fieldValues {
|
||||||
if strings.HasPrefix(source, prefix) {
|
if strings.HasPrefix(source, prefix) {
|
||||||
return true
|
return true
|
||||||
@ -252,30 +232,39 @@ func (filters Args) FuzzyMatch(field, source string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include returns true if the name of the field to filter is in the filters.
|
// Contains returns true if the key exists in the mapping
|
||||||
func (filters Args) Include(field string) bool {
|
func (args Args) Contains(field string) bool {
|
||||||
_, ok := filters.fields[field]
|
_, ok := args.fields[field]
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate ensures that all the fields in the filter are valid.
|
type invalidFilter string
|
||||||
// It returns an error as soon as it finds an invalid field.
|
|
||||||
func (filters Args) Validate(accepted map[string]bool) error {
|
func (e invalidFilter) Error() string {
|
||||||
for name := range filters.fields {
|
return "Invalid filter '" + string(e) + "'"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (invalidFilter) InvalidParameter() {}
|
||||||
|
|
||||||
|
// Validate compared the set of accepted keys against the keys in the mapping.
|
||||||
|
// An error is returned if any mapping keys are not in the accepted set.
|
||||||
|
func (args Args) Validate(accepted map[string]bool) error {
|
||||||
|
for name := range args.fields {
|
||||||
if !accepted[name] {
|
if !accepted[name] {
|
||||||
return fmt.Errorf("Invalid filter '%s'", name)
|
return invalidFilter(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WalkValues iterates over the list of filtered values for a field.
|
// WalkValues iterates over the list of values for a key in the mapping and calls
|
||||||
// It stops the iteration if it finds an error and it returns that error.
|
// op() for each value. If op returns an error the iteration stops and the
|
||||||
func (filters Args) WalkValues(field string, op func(value string) error) error {
|
// error is returned.
|
||||||
if _, ok := filters.fields[field]; !ok {
|
func (args Args) WalkValues(field string, op func(value string) error) error {
|
||||||
|
if _, ok := args.fields[field]; !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
for v := range filters.fields[field] {
|
for v := range args.fields[field] {
|
||||||
if err := op(v); err != nil {
|
if err := op(v); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -283,6 +272,22 @@ func (filters Args) WalkValues(field string, op func(value string) error) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clone returns a copy of args.
|
||||||
|
func (args Args) Clone() (newArgs Args) {
|
||||||
|
newArgs.fields = make(map[string]map[string]bool, len(args.fields))
|
||||||
|
for k, m := range args.fields {
|
||||||
|
var mm map[string]bool
|
||||||
|
if m != nil {
|
||||||
|
mm = make(map[string]bool, len(m))
|
||||||
|
for kk, v := range m {
|
||||||
|
mm[kk] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newArgs.fields[k] = mm
|
||||||
|
}
|
||||||
|
return newArgs
|
||||||
|
}
|
||||||
|
|
||||||
func deprecatedArgs(d map[string][]string) map[string]map[string]bool {
|
func deprecatedArgs(d map[string][]string) map[string]map[string]bool {
|
||||||
m := map[string]map[string]bool{}
|
m := map[string]map[string]bool{}
|
||||||
for k, v := range d {
|
for k, v := range d {
|
||||||
|
17
vendor/github.com/docker/docker/api/types/graph_driver_data.go
generated
vendored
Normal file
17
vendor/github.com/docker/docker/api/types/graph_driver_data.go
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// GraphDriverData Information about a container's graph driver.
|
||||||
|
// swagger:model GraphDriverData
|
||||||
|
type GraphDriverData struct {
|
||||||
|
|
||||||
|
// data
|
||||||
|
// Required: true
|
||||||
|
Data map[string]string `json:"Data"`
|
||||||
|
|
||||||
|
// name
|
||||||
|
// Required: true
|
||||||
|
Name string `json:"Name"`
|
||||||
|
}
|
37
vendor/github.com/docker/docker/api/types/image/image_history.go
generated
vendored
Normal file
37
vendor/github.com/docker/docker/api/types/image/image_history.go
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package image // import "github.com/docker/docker/api/types/image"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// DO NOT EDIT THIS FILE
|
||||||
|
// This file was generated by `swagger generate operation`
|
||||||
|
//
|
||||||
|
// See hack/generate-swagger-api.sh
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// HistoryResponseItem individual image layer information in response to ImageHistory operation
|
||||||
|
// swagger:model HistoryResponseItem
|
||||||
|
type HistoryResponseItem struct {
|
||||||
|
|
||||||
|
// comment
|
||||||
|
// Required: true
|
||||||
|
Comment string `json:"Comment"`
|
||||||
|
|
||||||
|
// created
|
||||||
|
// Required: true
|
||||||
|
Created int64 `json:"Created"`
|
||||||
|
|
||||||
|
// created by
|
||||||
|
// Required: true
|
||||||
|
CreatedBy string `json:"CreatedBy"`
|
||||||
|
|
||||||
|
// Id
|
||||||
|
// Required: true
|
||||||
|
ID string `json:"Id"`
|
||||||
|
|
||||||
|
// size
|
||||||
|
// Required: true
|
||||||
|
Size int64 `json:"Size"`
|
||||||
|
|
||||||
|
// tags
|
||||||
|
// Required: true
|
||||||
|
Tags []string `json:"Tags"`
|
||||||
|
}
|
15
vendor/github.com/docker/docker/api/types/image_delete_response_item.go
generated
vendored
Normal file
15
vendor/github.com/docker/docker/api/types/image_delete_response_item.go
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
// This file was generated by the swagger tool.
|
||||||
|
// Editing this file might prove futile when you re-run the swagger generate command
|
||||||
|
|
||||||
|
// ImageDeleteResponseItem image delete response item
|
||||||
|
// swagger:model ImageDeleteResponseItem
|
||||||
|
type ImageDeleteResponseItem struct {
|
||||||
|
|
||||||
|
// The image ID of an image that was deleted
|
||||||
|
Deleted string `json:"Deleted,omitempty"`
|
||||||
|
|
||||||
|
// The image ID of an image that was untagged
|
||||||
|
Untagged string `json:"Untagged,omitempty"`
|
||||||
|
}
|
30
vendor/github.com/docker/docker/api/types/mount/mount.go
generated
vendored
30
vendor/github.com/docker/docker/api/types/mount/mount.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package mount
|
package mount // import "github.com/docker/docker/api/types/mount"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@ -15,6 +15,8 @@ const (
|
|||||||
TypeVolume Type = "volume"
|
TypeVolume Type = "volume"
|
||||||
// TypeTmpfs is the type for mounting tmpfs
|
// TypeTmpfs is the type for mounting tmpfs
|
||||||
TypeTmpfs Type = "tmpfs"
|
TypeTmpfs Type = "tmpfs"
|
||||||
|
// TypeNamedPipe is the type for mounting Windows named pipes
|
||||||
|
TypeNamedPipe Type = "npipe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mount represents a mount (volume).
|
// Mount represents a mount (volume).
|
||||||
@ -23,9 +25,10 @@ type Mount struct {
|
|||||||
// Source specifies the name of the mount. Depending on mount type, this
|
// Source specifies the name of the mount. Depending on mount type, this
|
||||||
// may be a volume name or a host path, or even ignored.
|
// may be a volume name or a host path, or even ignored.
|
||||||
// Source is not supported for tmpfs (must be an empty value)
|
// Source is not supported for tmpfs (must be an empty value)
|
||||||
Source string `json:",omitempty"`
|
Source string `json:",omitempty"`
|
||||||
Target string `json:",omitempty"`
|
Target string `json:",omitempty"`
|
||||||
ReadOnly bool `json:",omitempty"`
|
ReadOnly bool `json:",omitempty"`
|
||||||
|
Consistency Consistency `json:",omitempty"`
|
||||||
|
|
||||||
BindOptions *BindOptions `json:",omitempty"`
|
BindOptions *BindOptions `json:",omitempty"`
|
||||||
VolumeOptions *VolumeOptions `json:",omitempty"`
|
VolumeOptions *VolumeOptions `json:",omitempty"`
|
||||||
@ -60,9 +63,24 @@ var Propagations = []Propagation{
|
|||||||
PropagationSlave,
|
PropagationSlave,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Consistency represents the consistency requirements of a mount.
|
||||||
|
type Consistency string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ConsistencyFull guarantees bind mount-like consistency
|
||||||
|
ConsistencyFull Consistency = "consistent"
|
||||||
|
// ConsistencyCached mounts can cache read data and FS structure
|
||||||
|
ConsistencyCached Consistency = "cached"
|
||||||
|
// ConsistencyDelegated mounts can cache read and written data and structure
|
||||||
|
ConsistencyDelegated Consistency = "delegated"
|
||||||
|
// ConsistencyDefault provides "consistent" behavior unless overridden
|
||||||
|
ConsistencyDefault Consistency = "default"
|
||||||
|
)
|
||||||
|
|
||||||
// BindOptions defines options specific to mounts of type "bind".
|
// BindOptions defines options specific to mounts of type "bind".
|
||||||
type BindOptions struct {
|
type BindOptions struct {
|
||||||
Propagation Propagation `json:",omitempty"`
|
Propagation Propagation `json:",omitempty"`
|
||||||
|
NonRecursive bool `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeOptions represents the options for a mount of type volume.
|
// VolumeOptions represents the options for a mount of type volume.
|
||||||
@ -83,7 +101,7 @@ type TmpfsOptions struct {
|
|||||||
// Size sets the size of the tmpfs, in bytes.
|
// Size sets the size of the tmpfs, in bytes.
|
||||||
//
|
//
|
||||||
// This will be converted to an operating system specific value
|
// This will be converted to an operating system specific value
|
||||||
// depending on the host. For example, on linux, it will be convered to
|
// depending on the host. For example, on linux, it will be converted to
|
||||||
// use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with
|
// use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with
|
||||||
// docker, uses a straight byte value.
|
// docker, uses a straight byte value.
|
||||||
//
|
//
|
||||||
|
72
vendor/github.com/docker/docker/api/types/network/network.go
generated
vendored
72
vendor/github.com/docker/docker/api/types/network/network.go
generated
vendored
@ -1,4 +1,8 @@
|
|||||||
package network
|
package network // import "github.com/docker/docker/api/types/network"
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/errdefs"
|
||||||
|
)
|
||||||
|
|
||||||
// Address represents an IP address
|
// Address represents an IP address
|
||||||
type Address struct {
|
type Address struct {
|
||||||
@ -28,7 +32,15 @@ type EndpointIPAMConfig struct {
|
|||||||
LinkLocalIPs []string `json:",omitempty"`
|
LinkLocalIPs []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PeerInfo represents one peer of a overlay network
|
// Copy makes a copy of the endpoint ipam config
|
||||||
|
func (cfg *EndpointIPAMConfig) Copy() *EndpointIPAMConfig {
|
||||||
|
cfgCopy := *cfg
|
||||||
|
cfgCopy.LinkLocalIPs = make([]string, 0, len(cfg.LinkLocalIPs))
|
||||||
|
cfgCopy.LinkLocalIPs = append(cfgCopy.LinkLocalIPs, cfg.LinkLocalIPs...)
|
||||||
|
return &cfgCopy
|
||||||
|
}
|
||||||
|
|
||||||
|
// PeerInfo represents one peer of an overlay network
|
||||||
type PeerInfo struct {
|
type PeerInfo struct {
|
||||||
Name string
|
Name string
|
||||||
IP string
|
IP string
|
||||||
@ -50,6 +62,42 @@ type EndpointSettings struct {
|
|||||||
GlobalIPv6Address string
|
GlobalIPv6Address string
|
||||||
GlobalIPv6PrefixLen int
|
GlobalIPv6PrefixLen int
|
||||||
MacAddress string
|
MacAddress string
|
||||||
|
DriverOpts map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task carries the information about one backend task
|
||||||
|
type Task struct {
|
||||||
|
Name string
|
||||||
|
EndpointID string
|
||||||
|
EndpointIP string
|
||||||
|
Info map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServiceInfo represents service parameters with the list of service's tasks
|
||||||
|
type ServiceInfo struct {
|
||||||
|
VIP string
|
||||||
|
Ports []string
|
||||||
|
LocalLBIndex int
|
||||||
|
Tasks []Task
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy makes a deep copy of `EndpointSettings`
|
||||||
|
func (es *EndpointSettings) Copy() *EndpointSettings {
|
||||||
|
epCopy := *es
|
||||||
|
if es.IPAMConfig != nil {
|
||||||
|
epCopy.IPAMConfig = es.IPAMConfig.Copy()
|
||||||
|
}
|
||||||
|
|
||||||
|
if es.Links != nil {
|
||||||
|
links := make([]string, 0, len(es.Links))
|
||||||
|
epCopy.Links = append(links, es.Links...)
|
||||||
|
}
|
||||||
|
|
||||||
|
if es.Aliases != nil {
|
||||||
|
aliases := make([]string, 0, len(es.Aliases))
|
||||||
|
epCopy.Aliases = append(aliases, es.Aliases...)
|
||||||
|
}
|
||||||
|
return &epCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkingConfig represents the container's networking configuration for each of its interfaces
|
// NetworkingConfig represents the container's networking configuration for each of its interfaces
|
||||||
@ -57,3 +105,23 @@ type EndpointSettings struct {
|
|||||||
type NetworkingConfig struct {
|
type NetworkingConfig struct {
|
||||||
EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network
|
EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConfigReference specifies the source which provides a network's configuration
|
||||||
|
type ConfigReference struct {
|
||||||
|
Network string
|
||||||
|
}
|
||||||
|
|
||||||
|
var acceptedFilters = map[string]bool{
|
||||||
|
"dangling": true,
|
||||||
|
"driver": true,
|
||||||
|
"id": true,
|
||||||
|
"label": true,
|
||||||
|
"name": true,
|
||||||
|
"scope": true,
|
||||||
|
"type": true,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateFilters validates the list of filter args with the available filters.
|
||||||
|
func ValidateFilters(filter filters.Args) error {
|
||||||
|
return errdefs.InvalidParameter(filter.Validate(acceptedFilters))
|
||||||
|
}
|
||||||
|
16
vendor/github.com/docker/docker/api/types/plugin.go
generated
vendored
16
vendor/github.com/docker/docker/api/types/plugin.go
generated
vendored
@ -11,7 +11,7 @@ type Plugin struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
Config PluginConfig `json:"Config"`
|
Config PluginConfig `json:"Config"`
|
||||||
|
|
||||||
// True when the plugin is running. False when the plugin is not running, only installed.
|
// True if the plugin is running. False if the plugin is not running, only installed.
|
||||||
// Required: true
|
// Required: true
|
||||||
Enabled bool `json:"Enabled"`
|
Enabled bool `json:"Enabled"`
|
||||||
|
|
||||||
@ -42,6 +42,9 @@ type PluginConfig struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
Description string `json:"Description"`
|
Description string `json:"Description"`
|
||||||
|
|
||||||
|
// Docker Version used to create the plugin
|
||||||
|
DockerVersion string `json:"DockerVersion,omitempty"`
|
||||||
|
|
||||||
// documentation
|
// documentation
|
||||||
// Required: true
|
// Required: true
|
||||||
Documentation string `json:"Documentation"`
|
Documentation string `json:"Documentation"`
|
||||||
@ -58,6 +61,10 @@ type PluginConfig struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
Interface PluginConfigInterface `json:"Interface"`
|
Interface PluginConfigInterface `json:"Interface"`
|
||||||
|
|
||||||
|
// ipc host
|
||||||
|
// Required: true
|
||||||
|
IpcHost bool `json:"IpcHost"`
|
||||||
|
|
||||||
// linux
|
// linux
|
||||||
// Required: true
|
// Required: true
|
||||||
Linux PluginConfigLinux `json:"Linux"`
|
Linux PluginConfigLinux `json:"Linux"`
|
||||||
@ -70,6 +77,10 @@ type PluginConfig struct {
|
|||||||
// Required: true
|
// Required: true
|
||||||
Network PluginConfigNetwork `json:"Network"`
|
Network PluginConfigNetwork `json:"Network"`
|
||||||
|
|
||||||
|
// pid host
|
||||||
|
// Required: true
|
||||||
|
PidHost bool `json:"PidHost"`
|
||||||
|
|
||||||
// propagated mount
|
// propagated mount
|
||||||
// Required: true
|
// Required: true
|
||||||
PropagatedMount string `json:"PropagatedMount"`
|
PropagatedMount string `json:"PropagatedMount"`
|
||||||
@ -110,6 +121,9 @@ type PluginConfigArgs struct {
|
|||||||
// swagger:model PluginConfigInterface
|
// swagger:model PluginConfigInterface
|
||||||
type PluginConfigInterface struct {
|
type PluginConfigInterface struct {
|
||||||
|
|
||||||
|
// Protocol to use for clients connecting to the plugin.
|
||||||
|
ProtocolScheme string `json:"ProtocolScheme,omitempty"`
|
||||||
|
|
||||||
// socket
|
// socket
|
||||||
// Required: true
|
// Required: true
|
||||||
Socket string `json:"Socket"`
|
Socket string `json:"Socket"`
|
||||||
|
25
vendor/github.com/docker/docker/api/types/plugin_responses.go
generated
vendored
25
vendor/github.com/docker/docker/api/types/plugin_responses.go
generated
vendored
@ -1,21 +1,14 @@
|
|||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PluginsListResponse contains the response for the Engine API
|
// PluginsListResponse contains the response for the Engine API
|
||||||
type PluginsListResponse []*Plugin
|
type PluginsListResponse []*Plugin
|
||||||
|
|
||||||
const (
|
|
||||||
authzDriver = "AuthzDriver"
|
|
||||||
graphDriver = "GraphDriver"
|
|
||||||
ipamDriver = "IpamDriver"
|
|
||||||
networkDriver = "NetworkDriver"
|
|
||||||
volumeDriver = "VolumeDriver"
|
|
||||||
)
|
|
||||||
|
|
||||||
// UnmarshalJSON implements json.Unmarshaler for PluginInterfaceType
|
// UnmarshalJSON implements json.Unmarshaler for PluginInterfaceType
|
||||||
func (t *PluginInterfaceType) UnmarshalJSON(p []byte) error {
|
func (t *PluginInterfaceType) UnmarshalJSON(p []byte) error {
|
||||||
versionIndex := len(p)
|
versionIndex := len(p)
|
||||||
@ -62,3 +55,17 @@ type PluginPrivilege struct {
|
|||||||
|
|
||||||
// PluginPrivileges is a list of PluginPrivilege
|
// PluginPrivileges is a list of PluginPrivilege
|
||||||
type PluginPrivileges []PluginPrivilege
|
type PluginPrivileges []PluginPrivilege
|
||||||
|
|
||||||
|
func (s PluginPrivileges) Len() int {
|
||||||
|
return len(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PluginPrivileges) Less(i, j int) bool {
|
||||||
|
return s[i].Name < s[j].Name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s PluginPrivileges) Swap(i, j int) {
|
||||||
|
sort.Strings(s[i].Value)
|
||||||
|
sort.Strings(s[j].Value)
|
||||||
|
s[i], s[j] = s[j], s[i]
|
||||||
|
}
|
||||||
|
2
vendor/github.com/docker/docker/api/types/port.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/port.go
generated
vendored
@ -7,7 +7,7 @@ package types
|
|||||||
// swagger:model Port
|
// swagger:model Port
|
||||||
type Port struct {
|
type Port struct {
|
||||||
|
|
||||||
// IP
|
// Host IP address that the container's port is mapped to
|
||||||
IP string `json:"IP,omitempty"`
|
IP string `json:"IP,omitempty"`
|
||||||
|
|
||||||
// Port on the container
|
// Port on the container
|
||||||
|
34
vendor/github.com/docker/docker/api/types/reference/image_reference.go
generated
vendored
34
vendor/github.com/docker/docker/api/types/reference/image_reference.go
generated
vendored
@ -1,34 +0,0 @@
|
|||||||
package reference
|
|
||||||
|
|
||||||
import (
|
|
||||||
distreference "github.com/docker/distribution/reference"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Parse parses the given references and returns the repository and
|
|
||||||
// tag (if present) from it. If there is an error during parsing, it will
|
|
||||||
// return an error.
|
|
||||||
func Parse(ref string) (string, string, error) {
|
|
||||||
distributionRef, err := distreference.ParseNamed(ref)
|
|
||||||
if err != nil {
|
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
tag := GetTagFromNamedRef(distributionRef)
|
|
||||||
return distributionRef.Name(), tag, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetTagFromNamedRef returns a tag from the specified reference.
|
|
||||||
// This function is necessary as long as the docker "server" api makes the distinction between repository
|
|
||||||
// and tags.
|
|
||||||
func GetTagFromNamedRef(ref distreference.Named) string {
|
|
||||||
var tag string
|
|
||||||
switch x := ref.(type) {
|
|
||||||
case distreference.Digested:
|
|
||||||
tag = x.Digest().String()
|
|
||||||
case distreference.NamedTagged:
|
|
||||||
tag = x.Tag()
|
|
||||||
default:
|
|
||||||
tag = "latest"
|
|
||||||
}
|
|
||||||
return tag
|
|
||||||
}
|
|
4
vendor/github.com/docker/docker/api/types/registry/authenticate.go
generated
vendored
4
vendor/github.com/docker/docker/api/types/registry/authenticate.go
generated
vendored
@ -1,10 +1,10 @@
|
|||||||
package registry
|
package registry // import "github.com/docker/docker/api/types/registry"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// DO NOT EDIT THIS FILE
|
// DO NOT EDIT THIS FILE
|
||||||
// This file was generated by `swagger generate operation`
|
// This file was generated by `swagger generate operation`
|
||||||
//
|
//
|
||||||
// See hack/swagger-gen.sh
|
// See hack/generate-swagger-api.sh
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// AuthenticateOKBody authenticate o k body
|
// AuthenticateOKBody authenticate o k body
|
||||||
|
23
vendor/github.com/docker/docker/api/types/registry/registry.go
generated
vendored
23
vendor/github.com/docker/docker/api/types/registry/registry.go
generated
vendored
@ -1,15 +1,19 @@
|
|||||||
package registry
|
package registry // import "github.com/docker/docker/api/types/registry"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceConfig stores daemon registry services configuration.
|
// ServiceConfig stores daemon registry services configuration.
|
||||||
type ServiceConfig struct {
|
type ServiceConfig struct {
|
||||||
InsecureRegistryCIDRs []*NetIPNet `json:"InsecureRegistryCIDRs"`
|
AllowNondistributableArtifactsCIDRs []*NetIPNet
|
||||||
IndexConfigs map[string]*IndexInfo `json:"IndexConfigs"`
|
AllowNondistributableArtifactsHostnames []string
|
||||||
Mirrors []string
|
InsecureRegistryCIDRs []*NetIPNet `json:"InsecureRegistryCIDRs"`
|
||||||
|
IndexConfigs map[string]*IndexInfo `json:"IndexConfigs"`
|
||||||
|
Mirrors []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetIPNet is the net.IPNet type, which can be marshalled and
|
// NetIPNet is the net.IPNet type, which can be marshalled and
|
||||||
@ -102,3 +106,14 @@ type SearchResults struct {
|
|||||||
// Results is a slice containing the actual results for the search
|
// Results is a slice containing the actual results for the search
|
||||||
Results []SearchResult `json:"results"`
|
Results []SearchResult `json:"results"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DistributionInspect describes the result obtained from contacting the
|
||||||
|
// registry to retrieve image metadata
|
||||||
|
type DistributionInspect struct {
|
||||||
|
// Descriptor contains information about the manifest, including
|
||||||
|
// the content addressable digest
|
||||||
|
Descriptor v1.Descriptor
|
||||||
|
// Platforms contains the list of platforms supported by the image,
|
||||||
|
// obtained by parsing the manifest
|
||||||
|
Platforms []v1.Platform
|
||||||
|
}
|
||||||
|
9
vendor/github.com/docker/docker/api/types/seccomp.go
generated
vendored
9
vendor/github.com/docker/docker/api/types/seccomp.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
// Seccomp represents the config for a seccomp profile for syscall restriction.
|
// Seccomp represents the config for a seccomp profile for syscall restriction.
|
||||||
type Seccomp struct {
|
type Seccomp struct {
|
||||||
@ -10,7 +10,7 @@ type Seccomp struct {
|
|||||||
Syscalls []*Syscall `json:"syscalls"`
|
Syscalls []*Syscall `json:"syscalls"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Architecture is used to represent an specific architecture
|
// Architecture is used to represent a specific architecture
|
||||||
// and its sub-architectures
|
// and its sub-architectures
|
||||||
type Architecture struct {
|
type Architecture struct {
|
||||||
Arch Arch `json:"architecture"`
|
Arch Arch `json:"architecture"`
|
||||||
@ -77,8 +77,9 @@ type Arg struct {
|
|||||||
|
|
||||||
// Filter is used to conditionally apply Seccomp rules
|
// Filter is used to conditionally apply Seccomp rules
|
||||||
type Filter struct {
|
type Filter struct {
|
||||||
Caps []string `json:"caps,omitempty"`
|
Caps []string `json:"caps,omitempty"`
|
||||||
Arches []string `json:"arches,omitempty"`
|
Arches []string `json:"arches,omitempty"`
|
||||||
|
MinKernel string `json:"minKernel,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Syscall is used to match a group of syscalls in Seccomp
|
// Syscall is used to match a group of syscalls in Seccomp
|
||||||
|
9
vendor/github.com/docker/docker/api/types/stats.go
generated
vendored
9
vendor/github.com/docker/docker/api/types/stats.go
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
// Package types is used for API stability in the types and response to the
|
// Package types is used for API stability in the types and response to the
|
||||||
// consumers of the API stats endpoint.
|
// consumers of the API stats endpoint.
|
||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
@ -47,6 +47,9 @@ type CPUStats struct {
|
|||||||
// System Usage. Linux only.
|
// System Usage. Linux only.
|
||||||
SystemUsage uint64 `json:"system_cpu_usage,omitempty"`
|
SystemUsage uint64 `json:"system_cpu_usage,omitempty"`
|
||||||
|
|
||||||
|
// Online CPUs. Linux only.
|
||||||
|
OnlineCPUs uint32 `json:"online_cpus,omitempty"`
|
||||||
|
|
||||||
// Throttling Data. Linux only.
|
// Throttling Data. Linux only.
|
||||||
ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
|
ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
|
||||||
}
|
}
|
||||||
@ -117,7 +120,7 @@ type NetworkStats struct {
|
|||||||
RxBytes uint64 `json:"rx_bytes"`
|
RxBytes uint64 `json:"rx_bytes"`
|
||||||
// Packets received. Windows and Linux.
|
// Packets received. Windows and Linux.
|
||||||
RxPackets uint64 `json:"rx_packets"`
|
RxPackets uint64 `json:"rx_packets"`
|
||||||
// Received errors. Not used on Windows. Note that we dont `omitempty` this
|
// Received errors. Not used on Windows. Note that we don't `omitempty` this
|
||||||
// field as it is expected in the >=v1.21 API stats structure.
|
// field as it is expected in the >=v1.21 API stats structure.
|
||||||
RxErrors uint64 `json:"rx_errors"`
|
RxErrors uint64 `json:"rx_errors"`
|
||||||
// Incoming packets dropped. Windows and Linux.
|
// Incoming packets dropped. Windows and Linux.
|
||||||
@ -126,7 +129,7 @@ type NetworkStats struct {
|
|||||||
TxBytes uint64 `json:"tx_bytes"`
|
TxBytes uint64 `json:"tx_bytes"`
|
||||||
// Packets sent. Windows and Linux.
|
// Packets sent. Windows and Linux.
|
||||||
TxPackets uint64 `json:"tx_packets"`
|
TxPackets uint64 `json:"tx_packets"`
|
||||||
// Sent errors. Not used on Windows. Note that we dont `omitempty` this
|
// Sent errors. Not used on Windows. Note that we don't `omitempty` this
|
||||||
// field as it is expected in the >=v1.21 API stats structure.
|
// field as it is expected in the >=v1.21 API stats structure.
|
||||||
TxErrors uint64 `json:"tx_errors"`
|
TxErrors uint64 `json:"tx_errors"`
|
||||||
// Outgoing packets dropped. Windows and Linux.
|
// Outgoing packets dropped. Windows and Linux.
|
||||||
|
2
vendor/github.com/docker/docker/api/types/strslice/strslice.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/strslice/strslice.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package strslice
|
package strslice // import "github.com/docker/docker/api/types/strslice"
|
||||||
|
|
||||||
import "encoding/json"
|
import "encoding/json"
|
||||||
|
|
||||||
|
19
vendor/github.com/docker/docker/api/types/swarm/common.go
generated
vendored
19
vendor/github.com/docker/docker/api/types/swarm/common.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
@ -17,11 +17,24 @@ type Meta struct {
|
|||||||
// Annotations represents how to describe an object.
|
// Annotations represents how to describe an object.
|
||||||
type Annotations struct {
|
type Annotations struct {
|
||||||
Name string `json:",omitempty"`
|
Name string `json:",omitempty"`
|
||||||
Labels map[string]string `json:",omitempty"`
|
Labels map[string]string `json:"Labels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Driver represents a driver (network, logging).
|
// Driver represents a driver (network, logging, secrets backend).
|
||||||
type Driver struct {
|
type Driver struct {
|
||||||
Name string `json:",omitempty"`
|
Name string `json:",omitempty"`
|
||||||
Options map[string]string `json:",omitempty"`
|
Options map[string]string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TLSInfo represents the TLS information about what CA certificate is trusted,
|
||||||
|
// and who the issuer for a TLS certificate is
|
||||||
|
type TLSInfo struct {
|
||||||
|
// TrustRoot is the trusted CA root certificate in PEM format
|
||||||
|
TrustRoot string `json:",omitempty"`
|
||||||
|
|
||||||
|
// CertIssuer is the raw subject bytes of the issuer
|
||||||
|
CertIssuerSubject []byte `json:",omitempty"`
|
||||||
|
|
||||||
|
// CertIssuerPublicKey is the raw public key bytes of the issuer
|
||||||
|
CertIssuerPublicKey []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
40
vendor/github.com/docker/docker/api/types/swarm/config.go
generated
vendored
Normal file
40
vendor/github.com/docker/docker/api/types/swarm/config.go
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
|
||||||
|
// Config represents a config.
|
||||||
|
type Config struct {
|
||||||
|
ID string
|
||||||
|
Meta
|
||||||
|
Spec ConfigSpec
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigSpec represents a config specification from a config in swarm
|
||||||
|
type ConfigSpec struct {
|
||||||
|
Annotations
|
||||||
|
Data []byte `json:",omitempty"`
|
||||||
|
|
||||||
|
// Templating controls whether and how to evaluate the config payload as
|
||||||
|
// a template. If it is not set, no templating is used.
|
||||||
|
Templating *Driver `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigReferenceFileTarget is a file target in a config reference
|
||||||
|
type ConfigReferenceFileTarget struct {
|
||||||
|
Name string
|
||||||
|
UID string
|
||||||
|
GID string
|
||||||
|
Mode os.FileMode
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigReferenceRuntimeTarget is a target for a config specifying that it
|
||||||
|
// isn't mounted into the container but instead has some other purpose.
|
||||||
|
type ConfigReferenceRuntimeTarget struct{}
|
||||||
|
|
||||||
|
// ConfigReference is a reference to a config in swarm
|
||||||
|
type ConfigReference struct {
|
||||||
|
File *ConfigReferenceFileTarget `json:",omitempty"`
|
||||||
|
Runtime *ConfigReferenceRuntimeTarget `json:",omitempty"`
|
||||||
|
ConfigID string
|
||||||
|
ConfigName string
|
||||||
|
}
|
39
vendor/github.com/docker/docker/api/types/swarm/container.go
generated
vendored
39
vendor/github.com/docker/docker/api/types/swarm/container.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
@ -21,6 +21,29 @@ type DNSConfig struct {
|
|||||||
Options []string `json:",omitempty"`
|
Options []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SELinuxContext contains the SELinux labels of the container.
|
||||||
|
type SELinuxContext struct {
|
||||||
|
Disable bool
|
||||||
|
|
||||||
|
User string
|
||||||
|
Role string
|
||||||
|
Type string
|
||||||
|
Level string
|
||||||
|
}
|
||||||
|
|
||||||
|
// CredentialSpec for managed service account (Windows only)
|
||||||
|
type CredentialSpec struct {
|
||||||
|
Config string
|
||||||
|
File string
|
||||||
|
Registry string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Privileges defines the security options for the container.
|
||||||
|
type Privileges struct {
|
||||||
|
CredentialSpec *CredentialSpec
|
||||||
|
SELinuxContext *SELinuxContext
|
||||||
|
}
|
||||||
|
|
||||||
// ContainerSpec represents the spec of a container.
|
// ContainerSpec represents the spec of a container.
|
||||||
type ContainerSpec struct {
|
type ContainerSpec struct {
|
||||||
Image string `json:",omitempty"`
|
Image string `json:",omitempty"`
|
||||||
@ -32,15 +55,23 @@ type ContainerSpec struct {
|
|||||||
Dir string `json:",omitempty"`
|
Dir string `json:",omitempty"`
|
||||||
User string `json:",omitempty"`
|
User string `json:",omitempty"`
|
||||||
Groups []string `json:",omitempty"`
|
Groups []string `json:",omitempty"`
|
||||||
|
Privileges *Privileges `json:",omitempty"`
|
||||||
|
Init *bool `json:",omitempty"`
|
||||||
|
StopSignal string `json:",omitempty"`
|
||||||
TTY bool `json:",omitempty"`
|
TTY bool `json:",omitempty"`
|
||||||
OpenStdin bool `json:",omitempty"`
|
OpenStdin bool `json:",omitempty"`
|
||||||
|
ReadOnly bool `json:",omitempty"`
|
||||||
Mounts []mount.Mount `json:",omitempty"`
|
Mounts []mount.Mount `json:",omitempty"`
|
||||||
StopGracePeriod *time.Duration `json:",omitempty"`
|
StopGracePeriod *time.Duration `json:",omitempty"`
|
||||||
Healthcheck *container.HealthConfig `json:",omitempty"`
|
Healthcheck *container.HealthConfig `json:",omitempty"`
|
||||||
// The format of extra hosts on swarmkit is specified in:
|
// The format of extra hosts on swarmkit is specified in:
|
||||||
// http://man7.org/linux/man-pages/man5/hosts.5.html
|
// http://man7.org/linux/man-pages/man5/hosts.5.html
|
||||||
// IP_address canonical_hostname [aliases...]
|
// IP_address canonical_hostname [aliases...]
|
||||||
Hosts []string `json:",omitempty"`
|
Hosts []string `json:",omitempty"`
|
||||||
DNSConfig *DNSConfig `json:",omitempty"`
|
DNSConfig *DNSConfig `json:",omitempty"`
|
||||||
Secrets []*SecretReference `json:",omitempty"`
|
Secrets []*SecretReference `json:",omitempty"`
|
||||||
|
Configs []*ConfigReference `json:",omitempty"`
|
||||||
|
Isolation container.Isolation `json:",omitempty"`
|
||||||
|
Sysctls map[string]string `json:",omitempty"`
|
||||||
|
Capabilities []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
26
vendor/github.com/docker/docker/api/types/swarm/network.go
generated
vendored
26
vendor/github.com/docker/docker/api/types/swarm/network.go
generated
vendored
@ -1,4 +1,8 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/api/types/network"
|
||||||
|
)
|
||||||
|
|
||||||
// Endpoint represents an endpoint.
|
// Endpoint represents an endpoint.
|
||||||
type Endpoint struct {
|
type Endpoint struct {
|
||||||
@ -58,6 +62,8 @@ const (
|
|||||||
PortConfigProtocolTCP PortConfigProtocol = "tcp"
|
PortConfigProtocolTCP PortConfigProtocol = "tcp"
|
||||||
// PortConfigProtocolUDP UDP
|
// PortConfigProtocolUDP UDP
|
||||||
PortConfigProtocolUDP PortConfigProtocol = "udp"
|
PortConfigProtocolUDP PortConfigProtocol = "udp"
|
||||||
|
// PortConfigProtocolSCTP SCTP
|
||||||
|
PortConfigProtocolSCTP PortConfigProtocol = "sctp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EndpointVirtualIP represents the virtual ip of a port.
|
// EndpointVirtualIP represents the virtual ip of a port.
|
||||||
@ -78,17 +84,21 @@ type Network struct {
|
|||||||
// NetworkSpec represents the spec of a network.
|
// NetworkSpec represents the spec of a network.
|
||||||
type NetworkSpec struct {
|
type NetworkSpec struct {
|
||||||
Annotations
|
Annotations
|
||||||
DriverConfiguration *Driver `json:",omitempty"`
|
DriverConfiguration *Driver `json:",omitempty"`
|
||||||
IPv6Enabled bool `json:",omitempty"`
|
IPv6Enabled bool `json:",omitempty"`
|
||||||
Internal bool `json:",omitempty"`
|
Internal bool `json:",omitempty"`
|
||||||
Attachable bool `json:",omitempty"`
|
Attachable bool `json:",omitempty"`
|
||||||
IPAMOptions *IPAMOptions `json:",omitempty"`
|
Ingress bool `json:",omitempty"`
|
||||||
|
IPAMOptions *IPAMOptions `json:",omitempty"`
|
||||||
|
ConfigFrom *network.ConfigReference `json:",omitempty"`
|
||||||
|
Scope string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkAttachmentConfig represents the configuration of a network attachment.
|
// NetworkAttachmentConfig represents the configuration of a network attachment.
|
||||||
type NetworkAttachmentConfig struct {
|
type NetworkAttachmentConfig struct {
|
||||||
Target string `json:",omitempty"`
|
Target string `json:",omitempty"`
|
||||||
Aliases []string `json:",omitempty"`
|
Aliases []string `json:",omitempty"`
|
||||||
|
DriverOpts map[string]string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkAttachment represents a network attachment.
|
// NetworkAttachment represents a network attachment.
|
||||||
|
3
vendor/github.com/docker/docker/api/types/swarm/node.go
generated
vendored
3
vendor/github.com/docker/docker/api/types/swarm/node.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
// Node represents a node.
|
// Node represents a node.
|
||||||
type Node struct {
|
type Node struct {
|
||||||
@ -52,6 +52,7 @@ type NodeDescription struct {
|
|||||||
Platform Platform `json:",omitempty"`
|
Platform Platform `json:",omitempty"`
|
||||||
Resources Resources `json:",omitempty"`
|
Resources Resources `json:",omitempty"`
|
||||||
Engine EngineDescription `json:",omitempty"`
|
Engine EngineDescription `json:",omitempty"`
|
||||||
|
TLSInfo TLSInfo `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Platform represents the platform (Arch/OS).
|
// Platform represents the platform (Arch/OS).
|
||||||
|
27
vendor/github.com/docker/docker/api/types/swarm/runtime.go
generated
vendored
Normal file
27
vendor/github.com/docker/docker/api/types/swarm/runtime.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
|
// RuntimeType is the type of runtime used for the TaskSpec
|
||||||
|
type RuntimeType string
|
||||||
|
|
||||||
|
// RuntimeURL is the proto type url
|
||||||
|
type RuntimeURL string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// RuntimeContainer is the container based runtime
|
||||||
|
RuntimeContainer RuntimeType = "container"
|
||||||
|
// RuntimePlugin is the plugin based runtime
|
||||||
|
RuntimePlugin RuntimeType = "plugin"
|
||||||
|
// RuntimeNetworkAttachment is the network attachment runtime
|
||||||
|
RuntimeNetworkAttachment RuntimeType = "attachment"
|
||||||
|
|
||||||
|
// RuntimeURLContainer is the proto url for the container type
|
||||||
|
RuntimeURLContainer RuntimeURL = "types.docker.com/RuntimeContainer"
|
||||||
|
// RuntimeURLPlugin is the proto url for the plugin type
|
||||||
|
RuntimeURLPlugin RuntimeURL = "types.docker.com/RuntimePlugin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NetworkAttachmentSpec represents the runtime spec type for network
|
||||||
|
// attachment tasks
|
||||||
|
type NetworkAttachmentSpec struct {
|
||||||
|
ContainerID string
|
||||||
|
}
|
3
vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go
generated
vendored
Normal file
3
vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
//go:generate protoc -I . --gogofast_out=import_path=github.com/docker/docker/api/types/swarm/runtime:. plugin.proto
|
||||||
|
|
||||||
|
package runtime // import "github.com/docker/docker/api/types/swarm/runtime"
|
754
vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go
generated
vendored
Normal file
754
vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go
generated
vendored
Normal file
@ -0,0 +1,754 @@
|
|||||||
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
|
// source: plugin.proto
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package runtime is a generated protocol buffer package.
|
||||||
|
|
||||||
|
It is generated from these files:
|
||||||
|
plugin.proto
|
||||||
|
|
||||||
|
It has these top-level messages:
|
||||||
|
PluginSpec
|
||||||
|
PluginPrivilege
|
||||||
|
*/
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import proto "github.com/gogo/protobuf/proto"
|
||||||
|
import fmt "fmt"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
|
import io "io"
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the proto package it is being compiled against.
|
||||||
|
// A compilation error at this line likely means your copy of the
|
||||||
|
// proto package needs to be updated.
|
||||||
|
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// PluginSpec defines the base payload which clients can specify for creating
|
||||||
|
// a service with the plugin runtime.
|
||||||
|
type PluginSpec struct {
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Remote string `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"`
|
||||||
|
Privileges []*PluginPrivilege `protobuf:"bytes,3,rep,name=privileges" json:"privileges,omitempty"`
|
||||||
|
Disabled bool `protobuf:"varint,4,opt,name=disabled,proto3" json:"disabled,omitempty"`
|
||||||
|
Env []string `protobuf:"bytes,5,rep,name=env" json:"env,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginSpec) Reset() { *m = PluginSpec{} }
|
||||||
|
func (m *PluginSpec) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PluginSpec) ProtoMessage() {}
|
||||||
|
func (*PluginSpec) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{0} }
|
||||||
|
|
||||||
|
func (m *PluginSpec) GetName() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginSpec) GetRemote() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Remote
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginSpec) GetPrivileges() []*PluginPrivilege {
|
||||||
|
if m != nil {
|
||||||
|
return m.Privileges
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginSpec) GetDisabled() bool {
|
||||||
|
if m != nil {
|
||||||
|
return m.Disabled
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginSpec) GetEnv() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Env
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PluginPrivilege describes a permission the user has to accept
|
||||||
|
// upon installing a plugin.
|
||||||
|
type PluginPrivilege struct {
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||||
|
Value []string `protobuf:"bytes,3,rep,name=value" json:"value,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) Reset() { *m = PluginPrivilege{} }
|
||||||
|
func (m *PluginPrivilege) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*PluginPrivilege) ProtoMessage() {}
|
||||||
|
func (*PluginPrivilege) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{1} }
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) GetName() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) GetDescription() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) GetValue() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Value
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*PluginSpec)(nil), "PluginSpec")
|
||||||
|
proto.RegisterType((*PluginPrivilege)(nil), "PluginPrivilege")
|
||||||
|
}
|
||||||
|
func (m *PluginSpec) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalTo(dAtA)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginSpec) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
var i int
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Name) > 0 {
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
i++
|
||||||
|
i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name)))
|
||||||
|
i += copy(dAtA[i:], m.Name)
|
||||||
|
}
|
||||||
|
if len(m.Remote) > 0 {
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
i++
|
||||||
|
i = encodeVarintPlugin(dAtA, i, uint64(len(m.Remote)))
|
||||||
|
i += copy(dAtA[i:], m.Remote)
|
||||||
|
}
|
||||||
|
if len(m.Privileges) > 0 {
|
||||||
|
for _, msg := range m.Privileges {
|
||||||
|
dAtA[i] = 0x1a
|
||||||
|
i++
|
||||||
|
i = encodeVarintPlugin(dAtA, i, uint64(msg.Size()))
|
||||||
|
n, err := msg.MarshalTo(dAtA[i:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
i += n
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if m.Disabled {
|
||||||
|
dAtA[i] = 0x20
|
||||||
|
i++
|
||||||
|
if m.Disabled {
|
||||||
|
dAtA[i] = 1
|
||||||
|
} else {
|
||||||
|
dAtA[i] = 0
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
if len(m.Env) > 0 {
|
||||||
|
for _, s := range m.Env {
|
||||||
|
dAtA[i] = 0x2a
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
dAtA[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(dAtA[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalTo(dAtA)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
var i int
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Name) > 0 {
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
i++
|
||||||
|
i = encodeVarintPlugin(dAtA, i, uint64(len(m.Name)))
|
||||||
|
i += copy(dAtA[i:], m.Name)
|
||||||
|
}
|
||||||
|
if len(m.Description) > 0 {
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
i++
|
||||||
|
i = encodeVarintPlugin(dAtA, i, uint64(len(m.Description)))
|
||||||
|
i += copy(dAtA[i:], m.Description)
|
||||||
|
}
|
||||||
|
if len(m.Value) > 0 {
|
||||||
|
for _, s := range m.Value {
|
||||||
|
dAtA[i] = 0x1a
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
dAtA[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(dAtA[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeVarintPlugin(dAtA []byte, offset int, v uint64) int {
|
||||||
|
for v >= 1<<7 {
|
||||||
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||||
|
v >>= 7
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
dAtA[offset] = uint8(v)
|
||||||
|
return offset + 1
|
||||||
|
}
|
||||||
|
func (m *PluginSpec) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Name)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Remote)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
if len(m.Privileges) > 0 {
|
||||||
|
for _, e := range m.Privileges {
|
||||||
|
l = e.Size()
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if m.Disabled {
|
||||||
|
n += 2
|
||||||
|
}
|
||||||
|
if len(m.Env) > 0 {
|
||||||
|
for _, s := range m.Env {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *PluginPrivilege) Size() (n int) {
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Name)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Description)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
if len(m.Value) > 0 {
|
||||||
|
for _, s := range m.Value {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovPlugin(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func sovPlugin(x uint64) (n int) {
|
||||||
|
for {
|
||||||
|
n++
|
||||||
|
x >>= 7
|
||||||
|
if x == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
func sozPlugin(x uint64) (n int) {
|
||||||
|
return sovPlugin(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||||
|
}
|
||||||
|
func (m *PluginSpec) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: PluginSpec: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: PluginSpec: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Name = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Remote", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Remote = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Privileges", wireType)
|
||||||
|
}
|
||||||
|
var msglen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
msglen |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if msglen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + msglen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Privileges = append(m.Privileges, &PluginPrivilege{})
|
||||||
|
if err := m.Privileges[len(m.Privileges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 4:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType)
|
||||||
|
}
|
||||||
|
var v int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
v |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Disabled = bool(v != 0)
|
||||||
|
case 5:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Env = append(m.Env, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipPlugin(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if skippy < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *PluginPrivilege) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: PluginPrivilege: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: PluginPrivilege: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Name = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Description = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Value = append(m.Value, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipPlugin(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if skippy < 0 {
|
||||||
|
return ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func skipPlugin(dAtA []byte) (n int, err error) {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
switch wireType {
|
||||||
|
case 0:
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx++
|
||||||
|
if dAtA[iNdEx-1] < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return iNdEx, nil
|
||||||
|
case 1:
|
||||||
|
iNdEx += 8
|
||||||
|
return iNdEx, nil
|
||||||
|
case 2:
|
||||||
|
var length int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
length |= (int(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iNdEx += length
|
||||||
|
if length < 0 {
|
||||||
|
return 0, ErrInvalidLengthPlugin
|
||||||
|
}
|
||||||
|
return iNdEx, nil
|
||||||
|
case 3:
|
||||||
|
for {
|
||||||
|
var innerWire uint64
|
||||||
|
var start int = iNdEx
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return 0, ErrIntOverflowPlugin
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return 0, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
innerWire |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
innerWireType := int(innerWire & 0x7)
|
||||||
|
if innerWireType == 4 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
next, err := skipPlugin(dAtA[start:])
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
iNdEx = start + next
|
||||||
|
}
|
||||||
|
return iNdEx, nil
|
||||||
|
case 4:
|
||||||
|
return iNdEx, nil
|
||||||
|
case 5:
|
||||||
|
iNdEx += 4
|
||||||
|
return iNdEx, nil
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrInvalidLengthPlugin = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||||
|
ErrIntOverflowPlugin = fmt.Errorf("proto: integer overflow")
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("plugin.proto", fileDescriptorPlugin) }
|
||||||
|
|
||||||
|
var fileDescriptorPlugin = []byte{
|
||||||
|
// 256 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4d, 0x4b, 0xc3, 0x30,
|
||||||
|
0x18, 0xc7, 0x89, 0xdd, 0xc6, 0xfa, 0x4c, 0x70, 0x04, 0x91, 0xe2, 0xa1, 0x94, 0x9d, 0x7a, 0x6a,
|
||||||
|
0x45, 0x2f, 0x82, 0x37, 0x0f, 0x9e, 0x47, 0xbc, 0x09, 0x1e, 0xd2, 0xf6, 0xa1, 0x06, 0x9b, 0x17,
|
||||||
|
0x92, 0xb4, 0xe2, 0x37, 0xf1, 0x23, 0x79, 0xf4, 0x23, 0x48, 0x3f, 0x89, 0x98, 0x75, 0x32, 0x64,
|
||||||
|
0xa7, 0xff, 0x4b, 0xc2, 0x9f, 0x1f, 0x0f, 0x9c, 0x9a, 0xae, 0x6f, 0x85, 0x2a, 0x8c, 0xd5, 0x5e,
|
||||||
|
0x6f, 0x3e, 0x08, 0xc0, 0x36, 0x14, 0x8f, 0x06, 0x6b, 0x4a, 0x61, 0xa6, 0xb8, 0xc4, 0x84, 0x64,
|
||||||
|
0x24, 0x8f, 0x59, 0xf0, 0xf4, 0x02, 0x16, 0x16, 0xa5, 0xf6, 0x98, 0x9c, 0x84, 0x76, 0x4a, 0xf4,
|
||||||
|
0x0a, 0xc0, 0x58, 0x31, 0x88, 0x0e, 0x5b, 0x74, 0x49, 0x94, 0x45, 0xf9, 0xea, 0x7a, 0x5d, 0xec,
|
||||||
|
0xc6, 0xb6, 0xfb, 0x07, 0x76, 0xf0, 0x87, 0x5e, 0xc2, 0xb2, 0x11, 0x8e, 0x57, 0x1d, 0x36, 0xc9,
|
||||||
|
0x2c, 0x23, 0xf9, 0x92, 0xfd, 0x65, 0xba, 0x86, 0x08, 0xd5, 0x90, 0xcc, 0xb3, 0x28, 0x8f, 0xd9,
|
||||||
|
0xaf, 0xdd, 0x3c, 0xc3, 0xd9, 0xbf, 0xb1, 0xa3, 0x78, 0x19, 0xac, 0x1a, 0x74, 0xb5, 0x15, 0xc6,
|
||||||
|
0x0b, 0xad, 0x26, 0xc6, 0xc3, 0x8a, 0x9e, 0xc3, 0x7c, 0xe0, 0x5d, 0x8f, 0x81, 0x31, 0x66, 0xbb,
|
||||||
|
0x70, 0xff, 0xf0, 0x39, 0xa6, 0xe4, 0x6b, 0x4c, 0xc9, 0xf7, 0x98, 0x92, 0xa7, 0xdb, 0x56, 0xf8,
|
||||||
|
0x97, 0xbe, 0x2a, 0x6a, 0x2d, 0xcb, 0x46, 0xd7, 0xaf, 0x68, 0xf7, 0xc2, 0x8d, 0x28, 0xfd, 0xbb,
|
||||||
|
0x41, 0x57, 0xba, 0x37, 0x6e, 0x65, 0x69, 0x7b, 0xe5, 0x85, 0xc4, 0xbb, 0x49, 0xab, 0x45, 0x38,
|
||||||
|
0xe4, 0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0xa8, 0xd9, 0x9b, 0x58, 0x01, 0x00, 0x00,
|
||||||
|
}
|
21
vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto
generated
vendored
Normal file
21
vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option go_package = "github.com/docker/docker/api/types/swarm/runtime;runtime";
|
||||||
|
|
||||||
|
// PluginSpec defines the base payload which clients can specify for creating
|
||||||
|
// a service with the plugin runtime.
|
||||||
|
message PluginSpec {
|
||||||
|
string name = 1;
|
||||||
|
string remote = 2;
|
||||||
|
repeated PluginPrivilege privileges = 3;
|
||||||
|
bool disabled = 4;
|
||||||
|
repeated string env = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PluginPrivilege describes a permission the user has to accept
|
||||||
|
// upon installing a plugin.
|
||||||
|
message PluginPrivilege {
|
||||||
|
string name = 1;
|
||||||
|
string description = 2;
|
||||||
|
repeated string value = 3;
|
||||||
|
}
|
9
vendor/github.com/docker/docker/api/types/swarm/secret.go
generated
vendored
9
vendor/github.com/docker/docker/api/types/swarm/secret.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
@ -12,7 +12,12 @@ type Secret struct {
|
|||||||
// SecretSpec represents a secret specification from a secret in swarm
|
// SecretSpec represents a secret specification from a secret in swarm
|
||||||
type SecretSpec struct {
|
type SecretSpec struct {
|
||||||
Annotations
|
Annotations
|
||||||
Data []byte `json:",omitempty"`
|
Data []byte `json:",omitempty"`
|
||||||
|
Driver *Driver `json:",omitempty"` // name of the secrets driver used to fetch the secret's value from an external secret store
|
||||||
|
|
||||||
|
// Templating controls whether and how to evaluate the secret payload as
|
||||||
|
// a template. If it is not set, no templating is used.
|
||||||
|
Templating *Driver `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SecretReferenceFileTarget is a file target in a secret reference
|
// SecretReferenceFileTarget is a file target in a secret reference
|
||||||
|
39
vendor/github.com/docker/docker/api/types/swarm/service.go
generated
vendored
39
vendor/github.com/docker/docker/api/types/swarm/service.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
@ -6,10 +6,10 @@ import "time"
|
|||||||
type Service struct {
|
type Service struct {
|
||||||
ID string
|
ID string
|
||||||
Meta
|
Meta
|
||||||
Spec ServiceSpec `json:",omitempty"`
|
Spec ServiceSpec `json:",omitempty"`
|
||||||
PreviousSpec *ServiceSpec `json:",omitempty"`
|
PreviousSpec *ServiceSpec `json:",omitempty"`
|
||||||
Endpoint Endpoint `json:",omitempty"`
|
Endpoint Endpoint `json:",omitempty"`
|
||||||
UpdateStatus UpdateStatus `json:",omitempty"`
|
UpdateStatus *UpdateStatus `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServiceSpec represents the spec of a service.
|
// ServiceSpec represents the spec of a service.
|
||||||
@ -18,9 +18,10 @@ type ServiceSpec struct {
|
|||||||
|
|
||||||
// TaskTemplate defines how the service should construct new tasks when
|
// TaskTemplate defines how the service should construct new tasks when
|
||||||
// orchestrating this service.
|
// orchestrating this service.
|
||||||
TaskTemplate TaskSpec `json:",omitempty"`
|
TaskTemplate TaskSpec `json:",omitempty"`
|
||||||
Mode ServiceMode `json:",omitempty"`
|
Mode ServiceMode `json:",omitempty"`
|
||||||
UpdateConfig *UpdateConfig `json:",omitempty"`
|
UpdateConfig *UpdateConfig `json:",omitempty"`
|
||||||
|
RollbackConfig *UpdateConfig `json:",omitempty"`
|
||||||
|
|
||||||
// Networks field in ServiceSpec is deprecated. The
|
// Networks field in ServiceSpec is deprecated. The
|
||||||
// same field in TaskSpec should be used instead.
|
// same field in TaskSpec should be used instead.
|
||||||
@ -45,13 +46,19 @@ const (
|
|||||||
UpdateStatePaused UpdateState = "paused"
|
UpdateStatePaused UpdateState = "paused"
|
||||||
// UpdateStateCompleted is the completed state.
|
// UpdateStateCompleted is the completed state.
|
||||||
UpdateStateCompleted UpdateState = "completed"
|
UpdateStateCompleted UpdateState = "completed"
|
||||||
|
// UpdateStateRollbackStarted is the state with a rollback in progress.
|
||||||
|
UpdateStateRollbackStarted UpdateState = "rollback_started"
|
||||||
|
// UpdateStateRollbackPaused is the state with a rollback in progress.
|
||||||
|
UpdateStateRollbackPaused UpdateState = "rollback_paused"
|
||||||
|
// UpdateStateRollbackCompleted is the state with a rollback in progress.
|
||||||
|
UpdateStateRollbackCompleted UpdateState = "rollback_completed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UpdateStatus reports the status of a service update.
|
// UpdateStatus reports the status of a service update.
|
||||||
type UpdateStatus struct {
|
type UpdateStatus struct {
|
||||||
State UpdateState `json:",omitempty"`
|
State UpdateState `json:",omitempty"`
|
||||||
StartedAt time.Time `json:",omitempty"`
|
StartedAt *time.Time `json:",omitempty"`
|
||||||
CompletedAt time.Time `json:",omitempty"`
|
CompletedAt *time.Time `json:",omitempty"`
|
||||||
Message string `json:",omitempty"`
|
Message string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +75,13 @@ const (
|
|||||||
UpdateFailureActionPause = "pause"
|
UpdateFailureActionPause = "pause"
|
||||||
// UpdateFailureActionContinue CONTINUE
|
// UpdateFailureActionContinue CONTINUE
|
||||||
UpdateFailureActionContinue = "continue"
|
UpdateFailureActionContinue = "continue"
|
||||||
|
// UpdateFailureActionRollback ROLLBACK
|
||||||
|
UpdateFailureActionRollback = "rollback"
|
||||||
|
|
||||||
|
// UpdateOrderStopFirst STOP_FIRST
|
||||||
|
UpdateOrderStopFirst = "stop-first"
|
||||||
|
// UpdateOrderStartFirst START_FIRST
|
||||||
|
UpdateOrderStartFirst = "start-first"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UpdateConfig represents the update configuration.
|
// UpdateConfig represents the update configuration.
|
||||||
@ -102,4 +116,9 @@ type UpdateConfig struct {
|
|||||||
// If the failure action is PAUSE, no more tasks will be updated until
|
// If the failure action is PAUSE, no more tasks will be updated until
|
||||||
// another update is started.
|
// another update is started.
|
||||||
MaxFailureRatio float32
|
MaxFailureRatio float32
|
||||||
|
|
||||||
|
// Order indicates the order of operations when rolling out an updated
|
||||||
|
// task. Either the old task is shut down before the new task is
|
||||||
|
// started, or the new task is started before the old task is shut down.
|
||||||
|
Order string
|
||||||
}
|
}
|
||||||
|
44
vendor/github.com/docker/docker/api/types/swarm/swarm.go
generated
vendored
44
vendor/github.com/docker/docker/api/types/swarm/swarm.go
generated
vendored
@ -1,13 +1,20 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
// ClusterInfo represents info about the cluster for outputing in "info"
|
// ClusterInfo represents info about the cluster for outputting in "info"
|
||||||
// it contains the same information as "Swarm", but without the JoinTokens
|
// it contains the same information as "Swarm", but without the JoinTokens
|
||||||
type ClusterInfo struct {
|
type ClusterInfo struct {
|
||||||
ID string
|
ID string
|
||||||
Meta
|
Meta
|
||||||
Spec Spec
|
Spec Spec
|
||||||
|
TLSInfo TLSInfo
|
||||||
|
RootRotationInProgress bool
|
||||||
|
DefaultAddrPool []string
|
||||||
|
SubnetSize uint32
|
||||||
|
DataPathPort uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swarm represents a swarm.
|
// Swarm represents a swarm.
|
||||||
@ -107,6 +114,16 @@ type CAConfig struct {
|
|||||||
// ExternalCAs is a list of CAs to which a manager node will make
|
// ExternalCAs is a list of CAs to which a manager node will make
|
||||||
// certificate signing requests for node certificates.
|
// certificate signing requests for node certificates.
|
||||||
ExternalCAs []*ExternalCA `json:",omitempty"`
|
ExternalCAs []*ExternalCA `json:",omitempty"`
|
||||||
|
|
||||||
|
// SigningCACert and SigningCAKey specify the desired signing root CA and
|
||||||
|
// root CA key for the swarm. When inspecting the cluster, the key will
|
||||||
|
// be redacted.
|
||||||
|
SigningCACert string `json:",omitempty"`
|
||||||
|
SigningCAKey string `json:",omitempty"`
|
||||||
|
|
||||||
|
// If this value changes, and there is no specified signing cert and key,
|
||||||
|
// then the swarm is forced to generate a new root certificate ane key.
|
||||||
|
ForceRotate uint64 `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExternalCAProtocol represents type of external CA.
|
// ExternalCAProtocol represents type of external CA.
|
||||||
@ -126,23 +143,34 @@ type ExternalCA struct {
|
|||||||
// Options is a set of additional key/value pairs whose interpretation
|
// Options is a set of additional key/value pairs whose interpretation
|
||||||
// depends on the specified CA type.
|
// depends on the specified CA type.
|
||||||
Options map[string]string `json:",omitempty"`
|
Options map[string]string `json:",omitempty"`
|
||||||
|
|
||||||
|
// CACert specifies which root CA is used by this external CA. This certificate must
|
||||||
|
// be in PEM format.
|
||||||
|
CACert string
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitRequest is the request used to init a swarm.
|
// InitRequest is the request used to init a swarm.
|
||||||
type InitRequest struct {
|
type InitRequest struct {
|
||||||
ListenAddr string
|
ListenAddr string
|
||||||
AdvertiseAddr string
|
AdvertiseAddr string
|
||||||
|
DataPathAddr string
|
||||||
|
DataPathPort uint32
|
||||||
ForceNewCluster bool
|
ForceNewCluster bool
|
||||||
Spec Spec
|
Spec Spec
|
||||||
AutoLockManagers bool
|
AutoLockManagers bool
|
||||||
|
Availability NodeAvailability
|
||||||
|
DefaultAddrPool []string
|
||||||
|
SubnetSize uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// JoinRequest is the request used to join a swarm.
|
// JoinRequest is the request used to join a swarm.
|
||||||
type JoinRequest struct {
|
type JoinRequest struct {
|
||||||
ListenAddr string
|
ListenAddr string
|
||||||
AdvertiseAddr string
|
AdvertiseAddr string
|
||||||
|
DataPathAddr string
|
||||||
RemoteAddrs []string
|
RemoteAddrs []string
|
||||||
JoinToken string // accept by secret
|
JoinToken string // accept by secret
|
||||||
|
Availability NodeAvailability
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnlockRequest is the request used to unlock a swarm.
|
// UnlockRequest is the request used to unlock a swarm.
|
||||||
@ -177,10 +205,12 @@ type Info struct {
|
|||||||
Error string
|
Error string
|
||||||
|
|
||||||
RemoteManagers []Peer
|
RemoteManagers []Peer
|
||||||
Nodes int
|
Nodes int `json:",omitempty"`
|
||||||
Managers int
|
Managers int `json:",omitempty"`
|
||||||
|
|
||||||
Cluster ClusterInfo
|
Cluster *ClusterInfo `json:",omitempty"`
|
||||||
|
|
||||||
|
Warnings []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peer represents a peer.
|
// Peer represents a peer.
|
||||||
|
94
vendor/github.com/docker/docker/api/types/swarm/task.go
generated
vendored
94
vendor/github.com/docker/docker/api/types/swarm/task.go
generated
vendored
@ -1,6 +1,10 @@
|
|||||||
package swarm
|
package swarm // import "github.com/docker/docker/api/types/swarm"
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types/swarm/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
// TaskState represents the state of a task.
|
// TaskState represents the state of a task.
|
||||||
type TaskState string
|
type TaskState string
|
||||||
@ -32,6 +36,10 @@ const (
|
|||||||
TaskStateFailed TaskState = "failed"
|
TaskStateFailed TaskState = "failed"
|
||||||
// TaskStateRejected REJECTED
|
// TaskStateRejected REJECTED
|
||||||
TaskStateRejected TaskState = "rejected"
|
TaskStateRejected TaskState = "rejected"
|
||||||
|
// TaskStateRemove REMOVE
|
||||||
|
TaskStateRemove TaskState = "remove"
|
||||||
|
// TaskStateOrphaned ORPHANED
|
||||||
|
TaskStateOrphaned TaskState = "orphaned"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Task represents a task.
|
// Task represents a task.
|
||||||
@ -47,11 +55,19 @@ type Task struct {
|
|||||||
Status TaskStatus `json:",omitempty"`
|
Status TaskStatus `json:",omitempty"`
|
||||||
DesiredState TaskState `json:",omitempty"`
|
DesiredState TaskState `json:",omitempty"`
|
||||||
NetworksAttachments []NetworkAttachment `json:",omitempty"`
|
NetworksAttachments []NetworkAttachment `json:",omitempty"`
|
||||||
|
GenericResources []GenericResource `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskSpec represents the spec of a task.
|
// TaskSpec represents the spec of a task.
|
||||||
type TaskSpec struct {
|
type TaskSpec struct {
|
||||||
ContainerSpec ContainerSpec `json:",omitempty"`
|
// ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually exclusive.
|
||||||
|
// PluginSpec is only used when the `Runtime` field is set to `plugin`
|
||||||
|
// NetworkAttachmentSpec is used if the `Runtime` field is set to
|
||||||
|
// `attachment`.
|
||||||
|
ContainerSpec *ContainerSpec `json:",omitempty"`
|
||||||
|
PluginSpec *runtime.PluginSpec `json:",omitempty"`
|
||||||
|
NetworkAttachmentSpec *NetworkAttachmentSpec `json:",omitempty"`
|
||||||
|
|
||||||
Resources *ResourceRequirements `json:",omitempty"`
|
Resources *ResourceRequirements `json:",omitempty"`
|
||||||
RestartPolicy *RestartPolicy `json:",omitempty"`
|
RestartPolicy *RestartPolicy `json:",omitempty"`
|
||||||
Placement *Placement `json:",omitempty"`
|
Placement *Placement `json:",omitempty"`
|
||||||
@ -65,12 +81,40 @@ type TaskSpec struct {
|
|||||||
// ForceUpdate is a counter that triggers an update even if no relevant
|
// ForceUpdate is a counter that triggers an update even if no relevant
|
||||||
// parameters have been changed.
|
// parameters have been changed.
|
||||||
ForceUpdate uint64
|
ForceUpdate uint64
|
||||||
|
|
||||||
|
Runtime RuntimeType `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resources represents resources (CPU/Memory).
|
// Resources represents resources (CPU/Memory).
|
||||||
type Resources struct {
|
type Resources struct {
|
||||||
NanoCPUs int64 `json:",omitempty"`
|
NanoCPUs int64 `json:",omitempty"`
|
||||||
MemoryBytes int64 `json:",omitempty"`
|
MemoryBytes int64 `json:",omitempty"`
|
||||||
|
GenericResources []GenericResource `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GenericResource represents a "user defined" resource which can
|
||||||
|
// be either an integer (e.g: SSD=3) or a string (e.g: SSD=sda1)
|
||||||
|
type GenericResource struct {
|
||||||
|
NamedResourceSpec *NamedGenericResource `json:",omitempty"`
|
||||||
|
DiscreteResourceSpec *DiscreteGenericResource `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedGenericResource represents a "user defined" resource which is defined
|
||||||
|
// as a string.
|
||||||
|
// "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...)
|
||||||
|
// Value is used to identify the resource (GPU="UUID-1", FPGA="/dev/sdb5", ...)
|
||||||
|
type NamedGenericResource struct {
|
||||||
|
Kind string `json:",omitempty"`
|
||||||
|
Value string `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DiscreteGenericResource represents a "user defined" resource which is defined
|
||||||
|
// as an integer
|
||||||
|
// "Kind" is used to describe the Kind of a resource (e.g: "GPU", "FPGA", "SSD", ...)
|
||||||
|
// Value is used to count the resource (SSD=5, HDD=3, ...)
|
||||||
|
type DiscreteGenericResource struct {
|
||||||
|
Kind string `json:",omitempty"`
|
||||||
|
Value int64 `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceRequirements represents resources requirements.
|
// ResourceRequirements represents resources requirements.
|
||||||
@ -81,7 +125,27 @@ type ResourceRequirements struct {
|
|||||||
|
|
||||||
// Placement represents orchestration parameters.
|
// Placement represents orchestration parameters.
|
||||||
type Placement struct {
|
type Placement struct {
|
||||||
Constraints []string `json:",omitempty"`
|
Constraints []string `json:",omitempty"`
|
||||||
|
Preferences []PlacementPreference `json:",omitempty"`
|
||||||
|
MaxReplicas uint64 `json:",omitempty"`
|
||||||
|
|
||||||
|
// Platforms stores all the platforms that the image can run on.
|
||||||
|
// This field is used in the platform filter for scheduling. If empty,
|
||||||
|
// then the platform filter is off, meaning there are no scheduling restrictions.
|
||||||
|
Platforms []Platform `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PlacementPreference provides a way to make the scheduler aware of factors
|
||||||
|
// such as topology.
|
||||||
|
type PlacementPreference struct {
|
||||||
|
Spread *SpreadOver
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpreadOver is a scheduling preference that instructs the scheduler to spread
|
||||||
|
// tasks evenly over groups of nodes identified by labels.
|
||||||
|
type SpreadOver struct {
|
||||||
|
// label descriptor, such as engine.labels.az
|
||||||
|
SpreadDescriptor string
|
||||||
}
|
}
|
||||||
|
|
||||||
// RestartPolicy represents the restart policy.
|
// RestartPolicy represents the restart policy.
|
||||||
@ -106,19 +170,19 @@ const (
|
|||||||
|
|
||||||
// TaskStatus represents the status of a task.
|
// TaskStatus represents the status of a task.
|
||||||
type TaskStatus struct {
|
type TaskStatus struct {
|
||||||
Timestamp time.Time `json:",omitempty"`
|
Timestamp time.Time `json:",omitempty"`
|
||||||
State TaskState `json:",omitempty"`
|
State TaskState `json:",omitempty"`
|
||||||
Message string `json:",omitempty"`
|
Message string `json:",omitempty"`
|
||||||
Err string `json:",omitempty"`
|
Err string `json:",omitempty"`
|
||||||
ContainerStatus ContainerStatus `json:",omitempty"`
|
ContainerStatus *ContainerStatus `json:",omitempty"`
|
||||||
PortStatus PortStatus `json:",omitempty"`
|
PortStatus PortStatus `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerStatus represents the status of a container.
|
// ContainerStatus represents the status of a container.
|
||||||
type ContainerStatus struct {
|
type ContainerStatus struct {
|
||||||
ContainerID string `json:",omitempty"`
|
ContainerID string
|
||||||
PID int `json:",omitempty"`
|
PID int
|
||||||
ExitCode int `json:",omitempty"`
|
ExitCode int
|
||||||
}
|
}
|
||||||
|
|
||||||
// PortStatus represents the port status of a task's host ports whose
|
// PortStatus represents the port status of a task's host ports whose
|
||||||
|
2
vendor/github.com/docker/docker/api/types/time/duration_convert.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/time/duration_convert.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package time
|
package time // import "github.com/docker/docker/api/types/time"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
19
vendor/github.com/docker/docker/api/types/time/timestamp.go
generated
vendored
19
vendor/github.com/docker/docker/api/types/time/timestamp.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package time
|
package time // import "github.com/docker/docker/api/types/time"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -29,10 +29,8 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var format string
|
var format string
|
||||||
var parseInLocation bool
|
|
||||||
|
|
||||||
// if the string has a Z or a + or three dashes use parse otherwise use parseinlocation
|
// if the string has a Z or a + or three dashes use parse otherwise use parseinlocation
|
||||||
parseInLocation = !(strings.ContainsAny(value, "zZ+") || strings.Count(value, "-") == 3)
|
parseInLocation := !(strings.ContainsAny(value, "zZ+") || strings.Count(value, "-") == 3)
|
||||||
|
|
||||||
if strings.Contains(value, ".") {
|
if strings.Contains(value, ".") {
|
||||||
if parseInLocation {
|
if parseInLocation {
|
||||||
@ -84,11 +82,14 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if there is a `-` then its an RFC3339 like timestamp otherwise assume unixtimestamp
|
// if there is a `-` then it's an RFC3339 like timestamp
|
||||||
if strings.Contains(value, "-") {
|
if strings.Contains(value, "-") {
|
||||||
return "", err // was probably an RFC3339 like timestamp but the parser failed with an error
|
return "", err // was probably an RFC3339 like timestamp but the parser failed with an error
|
||||||
}
|
}
|
||||||
return value, nil // unixtimestamp in and out case (meaning: the value passed at the command line is already in the right format for passing to the server)
|
if _, _, err := parseTimestamp(value); err != nil {
|
||||||
|
return "", fmt.Errorf("failed to parse value as time or duration: %q", value)
|
||||||
|
}
|
||||||
|
return value, nil // unix timestamp in and out case (meaning: the value passed at the command line is already in the right format for passing to the server)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%d.%09d", t.Unix(), int64(t.Nanosecond())), nil
|
return fmt.Sprintf("%d.%09d", t.Unix(), int64(t.Nanosecond())), nil
|
||||||
@ -106,6 +107,10 @@ func ParseTimestamps(value string, def int64) (int64, int64, error) {
|
|||||||
if value == "" {
|
if value == "" {
|
||||||
return def, 0, nil
|
return def, 0, nil
|
||||||
}
|
}
|
||||||
|
return parseTimestamp(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseTimestamp(value string) (int64, int64, error) {
|
||||||
sa := strings.SplitN(value, ".", 2)
|
sa := strings.SplitN(value, ".", 2)
|
||||||
s, err := strconv.ParseInt(sa[0], 10, 64)
|
s, err := strconv.ParseInt(sa[0], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -118,7 +123,7 @@ func ParseTimestamps(value string, def int64) (int64, int64, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return s, n, err
|
return s, n, err
|
||||||
}
|
}
|
||||||
// should already be in nanoseconds but just in case convert n to nanoseonds
|
// should already be in nanoseconds but just in case convert n to nanoseconds
|
||||||
n = int64(float64(n) * math.Pow(float64(10), float64(9-len(sa[1]))))
|
n = int64(float64(n) * math.Pow(float64(10), float64(9-len(sa[1]))))
|
||||||
return s, n, nil
|
return s, n, nil
|
||||||
}
|
}
|
||||||
|
197
vendor/github.com/docker/docker/api/types/types.go
generated
vendored
197
vendor/github.com/docker/docker/api/types/types.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package types
|
package types // import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@ -17,38 +17,6 @@ import (
|
|||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerChange contains response of Engine API:
|
|
||||||
// GET "/containers/{name:.*}/changes"
|
|
||||||
type ContainerChange struct {
|
|
||||||
Kind int
|
|
||||||
Path string
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageHistory contains response of Engine API:
|
|
||||||
// GET "/images/{name:.*}/history"
|
|
||||||
type ImageHistory struct {
|
|
||||||
ID string `json:"Id"`
|
|
||||||
Created int64
|
|
||||||
CreatedBy string
|
|
||||||
Tags []string
|
|
||||||
Size int64
|
|
||||||
Comment string
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageDelete contains response of Engine API:
|
|
||||||
// DELETE "/images/{name:.*}"
|
|
||||||
type ImageDelete struct {
|
|
||||||
Untagged string `json:",omitempty"`
|
|
||||||
Deleted string `json:",omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GraphDriverData returns Image's graph driver config info
|
|
||||||
// when calling inspect command
|
|
||||||
type GraphDriverData struct {
|
|
||||||
Name string
|
|
||||||
Data map[string]string
|
|
||||||
}
|
|
||||||
|
|
||||||
// RootFS returns Image's RootFS description including the layer IDs.
|
// RootFS returns Image's RootFS description including the layer IDs.
|
||||||
type RootFS struct {
|
type RootFS struct {
|
||||||
Type string
|
Type string
|
||||||
@ -77,6 +45,12 @@ type ImageInspect struct {
|
|||||||
VirtualSize int64
|
VirtualSize int64
|
||||||
GraphDriver GraphDriverData
|
GraphDriver GraphDriverData
|
||||||
RootFS RootFS
|
RootFS RootFS
|
||||||
|
Metadata ImageMetadata
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageMetadata contains engine-local data about the image
|
||||||
|
type ImageMetadata struct {
|
||||||
|
LastTagTime time.Time `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container contains response of Engine API:
|
// Container contains response of Engine API:
|
||||||
@ -125,23 +99,30 @@ type ContainerStats struct {
|
|||||||
OSType string `json:"ostype"`
|
OSType string `json:"ostype"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerProcessList contains response of Engine API:
|
|
||||||
// GET "/containers/{name:.*}/top"
|
|
||||||
type ContainerProcessList struct {
|
|
||||||
Processes [][]string
|
|
||||||
Titles []string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ping contains response of Engine API:
|
// Ping contains response of Engine API:
|
||||||
// GET "/_ping"
|
// GET "/_ping"
|
||||||
type Ping struct {
|
type Ping struct {
|
||||||
APIVersion string
|
APIVersion string
|
||||||
Experimental bool
|
OSType string
|
||||||
|
Experimental bool
|
||||||
|
BuilderVersion BuilderVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComponentVersion describes the version information for a specific component.
|
||||||
|
type ComponentVersion struct {
|
||||||
|
Name string
|
||||||
|
Version string
|
||||||
|
Details map[string]string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version contains response of Engine API:
|
// Version contains response of Engine API:
|
||||||
// GET "/version"
|
// GET "/version"
|
||||||
type Version struct {
|
type Version struct {
|
||||||
|
Platform struct{ Name string } `json:",omitempty"`
|
||||||
|
Components []ComponentVersion `json:",omitempty"`
|
||||||
|
|
||||||
|
// The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility
|
||||||
|
|
||||||
Version string
|
Version string
|
||||||
APIVersion string `json:"ApiVersion"`
|
APIVersion string `json:"ApiVersion"`
|
||||||
MinAPIVersion string `json:"MinAPIVersion,omitempty"`
|
MinAPIVersion string `json:"MinAPIVersion,omitempty"`
|
||||||
@ -154,11 +135,11 @@ type Version struct {
|
|||||||
BuildTime string `json:",omitempty"`
|
BuildTime string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit records a external tool actual commit id version along the
|
// Commit holds the Git-commit (SHA1) that a binary was built from, as reported
|
||||||
// one expect by dockerd as set at build time
|
// in the version-string of external tools, such as containerd, or runC.
|
||||||
type Commit struct {
|
type Commit struct {
|
||||||
ID string
|
ID string // ID is the actual commit ID of external tool.
|
||||||
Expected string
|
Expected string // Expected is the commit ID of external tool expected by dockerd as set at build time.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info contains response of Engine API:
|
// Info contains response of Engine API:
|
||||||
@ -177,10 +158,12 @@ type Info struct {
|
|||||||
MemoryLimit bool
|
MemoryLimit bool
|
||||||
SwapLimit bool
|
SwapLimit bool
|
||||||
KernelMemory bool
|
KernelMemory bool
|
||||||
|
KernelMemoryTCP bool
|
||||||
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
||||||
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
||||||
CPUShares bool
|
CPUShares bool
|
||||||
CPUSet bool
|
CPUSet bool
|
||||||
|
PidsLimit bool
|
||||||
IPv4Forwarding bool
|
IPv4Forwarding bool
|
||||||
BridgeNfIptables bool
|
BridgeNfIptables bool
|
||||||
BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
|
BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
|
||||||
@ -194,12 +177,14 @@ type Info struct {
|
|||||||
NEventsListener int
|
NEventsListener int
|
||||||
KernelVersion string
|
KernelVersion string
|
||||||
OperatingSystem string
|
OperatingSystem string
|
||||||
|
OSVersion string
|
||||||
OSType string
|
OSType string
|
||||||
Architecture string
|
Architecture string
|
||||||
IndexServerAddress string
|
IndexServerAddress string
|
||||||
RegistryConfig *registry.ServiceConfig
|
RegistryConfig *registry.ServiceConfig
|
||||||
NCPU int
|
NCPU int
|
||||||
MemTotal int64
|
MemTotal int64
|
||||||
|
GenericResources []swarm.GenericResource
|
||||||
DockerRootDir string
|
DockerRootDir string
|
||||||
HTTPProxy string `json:"HttpProxy"`
|
HTTPProxy string `json:"HttpProxy"`
|
||||||
HTTPSProxy string `json:"HttpsProxy"`
|
HTTPSProxy string `json:"HttpsProxy"`
|
||||||
@ -223,6 +208,8 @@ type Info struct {
|
|||||||
RuncCommit Commit
|
RuncCommit Commit
|
||||||
InitCommit Commit
|
InitCommit Commit
|
||||||
SecurityOptions []string
|
SecurityOptions []string
|
||||||
|
ProductLicense string `json:",omitempty"`
|
||||||
|
Warnings []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyValue holds a key/value pair
|
// KeyValue holds a key/value pair
|
||||||
@ -276,6 +263,8 @@ type PluginsInfo struct {
|
|||||||
Network []string
|
Network []string
|
||||||
// List of Authorization plugins registered
|
// List of Authorization plugins registered
|
||||||
Authorization []string
|
Authorization []string
|
||||||
|
// List of Log plugins registered
|
||||||
|
Log []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecStartCheck is a temp struct used by execStart
|
// ExecStartCheck is a temp struct used by execStart
|
||||||
@ -313,7 +302,7 @@ type Health struct {
|
|||||||
// ContainerState stores container's running state
|
// ContainerState stores container's running state
|
||||||
// it's part of ContainerJSONBase and will return by "inspect" command
|
// it's part of ContainerJSONBase and will return by "inspect" command
|
||||||
type ContainerState struct {
|
type ContainerState struct {
|
||||||
Status string
|
Status string // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"
|
||||||
Running bool
|
Running bool
|
||||||
Paused bool
|
Paused bool
|
||||||
Restarting bool
|
Restarting bool
|
||||||
@ -356,6 +345,7 @@ type ContainerJSONBase struct {
|
|||||||
Name string
|
Name string
|
||||||
RestartCount int
|
RestartCount int
|
||||||
Driver string
|
Driver string
|
||||||
|
Platform string
|
||||||
MountLabel string
|
MountLabel string
|
||||||
ProcessLabel string
|
ProcessLabel string
|
||||||
AppArmorProfile string
|
AppArmorProfile string
|
||||||
@ -429,19 +419,23 @@ type MountPoint struct {
|
|||||||
|
|
||||||
// NetworkResource is the body of the "get network" http response message
|
// NetworkResource is the body of the "get network" http response message
|
||||||
type NetworkResource struct {
|
type NetworkResource struct {
|
||||||
Name string // Name is the requested name of the network
|
Name string // Name is the requested name of the network
|
||||||
ID string `json:"Id"` // ID uniquely identifies a network on a single machine
|
ID string `json:"Id"` // ID uniquely identifies a network on a single machine
|
||||||
Created time.Time // Created is the time the network created
|
Created time.Time // Created is the time the network created
|
||||||
Scope string // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level)
|
Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level)
|
||||||
Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
|
Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
|
||||||
EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6
|
EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6
|
||||||
IPAM network.IPAM // IPAM is the network's IP Address Management
|
IPAM network.IPAM // IPAM is the network's IP Address Management
|
||||||
Internal bool // Internal represents if the network is used internal only
|
Internal bool // Internal represents if the network is used internal only
|
||||||
Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
|
Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
|
||||||
Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
|
Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster.
|
||||||
Options map[string]string // Options holds the network specific options to use for when creating the network
|
ConfigFrom network.ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network.
|
||||||
Labels map[string]string // Labels holds metadata specific to the network being created
|
ConfigOnly bool // ConfigOnly networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services.
|
||||||
Peers []network.PeerInfo `json:",omitempty"` // List of peer nodes for an overlay network
|
Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
|
||||||
|
Options map[string]string // Options holds the network specific options to use for when creating the network
|
||||||
|
Labels map[string]string // Labels holds metadata specific to the network being created
|
||||||
|
Peers []network.PeerInfo `json:",omitempty"` // List of peer nodes for an overlay network
|
||||||
|
Services map[string]network.ServiceInfo `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointResource contains network resources allocated and used for a container in a network
|
// EndpointResource contains network resources allocated and used for a container in a network
|
||||||
@ -455,12 +449,23 @@ type EndpointResource struct {
|
|||||||
|
|
||||||
// NetworkCreate is the expected body of the "create network" http request message
|
// NetworkCreate is the expected body of the "create network" http request message
|
||||||
type NetworkCreate struct {
|
type NetworkCreate struct {
|
||||||
|
// Check for networks with duplicate names.
|
||||||
|
// Network is primarily keyed based on a random ID and not on the name.
|
||||||
|
// Network name is strictly a user-friendly alias to the network
|
||||||
|
// which is uniquely identified using ID.
|
||||||
|
// And there is no guaranteed way to check for duplicates.
|
||||||
|
// Option CheckDuplicate is there to provide a best effort checking of any networks
|
||||||
|
// which has the same name but it is not guaranteed to catch all name collisions.
|
||||||
CheckDuplicate bool
|
CheckDuplicate bool
|
||||||
Driver string
|
Driver string
|
||||||
|
Scope string
|
||||||
EnableIPv6 bool
|
EnableIPv6 bool
|
||||||
IPAM *network.IPAM
|
IPAM *network.IPAM
|
||||||
Internal bool
|
Internal bool
|
||||||
Attachable bool
|
Attachable bool
|
||||||
|
Ingress bool
|
||||||
|
ConfigOnly bool
|
||||||
|
ConfigFrom *network.ConfigReference
|
||||||
Options map[string]string
|
Options map[string]string
|
||||||
Labels map[string]string
|
Labels map[string]string
|
||||||
}
|
}
|
||||||
@ -489,6 +494,12 @@ type NetworkDisconnect struct {
|
|||||||
Force bool
|
Force bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkInspectOptions holds parameters to inspect network
|
||||||
|
type NetworkInspectOptions struct {
|
||||||
|
Scope string
|
||||||
|
Verbose bool
|
||||||
|
}
|
||||||
|
|
||||||
// Checkpoint represents the details of a checkpoint
|
// Checkpoint represents the details of a checkpoint
|
||||||
type Checkpoint struct {
|
type Checkpoint struct {
|
||||||
Name string // Name is the name of the checkpoint
|
Name string // Name is the name of the checkpoint
|
||||||
@ -503,10 +514,12 @@ type Runtime struct {
|
|||||||
// DiskUsage contains response of Engine API:
|
// DiskUsage contains response of Engine API:
|
||||||
// GET "/system/df"
|
// GET "/system/df"
|
||||||
type DiskUsage struct {
|
type DiskUsage struct {
|
||||||
LayersSize int64
|
LayersSize int64
|
||||||
Images []*ImageSummary
|
Images []*ImageSummary
|
||||||
Containers []*Container
|
Containers []*Container
|
||||||
Volumes []*Volume
|
Volumes []*Volume
|
||||||
|
BuildCache []*BuildCache
|
||||||
|
BuilderSize int64 // deprecated
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainersPruneReport contains the response for Engine API:
|
// ContainersPruneReport contains the response for Engine API:
|
||||||
@ -526,7 +539,14 @@ type VolumesPruneReport struct {
|
|||||||
// ImagesPruneReport contains the response for Engine API:
|
// ImagesPruneReport contains the response for Engine API:
|
||||||
// POST "/images/prune"
|
// POST "/images/prune"
|
||||||
type ImagesPruneReport struct {
|
type ImagesPruneReport struct {
|
||||||
ImagesDeleted []ImageDelete
|
ImagesDeleted []ImageDeleteResponseItem
|
||||||
|
SpaceReclaimed uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildCachePruneReport contains the response for Engine API:
|
||||||
|
// POST "/build/prune"
|
||||||
|
type BuildCachePruneReport struct {
|
||||||
|
CachesDeleted []string
|
||||||
SpaceReclaimed uint64
|
SpaceReclaimed uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,3 +567,50 @@ type SecretCreateResponse struct {
|
|||||||
type SecretListOptions struct {
|
type SecretListOptions struct {
|
||||||
Filters filters.Args
|
Filters filters.Args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ConfigCreateResponse contains the information returned to a client
|
||||||
|
// on the creation of a new config.
|
||||||
|
type ConfigCreateResponse struct {
|
||||||
|
// ID is the id of the created config.
|
||||||
|
ID string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigListOptions holds parameters to list configs
|
||||||
|
type ConfigListOptions struct {
|
||||||
|
Filters filters.Args
|
||||||
|
}
|
||||||
|
|
||||||
|
// PushResult contains the tag, manifest digest, and manifest size from the
|
||||||
|
// push. It's used to signal this information to the trust code in the client
|
||||||
|
// so it can sign the manifest if necessary.
|
||||||
|
type PushResult struct {
|
||||||
|
Tag string
|
||||||
|
Digest string
|
||||||
|
Size int
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildResult contains the image id of a successful build
|
||||||
|
type BuildResult struct {
|
||||||
|
ID string
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildCache contains information about a build cache record
|
||||||
|
type BuildCache struct {
|
||||||
|
ID string
|
||||||
|
Parent string
|
||||||
|
Type string
|
||||||
|
Description string
|
||||||
|
InUse bool
|
||||||
|
Shared bool
|
||||||
|
Size int64
|
||||||
|
CreatedAt time.Time
|
||||||
|
LastUsedAt *time.Time
|
||||||
|
UsageCount int
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildCachePruneOptions hold parameters to prune the build cache
|
||||||
|
type BuildCachePruneOptions struct {
|
||||||
|
All bool
|
||||||
|
KeepStorage int64
|
||||||
|
Filters filters.Args
|
||||||
|
}
|
||||||
|
4
vendor/github.com/docker/docker/api/types/versions/README.md
generated
vendored
4
vendor/github.com/docker/docker/api/types/versions/README.md
generated
vendored
@ -1,10 +1,10 @@
|
|||||||
## Legacy API type versions
|
# Legacy API type versions
|
||||||
|
|
||||||
This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`.
|
This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`.
|
||||||
|
|
||||||
Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`.
|
Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`.
|
||||||
|
|
||||||
### Package name conventions
|
## Package name conventions
|
||||||
|
|
||||||
The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention:
|
The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention:
|
||||||
|
|
||||||
|
2
vendor/github.com/docker/docker/api/types/versions/compare.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/versions/compare.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package versions
|
package versions // import "github.com/docker/docker/api/types/versions"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
17
vendor/github.com/docker/docker/api/types/volume.go
generated
vendored
17
vendor/github.com/docker/docker/api/types/volume.go
generated
vendored
@ -7,6 +7,9 @@ package types
|
|||||||
// swagger:model Volume
|
// swagger:model Volume
|
||||||
type Volume struct {
|
type Volume struct {
|
||||||
|
|
||||||
|
// Date/Time the volume was created.
|
||||||
|
CreatedAt string `json:"CreatedAt,omitempty"`
|
||||||
|
|
||||||
// Name of the volume driver used by the volume.
|
// Name of the volume driver used by the volume.
|
||||||
// Required: true
|
// Required: true
|
||||||
Driver string `json:"Driver"`
|
Driver string `json:"Driver"`
|
||||||
@ -44,15 +47,23 @@ type Volume struct {
|
|||||||
UsageData *VolumeUsageData `json:"UsageData,omitempty"`
|
UsageData *VolumeUsageData `json:"UsageData,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumeUsageData volume usage data
|
// VolumeUsageData Usage details about the volume. This information is used by the
|
||||||
|
// `GET /system/df` endpoint, and omitted in other endpoints.
|
||||||
|
//
|
||||||
// swagger:model VolumeUsageData
|
// swagger:model VolumeUsageData
|
||||||
type VolumeUsageData struct {
|
type VolumeUsageData struct {
|
||||||
|
|
||||||
// The number of containers referencing this volume.
|
// The number of containers referencing this volume. This field
|
||||||
|
// is set to `-1` if the reference-count is not available.
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
RefCount int64 `json:"RefCount"`
|
RefCount int64 `json:"RefCount"`
|
||||||
|
|
||||||
// The disk space used by the volume (local driver only)
|
// Amount of disk space used by the volume (in bytes). This information
|
||||||
|
// is only available for volumes created with the `"local"` volume
|
||||||
|
// driver. For volumes created with other volume drivers, this field
|
||||||
|
// is set to `-1` ("not available")
|
||||||
|
//
|
||||||
// Required: true
|
// Required: true
|
||||||
Size int64 `json:"Size"`
|
Size int64 `json:"Size"`
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package volume
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// DO NOT EDIT THIS FILE
|
// DO NOT EDIT THIS FILE
|
||||||
// This file was generated by `swagger generate operation`
|
// This file was generated by `swagger generate operation`
|
||||||
//
|
//
|
||||||
// See hack/swagger-gen.sh
|
// See hack/generate-swagger-api.sh
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// VolumesCreateBody volumes create body
|
// VolumeCreateBody Volume configuration
|
||||||
// swagger:model VolumesCreateBody
|
// swagger:model VolumeCreateBody
|
||||||
type VolumesCreateBody struct {
|
type VolumeCreateBody struct {
|
||||||
|
|
||||||
// Name of the volume driver to use.
|
// Name of the volume driver to use.
|
||||||
// Required: true
|
// Required: true
|
@ -1,17 +1,17 @@
|
|||||||
package volume
|
package volume // import "github.com/docker/docker/api/types/volume"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// DO NOT EDIT THIS FILE
|
// DO NOT EDIT THIS FILE
|
||||||
// This file was generated by `swagger generate operation`
|
// This file was generated by `swagger generate operation`
|
||||||
//
|
//
|
||||||
// See hack/swagger-gen.sh
|
// See hack/generate-swagger-api.sh
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
import "github.com/docker/docker/api/types"
|
import "github.com/docker/docker/api/types"
|
||||||
|
|
||||||
// VolumesListOKBody volumes list o k body
|
// VolumeListOKBody Volume list response
|
||||||
// swagger:model VolumesListOKBody
|
// swagger:model VolumeListOKBody
|
||||||
type VolumesListOKBody struct {
|
type VolumeListOKBody struct {
|
||||||
|
|
||||||
// List of volumes
|
// List of volumes
|
||||||
// Required: true
|
// Required: true
|
2
vendor/github.com/docker/docker/client/README.md
generated
vendored
2
vendor/github.com/docker/docker/client/README.md
generated
vendored
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cli, err := client.NewEnvClient()
|
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
16
vendor/github.com/docker/docker/client/build_cancel.go
generated
vendored
Normal file
16
vendor/github.com/docker/docker/client/build_cancel.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BuildCancel requests the daemon to cancel ongoing build request
|
||||||
|
func (cli *Client) BuildCancel(ctx context.Context, id string) error {
|
||||||
|
query := url.Values{}
|
||||||
|
query.Set("id", id)
|
||||||
|
|
||||||
|
serverResp, err := cli.post(ctx, "/build/cancel", query, nil, nil)
|
||||||
|
ensureReaderClosed(serverResp)
|
||||||
|
return err
|
||||||
|
}
|
45
vendor/github.com/docker/docker/client/build_prune.go
generated
vendored
Normal file
45
vendor/github.com/docker/docker/client/build_prune.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BuildCachePrune requests the daemon to delete unused cache data
|
||||||
|
func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) {
|
||||||
|
if err := cli.NewVersionError("1.31", "build prune"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
report := types.BuildCachePruneReport{}
|
||||||
|
|
||||||
|
query := url.Values{}
|
||||||
|
if opts.All {
|
||||||
|
query.Set("all", "1")
|
||||||
|
}
|
||||||
|
query.Set("keep-storage", fmt.Sprintf("%d", opts.KeepStorage))
|
||||||
|
filters, err := filters.ToJSON(opts.Filters)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "prune could not marshal filters option")
|
||||||
|
}
|
||||||
|
query.Set("filters", filters)
|
||||||
|
|
||||||
|
serverResp, err := cli.post(ctx, "/build/prune", query, nil, nil)
|
||||||
|
defer ensureReaderClosed(serverResp)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := json.NewDecoder(serverResp.body).Decode(&report); err != nil {
|
||||||
|
return nil, fmt.Errorf("Error retrieving disk usage: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &report, nil
|
||||||
|
}
|
5
vendor/github.com/docker/docker/client/checkpoint_create.go
generated
vendored
5
vendor/github.com/docker/docker/client/checkpoint_create.go
generated
vendored
@ -1,8 +1,9 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckpointCreate creates a checkpoint from the given container with the given name
|
// CheckpointCreate creates a checkpoint from the given container with the given name
|
||||||
|
4
vendor/github.com/docker/docker/client/checkpoint_delete.go
generated
vendored
4
vendor/github.com/docker/docker/client/checkpoint_delete.go
generated
vendored
@ -1,10 +1,10 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckpointDelete deletes the checkpoint with the given name from the given container
|
// CheckpointDelete deletes the checkpoint with the given name from the given container
|
||||||
|
10
vendor/github.com/docker/docker/client/checkpoint_list.go
generated
vendored
10
vendor/github.com/docker/docker/client/checkpoint_list.go
generated
vendored
@ -1,14 +1,14 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckpointList returns the volumes configured in the docker host.
|
// CheckpointList returns the checkpoints of the given container in the docker host
|
||||||
func (cli *Client) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
|
func (cli *Client) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
|
||||||
var checkpoints []types.Checkpoint
|
var checkpoints []types.Checkpoint
|
||||||
|
|
||||||
@ -18,11 +18,11 @@ func (cli *Client) CheckpointList(ctx context.Context, container string, options
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil)
|
resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", query, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return checkpoints, err
|
return checkpoints, wrapResponseError(err, resp, "container", container)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(resp.body).Decode(&checkpoints)
|
err = json.NewDecoder(resp.body).Decode(&checkpoints)
|
||||||
ensureReaderClosed(resp)
|
|
||||||
return checkpoints, err
|
return checkpoints, err
|
||||||
}
|
}
|
||||||
|
291
vendor/github.com/docker/docker/client/client.go
generated
vendored
291
vendor/github.com/docker/docker/client/client.go
generated
vendored
@ -1,10 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Package client is a Go client for the Docker Engine API.
|
Package client is a Go client for the Docker Engine API.
|
||||||
|
|
||||||
The "docker" command uses this package to communicate with the daemon. It can also
|
|
||||||
be used by your own Go applications to do anything the command-line interface does
|
|
||||||
– running containers, pulling images, managing swarms, etc.
|
|
||||||
|
|
||||||
For more information about the Engine API, see the documentation:
|
For more information about the Engine API, see the documentation:
|
||||||
https://docs.docker.com/engine/reference/api/
|
https://docs.docker.com/engine/reference/api/
|
||||||
|
|
||||||
@ -27,7 +23,7 @@ For example, to list running containers (the equivalent of "docker ps"):
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cli, err := client.NewEnvClient()
|
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -43,22 +39,26 @@ For example, to list running containers (the equivalent of "docker ps"):
|
|||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api"
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/go-connections/sockets"
|
"github.com/docker/go-connections/sockets"
|
||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultVersion is the version of the current stable API
|
// ErrRedirect is the error returned by checkRedirect when the request is non-GET.
|
||||||
const DefaultVersion string = "1.25"
|
var ErrRedirect = errors.New("unexpected redirect in response")
|
||||||
|
|
||||||
// Client is the API client that performs all operations
|
// Client is the API client that performs all operations
|
||||||
// against a docker server.
|
// against a docker server.
|
||||||
@ -81,155 +81,186 @@ type Client struct {
|
|||||||
customHTTPHeaders map[string]string
|
customHTTPHeaders map[string]string
|
||||||
// manualOverride is set to true when the version was set by users.
|
// manualOverride is set to true when the version was set by users.
|
||||||
manualOverride bool
|
manualOverride bool
|
||||||
|
|
||||||
|
// negotiateVersion indicates if the client should automatically negotiate
|
||||||
|
// the API version to use when making requests. API version negotiation is
|
||||||
|
// performed on the first request, after which negotiated is set to "true"
|
||||||
|
// so that subsequent requests do not re-negotiate.
|
||||||
|
negotiateVersion bool
|
||||||
|
|
||||||
|
// negotiated indicates that API version negotiation took place
|
||||||
|
negotiated bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEnvClient initializes a new API client based on environment variables.
|
// CheckRedirect specifies the policy for dealing with redirect responses:
|
||||||
// Use DOCKER_HOST to set the url to the docker server.
|
// If the request is non-GET return `ErrRedirect`. Otherwise use the last response.
|
||||||
// Use DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
|
//
|
||||||
// Use DOCKER_CERT_PATH to load the tls certificates from.
|
// Go 1.8 changes behavior for HTTP redirects (specifically 301, 307, and 308) in the client .
|
||||||
// Use DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
|
// The Docker client (and by extension docker API client) can be made to send a request
|
||||||
func NewEnvClient() (*Client, error) {
|
// like POST /containers//start where what would normally be in the name section of the URL is empty.
|
||||||
var client *http.Client
|
// This triggers an HTTP 301 from the daemon.
|
||||||
if dockerCertPath := os.Getenv("DOCKER_CERT_PATH"); dockerCertPath != "" {
|
// In go 1.8 this 301 will be converted to a GET request, and ends up getting a 404 from the daemon.
|
||||||
options := tlsconfig.Options{
|
// This behavior change manifests in the client in that before the 301 was not followed and
|
||||||
CAFile: filepath.Join(dockerCertPath, "ca.pem"),
|
// the client did not generate an error, but now results in a message like Error response from daemon: page not found.
|
||||||
CertFile: filepath.Join(dockerCertPath, "cert.pem"),
|
func CheckRedirect(req *http.Request, via []*http.Request) error {
|
||||||
KeyFile: filepath.Join(dockerCertPath, "key.pem"),
|
if via[0].Method == http.MethodGet {
|
||||||
InsecureSkipVerify: os.Getenv("DOCKER_TLS_VERIFY") == "",
|
return http.ErrUseLastResponse
|
||||||
}
|
|
||||||
tlsc, err := tlsconfig.Client(options)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
client = &http.Client{
|
|
||||||
Transport: &http.Transport{
|
|
||||||
TLSClientConfig: tlsc,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return ErrRedirect
|
||||||
host := os.Getenv("DOCKER_HOST")
|
|
||||||
if host == "" {
|
|
||||||
host = DefaultDockerHost
|
|
||||||
}
|
|
||||||
version := os.Getenv("DOCKER_API_VERSION")
|
|
||||||
if version == "" {
|
|
||||||
version = DefaultVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
cli, err := NewClient(host, version, client, nil)
|
|
||||||
if err != nil {
|
|
||||||
return cli, err
|
|
||||||
}
|
|
||||||
if os.Getenv("DOCKER_API_VERSION") != "" {
|
|
||||||
cli.manualOverride = true
|
|
||||||
}
|
|
||||||
return cli, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient initializes a new API client for the given host and API version.
|
// NewClientWithOpts initializes a new API client with default values. It takes functors
|
||||||
// It uses the given http client as transport.
|
// to modify values when creating it, like `NewClientWithOpts(WithVersion(…))`
|
||||||
// It also initializes the custom http headers to add to each request.
|
// It also initializes the custom http headers to add to each request.
|
||||||
//
|
//
|
||||||
// It won't send any version information if the version number is empty. It is
|
// It won't send any version information if the version number is empty. It is
|
||||||
// highly recommended that you set a version or your client may break if the
|
// highly recommended that you set a version or your client may break if the
|
||||||
// server is upgraded.
|
// server is upgraded.
|
||||||
func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error) {
|
func NewClientWithOpts(ops ...Opt) (*Client, error) {
|
||||||
proto, addr, basePath, err := ParseHost(host)
|
client, err := defaultHTTPClient(DefaultDockerHost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
c := &Client{
|
||||||
|
host: DefaultDockerHost,
|
||||||
|
version: api.DefaultVersion,
|
||||||
|
client: client,
|
||||||
|
proto: defaultProto,
|
||||||
|
addr: defaultAddr,
|
||||||
|
}
|
||||||
|
|
||||||
if client != nil {
|
for _, op := range ops {
|
||||||
if _, ok := client.Transport.(*http.Transport); !ok {
|
if err := op(c); err != nil {
|
||||||
return nil, fmt.Errorf("unable to verify TLS configuration, invalid transport %v", client.Transport)
|
return nil, err
|
||||||
}
|
|
||||||
} else {
|
|
||||||
transport := new(http.Transport)
|
|
||||||
sockets.ConfigureTransport(transport, proto, addr)
|
|
||||||
client = &http.Client{
|
|
||||||
Transport: transport,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scheme := "http"
|
if _, ok := c.client.Transport.(http.RoundTripper); !ok {
|
||||||
tlsConfig := resolveTLSConfig(client.Transport)
|
return nil, fmt.Errorf("unable to verify TLS configuration, invalid transport %v", c.client.Transport)
|
||||||
if tlsConfig != nil {
|
}
|
||||||
// TODO(stevvooe): This isn't really the right way to write clients in Go.
|
if c.scheme == "" {
|
||||||
// `NewClient` should probably only take an `*http.Client` and work from there.
|
c.scheme = "http"
|
||||||
// Unfortunately, the model of having a host-ish/url-thingy as the connection
|
|
||||||
// string has us confusing protocol and transport layers. We continue doing
|
tlsConfig := resolveTLSConfig(c.client.Transport)
|
||||||
// this to avoid breaking existing clients but this should be addressed.
|
if tlsConfig != nil {
|
||||||
scheme = "https"
|
// TODO(stevvooe): This isn't really the right way to write clients in Go.
|
||||||
|
// `NewClient` should probably only take an `*http.Client` and work from there.
|
||||||
|
// Unfortunately, the model of having a host-ish/url-thingy as the connection
|
||||||
|
// string has us confusing protocol and transport layers. We continue doing
|
||||||
|
// this to avoid breaking existing clients but this should be addressed.
|
||||||
|
c.scheme = "https"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Client{
|
return c, nil
|
||||||
scheme: scheme,
|
}
|
||||||
host: host,
|
|
||||||
proto: proto,
|
func defaultHTTPClient(host string) (*http.Client, error) {
|
||||||
addr: addr,
|
url, err := ParseHostURL(host)
|
||||||
basePath: basePath,
|
if err != nil {
|
||||||
client: client,
|
return nil, err
|
||||||
version: version,
|
}
|
||||||
customHTTPHeaders: httpHeaders,
|
transport := new(http.Transport)
|
||||||
|
sockets.ConfigureTransport(transport, url.Scheme, url.Host)
|
||||||
|
return &http.Client{
|
||||||
|
Transport: transport,
|
||||||
|
CheckRedirect: CheckRedirect,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close ensures that transport.Client is closed
|
// Close the transport used by the client
|
||||||
// especially needed while using NewClient with *http.Client = nil
|
|
||||||
// for example
|
|
||||||
// client.NewClient("unix:///var/run/docker.sock", nil, "v1.18", map[string]string{"User-Agent": "engine-api-cli-1.0"})
|
|
||||||
func (cli *Client) Close() error {
|
func (cli *Client) Close() error {
|
||||||
|
|
||||||
if t, ok := cli.client.Transport.(*http.Transport); ok {
|
if t, ok := cli.client.Transport.(*http.Transport); ok {
|
||||||
t.CloseIdleConnections()
|
t.CloseIdleConnections()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getAPIPath returns the versioned request path to call the api.
|
// getAPIPath returns the versioned request path to call the api.
|
||||||
// It appends the query parameters to the path if they are not empty.
|
// It appends the query parameters to the path if they are not empty.
|
||||||
func (cli *Client) getAPIPath(p string, query url.Values) string {
|
func (cli *Client) getAPIPath(ctx context.Context, p string, query url.Values) string {
|
||||||
var apiPath string
|
var apiPath string
|
||||||
|
if cli.negotiateVersion && !cli.negotiated {
|
||||||
|
cli.NegotiateAPIVersion(ctx)
|
||||||
|
}
|
||||||
if cli.version != "" {
|
if cli.version != "" {
|
||||||
v := strings.TrimPrefix(cli.version, "v")
|
v := strings.TrimPrefix(cli.version, "v")
|
||||||
apiPath = fmt.Sprintf("%s/v%s%s", cli.basePath, v, p)
|
apiPath = path.Join(cli.basePath, "/v"+v, p)
|
||||||
} else {
|
} else {
|
||||||
apiPath = fmt.Sprintf("%s%s", cli.basePath, p)
|
apiPath = path.Join(cli.basePath, p)
|
||||||
}
|
}
|
||||||
|
return (&url.URL{Path: apiPath, RawQuery: query.Encode()}).String()
|
||||||
u := &url.URL{
|
|
||||||
Path: apiPath,
|
|
||||||
}
|
|
||||||
if len(query) > 0 {
|
|
||||||
u.RawQuery = query.Encode()
|
|
||||||
}
|
|
||||||
return u.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientVersion returns the version string associated with this
|
// ClientVersion returns the API version used by this client.
|
||||||
// instance of the Client. Note that this value can be changed
|
|
||||||
// via the DOCKER_API_VERSION env var.
|
|
||||||
func (cli *Client) ClientVersion() string {
|
func (cli *Client) ClientVersion() string {
|
||||||
return cli.version
|
return cli.version
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateClientVersion updates the version string associated with this
|
// NegotiateAPIVersion queries the API and updates the version to match the
|
||||||
// instance of the Client.
|
// API version. Any errors are silently ignored. If a manual override is in place,
|
||||||
func (cli *Client) UpdateClientVersion(v string) {
|
// either through the `DOCKER_API_VERSION` environment variable, or if the client
|
||||||
|
// was initialized with a fixed version (`opts.WithVersion(xx)`), no negotiation
|
||||||
|
// will be performed.
|
||||||
|
func (cli *Client) NegotiateAPIVersion(ctx context.Context) {
|
||||||
if !cli.manualOverride {
|
if !cli.manualOverride {
|
||||||
cli.version = v
|
ping, _ := cli.Ping(ctx)
|
||||||
|
cli.negotiateAPIVersionPing(ping)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseHost verifies that the given host strings is valid.
|
// NegotiateAPIVersionPing updates the client version to match the Ping.APIVersion
|
||||||
func ParseHost(host string) (string, string, string, error) {
|
// if the ping version is less than the default version. If a manual override is
|
||||||
|
// in place, either through the `DOCKER_API_VERSION` environment variable, or if
|
||||||
|
// the client was initialized with a fixed version (`opts.WithVersion(xx)`), no
|
||||||
|
// negotiation is performed.
|
||||||
|
func (cli *Client) NegotiateAPIVersionPing(p types.Ping) {
|
||||||
|
if !cli.manualOverride {
|
||||||
|
cli.negotiateAPIVersionPing(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// negotiateAPIVersionPing queries the API and updates the version to match the
|
||||||
|
// API version. Any errors are silently ignored.
|
||||||
|
func (cli *Client) negotiateAPIVersionPing(p types.Ping) {
|
||||||
|
// try the latest version before versioning headers existed
|
||||||
|
if p.APIVersion == "" {
|
||||||
|
p.APIVersion = "1.24"
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the client is not initialized with a version, start with the latest supported version
|
||||||
|
if cli.version == "" {
|
||||||
|
cli.version = api.DefaultVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// if server version is lower than the client version, downgrade
|
||||||
|
if versions.LessThan(p.APIVersion, cli.version) {
|
||||||
|
cli.version = p.APIVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the results, so that automatic API version negotiation (if enabled)
|
||||||
|
// won't be performed on the next request.
|
||||||
|
if cli.negotiateVersion {
|
||||||
|
cli.negotiated = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DaemonHost returns the host address used by the client
|
||||||
|
func (cli *Client) DaemonHost() string {
|
||||||
|
return cli.host
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTPClient returns a copy of the HTTP client bound to the server
|
||||||
|
func (cli *Client) HTTPClient() *http.Client {
|
||||||
|
return &*cli.client
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseHostURL parses a url string, validates the string is a host url, and
|
||||||
|
// returns the parsed URL
|
||||||
|
func ParseHostURL(host string) (*url.URL, error) {
|
||||||
protoAddrParts := strings.SplitN(host, "://", 2)
|
protoAddrParts := strings.SplitN(host, "://", 2)
|
||||||
if len(protoAddrParts) == 1 {
|
if len(protoAddrParts) == 1 {
|
||||||
return "", "", "", fmt.Errorf("unable to parse docker host `%s`", host)
|
return nil, fmt.Errorf("unable to parse docker host `%s`", host)
|
||||||
}
|
}
|
||||||
|
|
||||||
var basePath string
|
var basePath string
|
||||||
@ -237,10 +268,42 @@ func ParseHost(host string) (string, string, string, error) {
|
|||||||
if proto == "tcp" {
|
if proto == "tcp" {
|
||||||
parsed, err := url.Parse("tcp://" + addr)
|
parsed, err := url.Parse("tcp://" + addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
addr = parsed.Host
|
addr = parsed.Host
|
||||||
basePath = parsed.Path
|
basePath = parsed.Path
|
||||||
}
|
}
|
||||||
return proto, addr, basePath, nil
|
return &url.URL{
|
||||||
|
Scheme: proto,
|
||||||
|
Host: addr,
|
||||||
|
Path: basePath,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// CustomHTTPHeaders returns the custom http headers stored by the client.
|
||||||
|
func (cli *Client) CustomHTTPHeaders() map[string]string {
|
||||||
|
m := make(map[string]string)
|
||||||
|
for k, v := range cli.customHTTPHeaders {
|
||||||
|
m[k] = v
|
||||||
|
}
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCustomHTTPHeaders that will be set on every HTTP request made by the client.
|
||||||
|
// Deprecated: use WithHTTPHeaders when creating the client.
|
||||||
|
func (cli *Client) SetCustomHTTPHeaders(headers map[string]string) {
|
||||||
|
cli.customHTTPHeaders = headers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dialer returns a dialer for a raw stream connection, with HTTP/1.1 header, that can be used for proxying the daemon connection.
|
||||||
|
// Used by `docker dial-stdio` (docker/cli#889).
|
||||||
|
func (cli *Client) Dialer() func(context.Context) (net.Conn, error) {
|
||||||
|
return func(ctx context.Context) (net.Conn, error) {
|
||||||
|
if transport, ok := cli.client.Transport.(*http.Transport); ok {
|
||||||
|
if transport.DialContext != nil && transport.TLSClientConfig == nil {
|
||||||
|
return transport.DialContext(ctx, cli.proto, cli.addr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fallbackDial(cli.proto, cli.addr, resolveTLSConfig(cli.client.Transport))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
23
vendor/github.com/docker/docker/client/client_deprecated.go
generated
vendored
Normal file
23
vendor/github.com/docker/docker/client/client_deprecated.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
// NewClient initializes a new API client for the given host and API version.
|
||||||
|
// It uses the given http client as transport.
|
||||||
|
// It also initializes the custom http headers to add to each request.
|
||||||
|
//
|
||||||
|
// It won't send any version information if the version number is empty. It is
|
||||||
|
// highly recommended that you set a version or your client may break if the
|
||||||
|
// server is upgraded.
|
||||||
|
// Deprecated: use NewClientWithOpts
|
||||||
|
func NewClient(host string, version string, client *http.Client, httpHeaders map[string]string) (*Client, error) {
|
||||||
|
return NewClientWithOpts(WithHost(host), WithVersion(version), WithHTTPClient(client), WithHTTPHeaders(httpHeaders))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewEnvClient initializes a new API client based on environment variables.
|
||||||
|
// See FromEnv for a list of support environment variables.
|
||||||
|
//
|
||||||
|
// Deprecated: use NewClientWithOpts(FromEnv)
|
||||||
|
func NewEnvClient() (*Client, error) {
|
||||||
|
return NewClientWithOpts(FromEnv)
|
||||||
|
}
|
7
vendor/github.com/docker/docker/client/client_unix.go
generated
vendored
7
vendor/github.com/docker/docker/client/client_unix.go
generated
vendored
@ -1,6 +1,9 @@
|
|||||||
// +build linux freebsd solaris openbsd darwin
|
// +build linux freebsd openbsd darwin
|
||||||
|
|
||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
// DefaultDockerHost defines os specific default if DOCKER_HOST is unset
|
// DefaultDockerHost defines os specific default if DOCKER_HOST is unset
|
||||||
const DefaultDockerHost = "unix:///var/run/docker.sock"
|
const DefaultDockerHost = "unix:///var/run/docker.sock"
|
||||||
|
|
||||||
|
const defaultProto = "unix"
|
||||||
|
const defaultAddr = "/var/run/docker.sock"
|
||||||
|
5
vendor/github.com/docker/docker/client/client_windows.go
generated
vendored
5
vendor/github.com/docker/docker/client/client_windows.go
generated
vendored
@ -1,4 +1,7 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
// DefaultDockerHost defines os specific default if DOCKER_HOST is unset
|
// DefaultDockerHost defines os specific default if DOCKER_HOST is unset
|
||||||
const DefaultDockerHost = "npipe:////./pipe/docker_engine"
|
const DefaultDockerHost = "npipe:////./pipe/docker_engine"
|
||||||
|
|
||||||
|
const defaultProto = "npipe"
|
||||||
|
const defaultAddr = "//./pipe/docker_engine"
|
||||||
|
25
vendor/github.com/docker/docker/client/config_create.go
generated
vendored
Normal file
25
vendor/github.com/docker/docker/client/config_create.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ConfigCreate creates a new Config.
|
||||||
|
func (cli *Client) ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
|
||||||
|
var response types.ConfigCreateResponse
|
||||||
|
if err := cli.NewVersionError("1.30", "config create"); err != nil {
|
||||||
|
return response, err
|
||||||
|
}
|
||||||
|
resp, err := cli.post(ctx, "/configs/create", nil, config, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
|
if err != nil {
|
||||||
|
return response, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.NewDecoder(resp.body).Decode(&response)
|
||||||
|
return response, err
|
||||||
|
}
|
36
vendor/github.com/docker/docker/client/config_inspect.go
generated
vendored
Normal file
36
vendor/github.com/docker/docker/client/config_inspect.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ConfigInspectWithRaw returns the config information with raw data
|
||||||
|
func (cli *Client) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error) {
|
||||||
|
if id == "" {
|
||||||
|
return swarm.Config{}, nil, objectNotFoundError{object: "config", id: id}
|
||||||
|
}
|
||||||
|
if err := cli.NewVersionError("1.30", "config inspect"); err != nil {
|
||||||
|
return swarm.Config{}, nil, err
|
||||||
|
}
|
||||||
|
resp, err := cli.get(ctx, "/configs/"+id, nil, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
|
if err != nil {
|
||||||
|
return swarm.Config{}, nil, wrapResponseError(err, resp, "config", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
body, err := ioutil.ReadAll(resp.body)
|
||||||
|
if err != nil {
|
||||||
|
return swarm.Config{}, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var config swarm.Config
|
||||||
|
rdr := bytes.NewReader(body)
|
||||||
|
err = json.NewDecoder(rdr).Decode(&config)
|
||||||
|
|
||||||
|
return config, body, err
|
||||||
|
}
|
38
vendor/github.com/docker/docker/client/config_list.go
generated
vendored
Normal file
38
vendor/github.com/docker/docker/client/config_list.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ConfigList returns the list of configs.
|
||||||
|
func (cli *Client) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
|
||||||
|
if err := cli.NewVersionError("1.30", "config list"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
query := url.Values{}
|
||||||
|
|
||||||
|
if options.Filters.Len() > 0 {
|
||||||
|
filterJSON, err := filters.ToJSON(options.Filters)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
query.Set("filters", filterJSON)
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := cli.get(ctx, "/configs", query, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var configs []swarm.Config
|
||||||
|
err = json.NewDecoder(resp.body).Decode(&configs)
|
||||||
|
return configs, err
|
||||||
|
}
|
13
vendor/github.com/docker/docker/client/config_remove.go
generated
vendored
Normal file
13
vendor/github.com/docker/docker/client/config_remove.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import "context"
|
||||||
|
|
||||||
|
// ConfigRemove removes a Config.
|
||||||
|
func (cli *Client) ConfigRemove(ctx context.Context, id string) error {
|
||||||
|
if err := cli.NewVersionError("1.30", "config remove"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
resp, err := cli.delete(ctx, "/configs/"+id, nil, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
|
return wrapResponseError(err, resp, "config", id)
|
||||||
|
}
|
21
vendor/github.com/docker/docker/client/config_update.go
generated
vendored
Normal file
21
vendor/github.com/docker/docker/client/config_update.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ConfigUpdate attempts to update a Config
|
||||||
|
func (cli *Client) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error {
|
||||||
|
if err := cli.NewVersionError("1.30", "config update"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
query := url.Values{}
|
||||||
|
query.Set("version", strconv.FormatUint(version.Index, 10))
|
||||||
|
resp, err := cli.post(ctx, "/configs/"+id+"/update", query, config, nil)
|
||||||
|
ensureReaderClosed(resp)
|
||||||
|
return err
|
||||||
|
}
|
24
vendor/github.com/docker/docker/client/container_attach.go
generated
vendored
24
vendor/github.com/docker/docker/client/container_attach.go
generated
vendored
@ -1,16 +1,36 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerAttach attaches a connection to a container in the server.
|
// ContainerAttach attaches a connection to a container in the server.
|
||||||
// It returns a types.HijackedConnection with the hijacked connection
|
// It returns a types.HijackedConnection with the hijacked connection
|
||||||
// and the a reader to get output. It's up to the called to close
|
// and the a reader to get output. It's up to the called to close
|
||||||
// the hijacked connection by calling types.HijackedResponse.Close.
|
// the hijacked connection by calling types.HijackedResponse.Close.
|
||||||
|
//
|
||||||
|
// The stream format on the response will be in one of two formats:
|
||||||
|
//
|
||||||
|
// If the container is using a TTY, there is only a single stream (stdout), and
|
||||||
|
// data is copied directly from the container output stream, no extra
|
||||||
|
// multiplexing or headers.
|
||||||
|
//
|
||||||
|
// If the container is *not* using a TTY, streams for stdout and stderr are
|
||||||
|
// multiplexed.
|
||||||
|
// The format of the multiplexed stream is as follows:
|
||||||
|
//
|
||||||
|
// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
||||||
|
//
|
||||||
|
// STREAM_TYPE can be 1 for stdout and 2 for stderr
|
||||||
|
//
|
||||||
|
// SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian.
|
||||||
|
// This is the size of OUTPUT.
|
||||||
|
//
|
||||||
|
// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
|
||||||
|
// stream.
|
||||||
func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) {
|
func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if options.Stream {
|
if options.Stream {
|
||||||
|
22
vendor/github.com/docker/docker/client/container_commit.go
generated
vendored
22
vendor/github.com/docker/docker/client/container_commit.go
generated
vendored
@ -1,31 +1,33 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
distreference "github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/reference"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerCommit applies changes into a container and creates a new tagged image.
|
// ContainerCommit applies changes into a container and creates a new tagged image.
|
||||||
func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
|
func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
|
||||||
var repository, tag string
|
var repository, tag string
|
||||||
if options.Reference != "" {
|
if options.Reference != "" {
|
||||||
distributionRef, err := distreference.ParseNamed(options.Reference)
|
ref, err := reference.ParseNormalizedNamed(options.Reference)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.IDResponse{}, err
|
return types.IDResponse{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, isCanonical := distributionRef.(distreference.Canonical); isCanonical {
|
if _, isCanonical := ref.(reference.Canonical); isCanonical {
|
||||||
return types.IDResponse{}, errors.New("refusing to create a tag with a digest reference")
|
return types.IDResponse{}, errors.New("refusing to create a tag with a digest reference")
|
||||||
}
|
}
|
||||||
|
ref = reference.TagNameOnly(ref)
|
||||||
|
|
||||||
tag = reference.GetTagFromNamedRef(distributionRef)
|
if tagged, ok := ref.(reference.Tagged); ok {
|
||||||
repository = distributionRef.Name()
|
tag = tagged.Tag()
|
||||||
|
}
|
||||||
|
repository = reference.FamiliarName(ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
@ -37,17 +39,17 @@ func (cli *Client) ContainerCommit(ctx context.Context, container string, option
|
|||||||
for _, change := range options.Changes {
|
for _, change := range options.Changes {
|
||||||
query.Add("changes", change)
|
query.Add("changes", change)
|
||||||
}
|
}
|
||||||
if options.Pause != true {
|
if !options.Pause {
|
||||||
query.Set("pause", "0")
|
query.Set("pause", "0")
|
||||||
}
|
}
|
||||||
|
|
||||||
var response types.IDResponse
|
var response types.IDResponse
|
||||||
resp, err := cli.post(ctx, "/commit", query, options.Config, nil)
|
resp, err := cli.post(ctx, "/commit", query, options.Config, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(resp.body).Decode(&response)
|
err = json.NewDecoder(resp.body).Decode(&response)
|
||||||
ensureReaderClosed(resp)
|
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
40
vendor/github.com/docker/docker/client/container_copy.go
generated
vendored
40
vendor/github.com/docker/docker/client/container_copy.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -10,8 +11,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,32 +19,38 @@ func (cli *Client) ContainerStatPath(ctx context.Context, containerID, path stri
|
|||||||
query := url.Values{}
|
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 := "/containers/" + containerID + "/archive"
|
||||||
response, err := cli.head(ctx, urlStr, query, nil)
|
response, err := cli.head(ctx, urlStr, query, nil)
|
||||||
if err != nil {
|
|
||||||
return types.ContainerPathStat{}, err
|
|
||||||
}
|
|
||||||
defer ensureReaderClosed(response)
|
defer ensureReaderClosed(response)
|
||||||
|
if err != nil {
|
||||||
|
return types.ContainerPathStat{}, wrapResponseError(err, response, "container:path", containerID+":"+path)
|
||||||
|
}
|
||||||
return getContainerPathStatFromHeader(response.header)
|
return getContainerPathStatFromHeader(response.header)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyToContainer copies content into the container filesystem.
|
// CopyToContainer copies content into the container filesystem.
|
||||||
func (cli *Client) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error {
|
// Note that `content` must be a Reader for a TAR archive
|
||||||
|
func (cli *Client) CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader, options types.CopyToContainerOptions) error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
|
query.Set("path", filepath.ToSlash(dstPath)) // 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 {
|
||||||
query.Set("noOverwriteDirNonDir", "true")
|
query.Set("noOverwriteDirNonDir", "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
apiPath := fmt.Sprintf("/containers/%s/archive", container)
|
if options.CopyUIDGID {
|
||||||
|
query.Set("copyUIDGID", "true")
|
||||||
|
}
|
||||||
|
|
||||||
|
apiPath := "/containers/" + containerID + "/archive"
|
||||||
|
|
||||||
response, err := cli.putRaw(ctx, apiPath, query, content, nil)
|
response, err := cli.putRaw(ctx, apiPath, query, content, nil)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer ensureReaderClosed(response)
|
defer ensureReaderClosed(response)
|
||||||
|
if err != nil {
|
||||||
|
return wrapResponseError(err, response, "container:path", containerID+":"+dstPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO this code converts non-error status-codes (e.g., "204 No Content") into an error; verify if this is the desired behavior
|
||||||
if response.statusCode != http.StatusOK {
|
if response.statusCode != http.StatusOK {
|
||||||
return fmt.Errorf("unexpected status code from daemon: %d", response.statusCode)
|
return fmt.Errorf("unexpected status code from daemon: %d", response.statusCode)
|
||||||
}
|
}
|
||||||
@ -54,17 +59,18 @@ func (cli *Client) CopyToContainer(ctx context.Context, container, path string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CopyFromContainer gets the content from the container and returns it as a Reader
|
// CopyFromContainer gets the content from the container and returns it as a Reader
|
||||||
// to manipulate it in the host. It's up to the caller to close the reader.
|
// for a TAR archive to manipulate it in the host. It's up to the caller to close the reader.
|
||||||
func (cli *Client) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) {
|
func (cli *Client) CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) {
|
||||||
query := make(url.Values, 1)
|
query := make(url.Values, 1)
|
||||||
query.Set("path", filepath.ToSlash(srcPath)) // Normalize the paths used in the API.
|
query.Set("path", filepath.ToSlash(srcPath)) // Normalize the paths used in the API.
|
||||||
|
|
||||||
apiPath := fmt.Sprintf("/containers/%s/archive", container)
|
apiPath := "/containers/" + containerID + "/archive"
|
||||||
response, err := cli.get(ctx, apiPath, query, nil)
|
response, err := cli.get(ctx, apiPath, query, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, types.ContainerPathStat{}, err
|
return nil, types.ContainerPathStat{}, wrapResponseError(err, response, "container:path", containerID+":"+srcPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO this code converts non-error status-codes (e.g., "204 No Content") into an error; verify if this is the desired behavior
|
||||||
if response.statusCode != http.StatusOK {
|
if response.statusCode != http.StatusOK {
|
||||||
return nil, types.ContainerPathStat{}, fmt.Errorf("unexpected status code from daemon: %d", response.statusCode)
|
return nil, types.ContainerPathStat{}, fmt.Errorf("unexpected status code from daemon: %d", response.statusCode)
|
||||||
}
|
}
|
||||||
|
16
vendor/github.com/docker/docker/client/container_create.go
generated
vendored
16
vendor/github.com/docker/docker/client/container_create.go
generated
vendored
@ -1,13 +1,13 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"golang.org/x/net/context"
|
"github.com/docker/docker/api/types/versions"
|
||||||
)
|
)
|
||||||
|
|
||||||
type configWrapper struct {
|
type configWrapper struct {
|
||||||
@ -25,6 +25,11 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
|
|||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When using API 1.24 and under, the client is responsible for removing the container
|
||||||
|
if hostConfig != nil && versions.LessThan(cli.ClientVersion(), "1.25") {
|
||||||
|
hostConfig.AutoRemove = false
|
||||||
|
}
|
||||||
|
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if containerName != "" {
|
if containerName != "" {
|
||||||
query.Set("name", containerName)
|
query.Set("name", containerName)
|
||||||
@ -37,14 +42,11 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
serverResp, err := cli.post(ctx, "/containers/create", query, body, nil)
|
serverResp, err := cli.post(ctx, "/containers/create", query, body, nil)
|
||||||
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if serverResp.statusCode == 404 && strings.Contains(err.Error(), "No such image") {
|
|
||||||
return response, imageNotFoundError{config.Image}
|
|
||||||
}
|
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(serverResp.body).Decode(&response)
|
err = json.NewDecoder(serverResp.body).Decode(&response)
|
||||||
ensureReaderClosed(serverResp)
|
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
12
vendor/github.com/docker/docker/client/container_diff.go
generated
vendored
12
vendor/github.com/docker/docker/client/container_diff.go
generated
vendored
@ -1,23 +1,23 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/container"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerDiff shows differences in a container filesystem since it was started.
|
// ContainerDiff shows differences in a container filesystem since it was started.
|
||||||
func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]types.ContainerChange, error) {
|
func (cli *Client) ContainerDiff(ctx context.Context, containerID string) ([]container.ContainerChangeResponseItem, error) {
|
||||||
var changes []types.ContainerChange
|
var changes []container.ContainerChangeResponseItem
|
||||||
|
|
||||||
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil)
|
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/changes", url.Values{}, nil)
|
||||||
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return changes, err
|
return changes, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.NewDecoder(serverResp.body).Decode(&changes)
|
err = json.NewDecoder(serverResp.body).Decode(&changes)
|
||||||
ensureReaderClosed(serverResp)
|
|
||||||
return changes, err
|
return changes, err
|
||||||
}
|
}
|
||||||
|
8
vendor/github.com/docker/docker/client/container_exec.go
generated
vendored
8
vendor/github.com/docker/docker/client/container_exec.go
generated
vendored
@ -1,10 +1,10 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerExecCreate creates a new exec configuration to run an exec process.
|
// ContainerExecCreate creates a new exec configuration to run an exec process.
|
||||||
@ -16,11 +16,11 @@ func (cli *Client) ContainerExecCreate(ctx context.Context, container string, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.post(ctx, "/containers/"+container+"/exec", nil, config, nil)
|
resp, err := cli.post(ctx, "/containers/"+container+"/exec", nil, config, nil)
|
||||||
|
defer ensureReaderClosed(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
err = json.NewDecoder(resp.body).Decode(&response)
|
err = json.NewDecoder(resp.body).Decode(&response)
|
||||||
ensureReaderClosed(resp)
|
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config
|
|||||||
// It returns a types.HijackedConnection with the hijacked connection
|
// It returns a types.HijackedConnection with the hijacked connection
|
||||||
// and the a reader to get output. It's up to the called to close
|
// and the a reader to get output. It's up to the called to close
|
||||||
// the hijacked connection by calling types.HijackedResponse.Close.
|
// the hijacked connection by calling types.HijackedResponse.Close.
|
||||||
func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) {
|
func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) {
|
||||||
headers := map[string][]string{"Content-Type": {"application/json"}}
|
headers := map[string][]string{"Content-Type": {"application/json"}}
|
||||||
return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers)
|
return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers)
|
||||||
}
|
}
|
||||||
|
5
vendor/github.com/docker/docker/client/container_export.go
generated
vendored
5
vendor/github.com/docker/docker/client/container_export.go
generated
vendored
@ -1,10 +1,9 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerExport retrieves the raw contents of a container
|
// ContainerExport retrieves the raw contents of a container
|
||||||
|
27
vendor/github.com/docker/docker/client/container_inspect.go
generated
vendored
27
vendor/github.com/docker/docker/client/container_inspect.go
generated
vendored
@ -1,46 +1,45 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerInspect returns the container information.
|
// ContainerInspect returns the container information.
|
||||||
func (cli *Client) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) {
|
func (cli *Client) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) {
|
||||||
|
if containerID == "" {
|
||||||
|
return types.ContainerJSON{}, objectNotFoundError{object: "container", id: containerID}
|
||||||
|
}
|
||||||
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", nil, nil)
|
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", nil, nil)
|
||||||
|
defer ensureReaderClosed(serverResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if serverResp.statusCode == http.StatusNotFound {
|
return types.ContainerJSON{}, wrapResponseError(err, serverResp, "container", containerID)
|
||||||
return types.ContainerJSON{}, containerNotFoundError{containerID}
|
|
||||||
}
|
|
||||||
return types.ContainerJSON{}, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var response types.ContainerJSON
|
var response types.ContainerJSON
|
||||||
err = json.NewDecoder(serverResp.body).Decode(&response)
|
err = json.NewDecoder(serverResp.body).Decode(&response)
|
||||||
ensureReaderClosed(serverResp)
|
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerInspectWithRaw returns the container information and its raw representation.
|
// ContainerInspectWithRaw returns the container information and its raw representation.
|
||||||
func (cli *Client) ContainerInspectWithRaw(ctx context.Context, containerID string, getSize bool) (types.ContainerJSON, []byte, error) {
|
func (cli *Client) ContainerInspectWithRaw(ctx context.Context, containerID string, getSize bool) (types.ContainerJSON, []byte, error) {
|
||||||
|
if containerID == "" {
|
||||||
|
return types.ContainerJSON{}, nil, objectNotFoundError{object: "container", id: containerID}
|
||||||
|
}
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
if getSize {
|
if getSize {
|
||||||
query.Set("size", "1")
|
query.Set("size", "1")
|
||||||
}
|
}
|
||||||
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", query, nil)
|
serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", query, nil)
|
||||||
if err != nil {
|
|
||||||
if serverResp.statusCode == http.StatusNotFound {
|
|
||||||
return types.ContainerJSON{}, nil, containerNotFoundError{containerID}
|
|
||||||
}
|
|
||||||
return types.ContainerJSON{}, nil, err
|
|
||||||
}
|
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
|
if err != nil {
|
||||||
|
return types.ContainerJSON{}, nil, wrapResponseError(err, serverResp, "container", containerID)
|
||||||
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(serverResp.body)
|
body, err := ioutil.ReadAll(serverResp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
5
vendor/github.com/docker/docker/client/container_kill.go
generated
vendored
5
vendor/github.com/docker/docker/client/container_kill.go
generated
vendored
@ -1,9 +1,8 @@
|
|||||||
package client
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user