api: remove / internalize LegacyDiskUsage

These fields have been removed from the API specification, and the struct
was only needed to produce legacy responses (server), or to unmarshal
legacy responses in the client.

As the API module only provides API definitions for the current API version,
we should remove these legacy structs, and keep them internal to the daemon
and client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-11-07 17:14:33 +01:00
parent 4dc87c55c7
commit ed428234bd
8 changed files with 104 additions and 87 deletions

View File

@@ -75,9 +75,11 @@ keywords: "API, Docker, rcli, REST, documentation"
`BuildCacheUsage` fields with brief system disk usage data for each system object type.
The endpoint supports the `?verbose=1` query to return verbose system disk usage information.
* Deprecated: `GET /system/df` response fields `LayersSize`, `Images`, `Containers`,
`Volumes`, and `BuildCache` are deprecated in favor of the type specific usage fields.
The legacy fields will not be populated for new API versions that specify the `verbose`
query.
`Volumes`, and `BuildCache` have been removed in favor of the-type specific usage fields.
API v1.52 returns both the legacy and current fields to help existing integrations
to transition to the new response. The legacy fields are not populated if the
`verbose` query parameter is used. Starting with API v1.53, the legacy fields
will no longer be returned.
## v1.51 API changes

View File

@@ -24,27 +24,8 @@ const (
// DiskUsage contains response of Engine API:
// GET "/system/df"
type DiskUsage struct {
LegacyDiskUsage
ImageUsage *image.DiskUsage `json:"ImageUsage,omitempty"`
ContainerUsage *container.DiskUsage `json:"ContainerUsage,omitempty"`
VolumeUsage *volume.DiskUsage `json:"VolumeUsage,omitempty"`
BuildCacheUsage *build.DiskUsage `json:"BuildCacheUsage,omitempty"`
}
type LegacyDiskUsage struct {
// Deprecated: kept to maintain backwards compatibility with API < v1.52, use [ImagesDiskUsage.TotalSize] instead.
LayersSize int64 `json:"LayersSize,omitempty"`
// Deprecated: kept to maintain backwards compatibility with API < v1.52, use [ImagesDiskUsage.Items] instead.
Images []image.Summary `json:"Images,omitzero"`
// Deprecated: kept to maintain backwards compatibility with API < v1.52, use [ContainersDiskUsage.Items] instead.
Containers []container.Summary `json:"Containers,omitzero"`
// Deprecated: kept to maintain backwards compatibility with API < v1.52, use [VolumesDiskUsage.Items] instead.
Volumes []volume.Volume `json:"Volumes,omitzero"`
// Deprecated: kept to maintain backwards compatibility with API < v1.52, use [BuildCacheDiskUsage.Items] instead.
BuildCache []build.CacheRecord `json:"BuildCache,omitzero"`
}