Browse code

swagger: move ContainerState to definitions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/01/06 19:53:39
Showing 1 changed files
... ...
@@ -3643,6 +3643,67 @@ definitions:
3643 3643
       Spec:
3644 3644
         $ref: "#/definitions/ConfigSpec"
3645 3645
 
3646
+  ContainerState:
3647
+    description: |
3648
+      ContainerState stores container's running state. It's part of ContainerJSONBase
3649
+      and will be returned by the "inspect" command.
3650
+    type: "object"
3651
+    properties:
3652
+      Status:
3653
+        description: |
3654
+          String representation of the container state. Can be one of "created",
3655
+          "running", "paused", "restarting", "removing", "exited", or "dead".
3656
+        type: "string"
3657
+        enum: ["created", "running", "paused", "restarting", "removing", "exited", "dead"]
3658
+        example: "running"
3659
+      Running:
3660
+        description: |
3661
+          Whether this container is running.
3662
+
3663
+          Note that a running container can be _paused_. The `Running` and `Paused`
3664
+          booleans are not mutually exclusive:
3665
+
3666
+          When pausing a container (on Linux), the freezer cgroup is used to suspend
3667
+          all processes in the container. Freezing the process requires the process to
3668
+          be running. As a result, paused containers are both `Running` _and_ `Paused`.
3669
+
3670
+          Use the `Status` field instead to determine if a container's state is "running".
3671
+        type: "boolean"
3672
+        example: true
3673
+      Paused:
3674
+        description: "Whether this container is paused."
3675
+        type: "boolean"
3676
+        example: false
3677
+      Restarting:
3678
+        description: "Whether this container is restarting."
3679
+        type: "boolean"
3680
+        example: false
3681
+      OOMKilled:
3682
+        description: "Whether this container has been killed because it ran out of memory."
3683
+        type: "boolean"
3684
+        example: false
3685
+      Dead:
3686
+        type: "boolean"
3687
+        example: false
3688
+      Pid:
3689
+        description: "The process ID of this container"
3690
+        type: "integer"
3691
+        example: 1234
3692
+      ExitCode:
3693
+        description: "The last exit code of this container"
3694
+        type: "integer"
3695
+        example: 0
3696
+      Error:
3697
+        type: "string"
3698
+      StartedAt:
3699
+        description: "The time when this container was last started."
3700
+        type: "string"
3701
+        example: "2020-01-06T09:06:59.461876391Z"
3702
+      FinishedAt:
3703
+        description: "The time when this container last exited."
3704
+        type: "string"
3705
+        example: "2020-01-06T09:07:59.461876391Z"
3706
+
3646 3707
   SystemInfo:
3647 3708
     type: "object"
3648 3709
     properties:
... ...
@@ -4885,52 +4946,8 @@ paths:
4885 4885
                 items:
4886 4886
                   type: "string"
4887 4887
               State:
4888
-                description: "The state of the container."
4889
-                type: "object"
4890
-                properties:
4891
-                  Status:
4892
-                    description: |
4893
-                      The status of the container. For example, `"running"` or `"exited"`.
4894
-                    type: "string"
4895
-                    enum: ["created", "running", "paused", "restarting", "removing", "exited", "dead"]
4896
-                  Running:
4897
-                    description: |
4898
-                      Whether this container is running.
4899
-
4900
-                      Note that a running container can be _paused_. The `Running` and `Paused`
4901
-                      booleans are not mutually exclusive:
4902
-
4903
-                      When pausing a container (on Linux), the freezer cgroup is used to suspend
4904
-                      all processes in the container. Freezing the process requires the process to
4905
-                      be running. As a result, paused containers are both `Running` _and_ `Paused`.
4906
-
4907
-                      Use the `Status` field instead to determine if a container's state is "running".
4908
-                    type: "boolean"
4909
-                  Paused:
4910
-                    description: "Whether this container is paused."
4911
-                    type: "boolean"
4912
-                  Restarting:
4913
-                    description: "Whether this container is restarting."
4914
-                    type: "boolean"
4915
-                  OOMKilled:
4916
-                    description: "Whether this container has been killed because it ran out of memory."
4917
-                    type: "boolean"
4918
-                  Dead:
4919
-                    type: "boolean"
4920
-                  Pid:
4921
-                    description: "The process ID of this container"
4922
-                    type: "integer"
4923
-                  ExitCode:
4924
-                    description: "The last exit code of this container"
4925
-                    type: "integer"
4926
-                  Error:
4927
-                    type: "string"
4928
-                  StartedAt:
4929
-                    description: "The time when this container was last started."
4930
-                    type: "string"
4931
-                  FinishedAt:
4932
-                    description: "The time when this container last exited."
4933
-                    type: "string"
4888
+                x-nullable: true
4889
+                $ref: "#/definitions/ContainerState"
4934 4890
               Image:
4935 4891
                 description: "The container's image"
4936 4892
                 type: "string"