This is a follow-up to 1abc8f6158aa1f27b0270df772b498618f19abbb, which
moved the ContainerJSONBase to api/types/container, but also renamed it
to container.InspectBase. This field is embedded into the InspectResponse
type, which meant that renaming the type also implicitly renamed the
field when creating this type from a struct-literal.
While we're planning to merge these types (which would be a breaking
change for users constructing it through struct-literals), let's keep
it backward-compatible for now (other than deprecating the old names).
We can continue the other changes separately.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -91,7 +91,7 @@ type MountPoint struct {
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 | 93 |
// State stores container's running state |
| 94 |
-// it's part of InspectBase and returned by "inspect" command |
|
| 94 |
+// it's part of ContainerJSONBase and returned by "inspect" command |
|
| 95 | 95 |
type State struct {
|
| 96 | 96 |
Status string // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead" |
| 97 | 97 |
Running bool |
| ... | ... |
@@ -130,16 +130,16 @@ type Summary struct {
|
| 130 | 130 |
Mounts []MountPoint |
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 |
-// InspectBase contains response of Engine API GET "/containers/{name:.*}/json"
|
|
| 133 |
+// ContainerJSONBase contains response of Engine API GET "/containers/{name:.*}/json"
|
|
| 134 | 134 |
// for API version 1.18 and older. |
| 135 | 135 |
// |
| 136 |
-// TODO(thaJeztah): combine InspectBase and InspectResponse into a single struct. |
|
| 137 |
-// The split between InspectBase (ContainerJSONBase) and InspectResponse (InspectResponse) |
|
| 136 |
+// TODO(thaJeztah): combine ContainerJSONBase and InspectResponse into a single struct. |
|
| 137 |
+// The split between ContainerJSONBase (ContainerJSONBase) and InspectResponse (InspectResponse) |
|
| 138 | 138 |
// was done in commit 6deaa58ba5f051039643cedceee97c8695e2af74 (https://github.com/moby/moby/pull/13675). |
| 139 | 139 |
// ContainerJSONBase contained all fields for API < 1.19, and InspectResponse |
| 140 | 140 |
// held fields that were added in API 1.19 and up. Given that the minimum |
| 141 | 141 |
// supported API version is now 1.24, we no longer use the separate type. |
| 142 |
-type InspectBase struct {
|
|
| 142 |
+type ContainerJSONBase struct {
|
|
| 143 | 143 |
ID string `json:"Id"` |
| 144 | 144 |
Created string |
| 145 | 145 |
Path string |
| ... | ... |
@@ -167,7 +167,7 @@ type InspectBase struct {
|
| 167 | 167 |
// InspectResponse is the response for the GET "/containers/{name:.*}/json"
|
| 168 | 168 |
// endpoint. |
| 169 | 169 |
type InspectResponse struct {
|
| 170 |
- *InspectBase |
|
| 170 |
+ *ContainerJSONBase |
|
| 171 | 171 |
Mounts []MountPoint |
| 172 | 172 |
Config *Config |
| 173 | 173 |
NetworkSettings *NetworkSettings |
| ... | ... |
@@ -9,8 +9,8 @@ import ( |
| 9 | 9 |
// ContainerJSONBase contains response of Engine API GET "/containers/{name:.*}/json"
|
| 10 | 10 |
// for API version 1.18 and older. |
| 11 | 11 |
// |
| 12 |
-// Deprecated: use [container.InspectResponse] or [container.InspectBase]. It will be removed in the next release. |
|
| 13 |
-type ContainerJSONBase = container.InspectBase |
|
| 12 |
+// Deprecated: use [container.InspectResponse] or [container.ContainerJSONBase]. It will be removed in the next release. |
|
| 13 |
+type ContainerJSONBase = container.ContainerJSONBase |
|
| 14 | 14 |
|
| 15 | 15 |
// ContainerJSON is the response for the GET "/containers/{name:.*}/json"
|
| 16 | 16 |
// endpoint. |
| ... | ... |
@@ -53,7 +53,7 @@ func TestContainerInspect(t *testing.T) {
|
| 53 | 53 |
return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL)
|
| 54 | 54 |
} |
| 55 | 55 |
content, err := json.Marshal(container.InspectResponse{
|
| 56 |
- InspectBase: &container.InspectBase{
|
|
| 56 |
+ ContainerJSONBase: &container.ContainerJSONBase{
|
|
| 57 | 57 |
ID: "container_id", |
| 58 | 58 |
Image: "image", |
| 59 | 59 |
Name: "name", |
| ... | ... |
@@ -104,14 +104,14 @@ func (daemon *Daemon) ContainerInspectCurrent(ctx context.Context, name string, |
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
return &containertypes.InspectResponse{
|
| 107 |
- InspectBase: base, |
|
| 108 |
- Mounts: mountPoints, |
|
| 109 |
- Config: ctr.Config, |
|
| 110 |
- NetworkSettings: networkSettings, |
|
| 107 |
+ ContainerJSONBase: base, |
|
| 108 |
+ Mounts: mountPoints, |
|
| 109 |
+ Config: ctr.Config, |
|
| 110 |
+ NetworkSettings: networkSettings, |
|
| 111 | 111 |
}, nil |
| 112 | 112 |
} |
| 113 | 113 |
|
| 114 |
-func (daemon *Daemon) getInspectData(daemonCfg *config.Config, container *container.Container) (*containertypes.InspectBase, error) {
|
|
| 114 |
+func (daemon *Daemon) getInspectData(daemonCfg *config.Config, container *container.Container) (*containertypes.ContainerJSONBase, error) {
|
|
| 115 | 115 |
// make a copy to play with |
| 116 | 116 |
hostConfig := *container.HostConfig |
| 117 | 117 |
|
| ... | ... |
@@ -160,7 +160,7 @@ func (daemon *Daemon) getInspectData(daemonCfg *config.Config, container *contai |
| 160 | 160 |
Health: containerHealth, |
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 |
- contJSONBase := &containertypes.InspectBase{
|
|
| 163 |
+ contJSONBase := &containertypes.ContainerJSONBase{
|
|
| 164 | 164 |
ID: container.ID, |
| 165 | 165 |
Created: container.Created.Format(time.RFC3339Nano), |
| 166 | 166 |
Path: container.Path, |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
) |
| 8 | 8 |
|
| 9 | 9 |
// This sets platform-specific fields |
| 10 |
-func setPlatformSpecificContainerFields(container *containerpkg.Container, contJSONBase *container.InspectBase) *container.InspectBase {
|
|
| 10 |
+func setPlatformSpecificContainerFields(container *containerpkg.Container, contJSONBase *container.ContainerJSONBase) *container.ContainerJSONBase {
|
|
| 11 | 11 |
contJSONBase.AppArmorProfile = container.AppArmorProfile |
| 12 | 12 |
contJSONBase.ResolvConfPath = container.ResolvConfPath |
| 13 | 13 |
contJSONBase.HostnamePath = container.HostnamePath |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
) |
| 8 | 8 |
|
| 9 | 9 |
// This sets platform-specific fields |
| 10 |
-func setPlatformSpecificContainerFields(container *containerpkg.Container, contJSONBase *container.InspectBase) *container.InspectBase {
|
|
| 10 |
+func setPlatformSpecificContainerFields(container *containerpkg.Container, contJSONBase *container.ContainerJSONBase) *container.ContainerJSONBase {
|
|
| 11 | 11 |
return contJSONBase |
| 12 | 12 |
} |
| 13 | 13 |
|