Browse code

swagger: move ContainerState to definitions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7e0afd4934528d89e09bd850490db6477222df07)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/01/06 19:53:39
Showing 1 changed files
... ...
@@ -3629,6 +3629,67 @@ definitions:
3629 3629
       Spec:
3630 3630
         $ref: "#/definitions/ConfigSpec"
3631 3631
 
3632
+  ContainerState:
3633
+    description: |
3634
+      ContainerState stores container's running state. It's part of ContainerJSONBase
3635
+      and will be returned by the "inspect" command.
3636
+    type: "object"
3637
+    properties:
3638
+      Status:
3639
+        description: |
3640
+          String representation of the container state. Can be one of "created",
3641
+          "running", "paused", "restarting", "removing", "exited", or "dead".
3642
+        type: "string"
3643
+        enum: ["created", "running", "paused", "restarting", "removing", "exited", "dead"]
3644
+        example: "running"
3645
+      Running:
3646
+        description: |
3647
+          Whether this container is running.
3648
+
3649
+          Note that a running container can be _paused_. The `Running` and `Paused`
3650
+          booleans are not mutually exclusive:
3651
+
3652
+          When pausing a container (on Linux), the freezer cgroup is used to suspend
3653
+          all processes in the container. Freezing the process requires the process to
3654
+          be running. As a result, paused containers are both `Running` _and_ `Paused`.
3655
+
3656
+          Use the `Status` field instead to determine if a container's state is "running".
3657
+        type: "boolean"
3658
+        example: true
3659
+      Paused:
3660
+        description: "Whether this container is paused."
3661
+        type: "boolean"
3662
+        example: false
3663
+      Restarting:
3664
+        description: "Whether this container is restarting."
3665
+        type: "boolean"
3666
+        example: false
3667
+      OOMKilled:
3668
+        description: "Whether this container has been killed because it ran out of memory."
3669
+        type: "boolean"
3670
+        example: false
3671
+      Dead:
3672
+        type: "boolean"
3673
+        example: false
3674
+      Pid:
3675
+        description: "The process ID of this container"
3676
+        type: "integer"
3677
+        example: 1234
3678
+      ExitCode:
3679
+        description: "The last exit code of this container"
3680
+        type: "integer"
3681
+        example: 0
3682
+      Error:
3683
+        type: "string"
3684
+      StartedAt:
3685
+        description: "The time when this container was last started."
3686
+        type: "string"
3687
+        example: "2020-01-06T09:06:59.461876391Z"
3688
+      FinishedAt:
3689
+        description: "The time when this container last exited."
3690
+        type: "string"
3691
+        example: "2020-01-06T09:07:59.461876391Z"
3692
+
3632 3693
   SystemInfo:
3633 3694
     type: "object"
3634 3695
     properties:
... ...
@@ -4860,52 +4921,8 @@ paths:
4860 4860
                 items:
4861 4861
                   type: "string"
4862 4862
               State:
4863
-                description: "The state of the container."
4864
-                type: "object"
4865
-                properties:
4866
-                  Status:
4867
-                    description: |
4868
-                      The status of the container. For example, `"running"` or `"exited"`.
4869
-                    type: "string"
4870
-                    enum: ["created", "running", "paused", "restarting", "removing", "exited", "dead"]
4871
-                  Running:
4872
-                    description: |
4873
-                      Whether this container is running.
4874
-
4875
-                      Note that a running container can be _paused_. The `Running` and `Paused`
4876
-                      booleans are not mutually exclusive:
4877
-
4878
-                      When pausing a container (on Linux), the freezer cgroup is used to suspend
4879
-                      all processes in the container. Freezing the process requires the process to
4880
-                      be running. As a result, paused containers are both `Running` _and_ `Paused`.
4881
-
4882
-                      Use the `Status` field instead to determine if a container's state is "running".
4883
-                    type: "boolean"
4884
-                  Paused:
4885
-                    description: "Whether this container is paused."
4886
-                    type: "boolean"
4887
-                  Restarting:
4888
-                    description: "Whether this container is restarting."
4889
-                    type: "boolean"
4890
-                  OOMKilled:
4891
-                    description: "Whether this container has been killed because it ran out of memory."
4892
-                    type: "boolean"
4893
-                  Dead:
4894
-                    type: "boolean"
4895
-                  Pid:
4896
-                    description: "The process ID of this container"
4897
-                    type: "integer"
4898
-                  ExitCode:
4899
-                    description: "The last exit code of this container"
4900
-                    type: "integer"
4901
-                  Error:
4902
-                    type: "string"
4903
-                  StartedAt:
4904
-                    description: "The time when this container was last started."
4905
-                    type: "string"
4906
-                  FinishedAt:
4907
-                    description: "The time when this container last exited."
4908
-                    type: "string"
4863
+                x-nullable: true
4864
+                $ref: "#/definitions/ContainerState"
4909 4865
               Image:
4910 4866
                 description: "The container's image"
4911 4867
                 type: "string"