Pārlūkot izejas kodu

Improve API docs for UsageData

The docs did not mention when this information
was set, and what the `-1` value indicated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 8 gadi atpakaļ
vecāks
revīzija
194f635ce7
2 mainītis faili ar 27 papildinājumiem un 9 dzēšanām
  1. 16 6
      api/swagger.yaml
  2. 11 3
      api/types/volume.go

+ 16 - 6
api/swagger.yaml

@@ -1089,17 +1089,27 @@ definitions:
           type: "string"
           type: "string"
       UsageData:
       UsageData:
         type: "object"
         type: "object"
+        x-nullable: true
         required: [Size, RefCount]
         required: [Size, RefCount]
+        description: |
+          Usage details about the volume. This information is used by the
+          `GET /system/df` endpoint, and omitted in other endpoints.
         properties:
         properties:
           Size:
           Size:
             type: "integer"
             type: "integer"
-            description: "The disk space used by the volume (local driver only)"
             default: -1
             default: -1
+            description: |
+              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")
             x-nullable: false
             x-nullable: false
           RefCount:
           RefCount:
             type: "integer"
             type: "integer"
             default: -1
             default: -1
-            description: "The number of containers referencing this volume."
+            description: |
+              The number of containers referencing this volume. This field
+              is set to `-1` if the reference-count is not available.
             x-nullable: false
             x-nullable: false
 
 
     example:
     example:
@@ -5886,13 +5896,13 @@ paths:
                 -
                 -
                   Name: "my-volume"
                   Name: "my-volume"
                   Driver: "local"
                   Driver: "local"
-                  Mountpoint: ""
+                  Mountpoint: "/var/lib/docker/volumes/my-volume/_data"
                   Labels: null
                   Labels: null
-                  Scope: ""
+                  Scope: "local"
                   Options: null
                   Options: null
                   UsageData:
                   UsageData:
-                    Size: 0
-                    RefCount: 0
+                    Size: 10920104
+                    RefCount: 2
         500:
         500:
           description: "server error"
           description: "server error"
           schema:
           schema:

+ 11 - 3
api/types/volume.go

@@ -47,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"`
 }
 }