Merge pull request #51437 from thaJeztah/diskusage_move_legacy

api: remove / internalize LegacyDiskUsage
This commit is contained in:
Rob Murray
2025-11-10 15:03:37 +00:00
committed by GitHub
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"`
}