This fix updates engine-api to 6facb3f3c38717b8f618dcedc4c8ce20d1bfc61e.
This fix is related to #23090.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -60,7 +60,7 @@ clone git golang.org/x/net 78cb2c067747f08b343f20614155233ab4ea2ad3 https://gith |
| 60 | 60 |
clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git |
| 61 | 61 |
clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 |
| 62 | 62 |
clone git github.com/docker/go-connections v0.2.0 |
| 63 |
-clone git github.com/docker/engine-api 12fbeb3ac3ca5dc5d0f01d6bac9bda518d46d983 |
|
| 63 |
+clone git github.com/docker/engine-api 6facb3f3c38717b8f618dcedc4c8ce20d1bfc61e |
|
| 64 | 64 |
clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 |
| 65 | 65 |
clone git github.com/imdario/mergo 0.2.1 |
| 66 | 66 |
|
| ... | ... |
@@ -8,12 +8,11 @@ import ( |
| 8 | 8 |
"golang.org/x/net/context" |
| 9 | 9 |
|
| 10 | 10 |
distreference "github.com/docker/distribution/reference" |
| 11 |
- "github.com/docker/engine-api/types" |
|
| 12 | 11 |
"github.com/docker/engine-api/types/reference" |
| 13 | 12 |
) |
| 14 | 13 |
|
| 15 | 14 |
// ImageTag tags an image in the docker host |
| 16 |
-func (cli *Client) ImageTag(ctx context.Context, imageID, ref string, options types.ImageTagOptions) error {
|
|
| 15 |
+func (cli *Client) ImageTag(ctx context.Context, imageID, ref string) error {
|
|
| 17 | 16 |
distributionRef, err := distreference.ParseNamed(ref) |
| 18 | 17 |
if err != nil {
|
| 19 | 18 |
return fmt.Errorf("Error parsing reference: %q is not a valid repository/tag", ref)
|
| ... | ... |
@@ -28,9 +27,6 @@ func (cli *Client) ImageTag(ctx context.Context, imageID, ref string, options ty |
| 28 | 28 |
query := url.Values{}
|
| 29 | 29 |
query.Set("repo", distributionRef.Name())
|
| 30 | 30 |
query.Set("tag", tag)
|
| 31 |
- if options.Force {
|
|
| 32 |
- query.Set("force", "1")
|
|
| 33 |
- } |
|
| 34 | 31 |
|
| 35 | 32 |
resp, err := cli.post(ctx, "/images/"+imageID+"/tag", query, nil, nil) |
| 36 | 33 |
ensureReaderClosed(resp) |
| ... | ... |
@@ -61,12 +61,13 @@ type APIClient interface {
|
| 61 | 61 |
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDelete, error) |
| 62 | 62 |
ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) |
| 63 | 63 |
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) |
| 64 |
- ImageTag(ctx context.Context, image, ref string, options types.ImageTagOptions) error |
|
| 64 |
+ ImageTag(ctx context.Context, image, ref string) error |
|
| 65 | 65 |
Info(ctx context.Context) (types.Info, error) |
| 66 | 66 |
NetworkConnect(ctx context.Context, networkID, container string, config *network.EndpointSettings) error |
| 67 | 67 |
NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) |
| 68 | 68 |
NetworkDisconnect(ctx context.Context, networkID, container string, force bool) error |
| 69 | 69 |
NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error) |
| 70 |
+ NetworkInspectWithRaw(ctx context.Context, networkID string) (types.NetworkResource, []byte, error) |
|
| 70 | 71 |
NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) |
| 71 | 72 |
NetworkRemove(ctx context.Context, networkID string) error |
| 72 | 73 |
RegistryLogin(ctx context.Context, auth types.AuthConfig) (types.AuthResponse, error) |
| ... | ... |
@@ -74,6 +75,7 @@ type APIClient interface {
|
| 74 | 74 |
UpdateClientVersion(v string) |
| 75 | 75 |
VolumeCreate(ctx context.Context, options types.VolumeCreateRequest) (types.Volume, error) |
| 76 | 76 |
VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) |
| 77 |
+ VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) |
|
| 77 | 78 |
VolumeList(ctx context.Context, filter filters.Args) (types.VolumesListResponse, error) |
| 78 | 79 |
VolumeRemove(ctx context.Context, volumeID string) error |
| 79 | 80 |
} |
| ... | ... |
@@ -1,7 +1,9 @@ |
| 1 | 1 |
package client |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "bytes" |
|
| 4 | 5 |
"encoding/json" |
| 6 |
+ "io/ioutil" |
|
| 5 | 7 |
"net/http" |
| 6 | 8 |
|
| 7 | 9 |
"github.com/docker/engine-api/types" |
| ... | ... |
@@ -10,15 +12,27 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
// NetworkInspect returns the information for a specific network configured in the docker host. |
| 12 | 12 |
func (cli *Client) NetworkInspect(ctx context.Context, networkID string) (types.NetworkResource, error) {
|
| 13 |
+ networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID) |
|
| 14 |
+ return networkResource, err |
|
| 15 |
+} |
|
| 16 |
+ |
|
| 17 |
+// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and it's raw representation. |
|
| 18 |
+func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string) (types.NetworkResource, []byte, error) {
|
|
| 13 | 19 |
var networkResource types.NetworkResource |
| 14 | 20 |
resp, err := cli.get(ctx, "/networks/"+networkID, nil, nil) |
| 15 | 21 |
if err != nil {
|
| 16 | 22 |
if resp.statusCode == http.StatusNotFound {
|
| 17 |
- return networkResource, networkNotFoundError{networkID}
|
|
| 23 |
+ return networkResource, nil, networkNotFoundError{networkID}
|
|
| 18 | 24 |
} |
| 19 |
- return networkResource, err |
|
| 25 |
+ return networkResource, nil, err |
|
| 20 | 26 |
} |
| 21 |
- err = json.NewDecoder(resp.body).Decode(&networkResource) |
|
| 22 |
- ensureReaderClosed(resp) |
|
| 23 |
- return networkResource, err |
|
| 27 |
+ defer ensureReaderClosed(resp) |
|
| 28 |
+ |
|
| 29 |
+ body, err := ioutil.ReadAll(resp.body) |
|
| 30 |
+ if err != nil {
|
|
| 31 |
+ return networkResource, nil, err |
|
| 32 |
+ } |
|
| 33 |
+ rdr := bytes.NewReader(body) |
|
| 34 |
+ err = json.NewDecoder(rdr).Decode(&networkResource) |
|
| 35 |
+ return networkResource, body, err |
|
| 24 | 36 |
} |
| ... | ... |
@@ -1,7 +1,9 @@ |
| 1 | 1 |
package client |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "bytes" |
|
| 4 | 5 |
"encoding/json" |
| 6 |
+ "io/ioutil" |
|
| 5 | 7 |
"net/http" |
| 6 | 8 |
|
| 7 | 9 |
"github.com/docker/engine-api/types" |
| ... | ... |
@@ -10,15 +12,27 @@ import ( |
| 10 | 10 |
|
| 11 | 11 |
// VolumeInspect returns the information about a specific volume in the docker host. |
| 12 | 12 |
func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {
|
| 13 |
+ volume, _, err := cli.VolumeInspectWithRaw(ctx, volumeID) |
|
| 14 |
+ return volume, err |
|
| 15 |
+} |
|
| 16 |
+ |
|
| 17 |
+// VolumeInspectWithRaw returns the information about a specific volume in the docker host and it's raw representation |
|
| 18 |
+func (cli *Client) VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) {
|
|
| 13 | 19 |
var volume types.Volume |
| 14 | 20 |
resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil) |
| 15 | 21 |
if err != nil {
|
| 16 | 22 |
if resp.statusCode == http.StatusNotFound {
|
| 17 |
- return volume, volumeNotFoundError{volumeID}
|
|
| 23 |
+ return volume, nil, volumeNotFoundError{volumeID}
|
|
| 18 | 24 |
} |
| 19 |
- return volume, err |
|
| 25 |
+ return volume, nil, err |
|
| 20 | 26 |
} |
| 21 |
- err = json.NewDecoder(resp.body).Decode(&volume) |
|
| 22 |
- ensureReaderClosed(resp) |
|
| 23 |
- return volume, err |
|
| 27 |
+ defer ensureReaderClosed(resp) |
|
| 28 |
+ |
|
| 29 |
+ body, err := ioutil.ReadAll(resp.body) |
|
| 30 |
+ if err != nil {
|
|
| 31 |
+ return volume, nil, err |
|
| 32 |
+ } |
|
| 33 |
+ rdr := bytes.NewReader(body) |
|
| 34 |
+ err = json.NewDecoder(rdr).Decode(&volume) |
|
| 35 |
+ return volume, body, err |
|
| 24 | 36 |
} |
| ... | ... |
@@ -215,11 +215,6 @@ type ImageSearchOptions struct {
|
| 215 | 215 |
Filters filters.Args |
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 |
-// ImageTagOptions holds parameters to tag an image |
|
| 219 |
-type ImageTagOptions struct {
|
|
| 220 |
- Force bool |
|
| 221 |
-} |
|
| 222 |
- |
|
| 223 | 218 |
// ResizeOptions holds parameters to resize a tty. |
| 224 | 219 |
// It can be used to resize container ttys and |
| 225 | 220 |
// exec process ttys too. |
| ... | ... |
@@ -28,7 +28,7 @@ type ContainerExecCreateResponse struct {
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
// ContainerUpdateResponse contains response of Remote API: |
| 31 |
-// POST /containers/{name:.*}/update
|
|
| 31 |
+// POST "/containers/{name:.*}/update"
|
|
| 32 | 32 |
type ContainerUpdateResponse struct {
|
| 33 | 33 |
// Warnings are any warnings encountered during the updating of the container. |
| 34 | 34 |
Warnings []string `json:"Warnings"` |
| ... | ... |
@@ -142,7 +142,7 @@ type Port struct {
|
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 | 144 |
// Container contains response of Remote API: |
| 145 |
-// GET "/containers/json" |
|
| 145 |
+// GET "/containers/json" |
|
| 146 | 146 |
type Container struct {
|
| 147 | 147 |
ID string `json:"Id"` |
| 148 | 148 |
Names []string |
| ... | ... |
@@ -352,13 +352,13 @@ type SummaryNetworkSettings struct {
|
| 352 | 352 |
|
| 353 | 353 |
// NetworkSettingsBase holds basic information about networks |
| 354 | 354 |
type NetworkSettingsBase struct {
|
| 355 |
- Bridge string |
|
| 356 |
- SandboxID string |
|
| 357 |
- HairpinMode bool |
|
| 358 |
- LinkLocalIPv6Address string |
|
| 359 |
- LinkLocalIPv6PrefixLen int |
|
| 360 |
- Ports nat.PortMap |
|
| 361 |
- SandboxKey string |
|
| 355 |
+ Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`) |
|
| 356 |
+ SandboxID string // SandboxID uniquely represents a container's network stack |
|
| 357 |
+ HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface |
|
| 358 |
+ LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix |
|
| 359 |
+ LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address |
|
| 360 |
+ Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port |
|
| 361 |
+ SandboxKey string // SandboxKey identifies the sandbox |
|
| 362 | 362 |
SecondaryIPAddresses []network.Address |
| 363 | 363 |
SecondaryIPv6Addresses []network.Address |
| 364 | 364 |
} |
| ... | ... |
@@ -367,14 +367,14 @@ type NetworkSettingsBase struct {
|
| 367 | 367 |
// during the 2 release deprecation period. |
| 368 | 368 |
// It will be removed in Docker 1.11. |
| 369 | 369 |
type DefaultNetworkSettings struct {
|
| 370 |
- EndpointID string |
|
| 371 |
- Gateway string |
|
| 372 |
- GlobalIPv6Address string |
|
| 373 |
- GlobalIPv6PrefixLen int |
|
| 374 |
- IPAddress string |
|
| 375 |
- IPPrefixLen int |
|
| 376 |
- IPv6Gateway string |
|
| 377 |
- MacAddress string |
|
| 370 |
+ EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox |
|
| 371 |
+ Gateway string // Gateway holds the gateway address for the network |
|
| 372 |
+ GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address |
|
| 373 |
+ GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address |
|
| 374 |
+ IPAddress string // IPAddress holds the IPv4 address for the network |
|
| 375 |
+ IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address |
|
| 376 |
+ IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6 |
|
| 377 |
+ MacAddress string // MacAddress holds the MAC address for the network |
|
| 378 | 378 |
} |
| 379 | 379 |
|
| 380 | 380 |
// MountPoint represents a mount point configuration inside the container. |
| ... | ... |
@@ -416,16 +416,16 @@ type VolumeCreateRequest struct {
|
| 416 | 416 |
|
| 417 | 417 |
// NetworkResource is the body of the "get network" http response message |
| 418 | 418 |
type NetworkResource struct {
|
| 419 |
- Name string |
|
| 420 |
- ID string `json:"Id"` |
|
| 421 |
- Scope string |
|
| 422 |
- Driver string |
|
| 423 |
- EnableIPv6 bool |
|
| 424 |
- IPAM network.IPAM |
|
| 425 |
- Internal bool |
|
| 426 |
- Containers map[string]EndpointResource |
|
| 427 |
- Options map[string]string |
|
| 428 |
- Labels map[string]string |
|
| 419 |
+ Name string // Name is the requested name of the network |
|
| 420 |
+ ID string `json:"Id"` // ID uniquely indentifies a network on a single machine |
|
| 421 |
+ Scope string // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level) |
|
| 422 |
+ Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`) |
|
| 423 |
+ EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6 |
|
| 424 |
+ IPAM network.IPAM // IPAM is the network's IP Address Management |
|
| 425 |
+ Internal bool // Internal respresents if the network is used internal only |
|
| 426 |
+ Containers map[string]EndpointResource // Containers contains endpoints belonging to the network |
|
| 427 |
+ Options map[string]string // Options holds the network specific options to use for when creating the network |
|
| 428 |
+ Labels map[string]string // Labels holds metadata specific to the network being created |
|
| 429 | 429 |
} |
| 430 | 430 |
|
| 431 | 431 |
// EndpointResource contains network resources allocated and used for a container in a network |