Merge "Add api-ref for more container operations"

This commit is contained in:
Jenkins 2017-07-12 04:20:39 +00:00 committed by Gerrit Code Review
commit d0557921ab
3 changed files with 313 additions and 1 deletions

View File

@ -4,7 +4,8 @@
Manage Containers
===================
Lists, creates, shows details for, updates, and deletes containers.
Lists, creates, shows details for, updates, deletes, starts,
stops, pauses, unpauses, restarts and renames containers.
Create new container
====================
@ -316,3 +317,255 @@ Response Example
.. literalinclude:: samples/container-update-resp.json
:language: javascript
Start a container
=================
.. rest_method:: POST /v1/containers/{container_ident}/start
Start a container.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 401
- 403
- 404
- 409
Request
-------
.. rest_parameters:: parameters.yaml
- container_ident: container_ident
Response
--------
This request does not return anything in the response body.
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
Stop a container
================
.. rest_method:: POST /v1/containers/{container_ident}/stop?timeout={timeout}
Stop a container.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 401
- 403
- 404
- 409
Request
-------
.. rest_parameters:: parameters.yaml
- container_ident: container_ident
- timeout: timeout
Response
--------
This request does not return anything in the response body.
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
Pause a container
=================
.. rest_method:: POST /v1/containers/{container_ident}/pause
Pause a container.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 401
- 403
- 404
- 409
Request
-------
.. rest_parameters:: parameters.yaml
- container_ident: container_ident
Response
--------
This request does not return anything in the response body.
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
Unpause a container
===================
.. rest_method:: POST /v1/containers/{container_ident}/unpause
Unpause a container.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 401
- 403
- 404
- 409
Request
-------
.. rest_parameters:: parameters.yaml
- container_ident: container_ident
Response
--------
This request does not return anything in the response body.
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
Restart a container
===================
.. rest_method:: POST /v1/containers/{container_ident}/reboot?timeout={timeout}
Restart a container.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 401
- 403
- 404
- 409
Request
-------
.. rest_parameters:: parameters.yaml
- container_ident: container_ident
- timeout: timeout
Response
--------
This request does not return anything in the response body.
.. rest_parameters:: parameters.yaml
- X-Openstack-Request-Id: request_id
Rename a container
==================
.. rest_method:: POST /v1/containers/{container_ident}/rename?name={new_name}
Rename a container.
Response Codes
--------------
.. rest_status_code:: success status.yaml
- 202
.. rest_status_code:: error status.yaml
- 401
- 403
- 404
- 409
Request
-------
.. rest_parameters:: parameters.yaml
- container_ident: container_ident
- new_name: new_name
Response
--------
.. rest_parameters:: parameters.yaml
- links: links
- addresses: addresses
- name: name
- image: image
- labels: labels
- image_driver: image_driver
- security_groups: security_groups
- command: command
- cpu: cpu
- memory: memory
- workdir: workdir
- image_pull_policy: image_pull_policy
- environment: environment
- restart_policy: restart_policy
- interactive: interactive
- uuid: uuid
- hostname: hostname
- status: status
- status_detail: status_detail
- host: host
- task_state: task_state
- status_reason: status_reason
- ports: ports
Response Example
----------------
.. literalinclude:: samples/container-rename-resp.json
:language: javascript

View File

@ -17,6 +17,12 @@ force:
in: query
required: true
type: string
timeout:
description: |
Seconds to wait before operating on container.
in: query
required: true
type: string
addresses:
type: string
description: |
@ -156,6 +162,12 @@ name:
in: body
required: true
type: string
new_name:
description: |
The new name for the container.
in: body
required: true
type: string
ports:
description: |
The ports exposed on the container.

View File

@ -0,0 +1,47 @@
{
"addresses": {
"public": [{
"version": 4,
"addr": "172.24.4.3",
"port": "4b077255-9b4d-4068-b24f-b89594f870c2"
}, {
"version": 6,
"addr": "2001:db8::9",
"port": "4b077255-9b4d-4068-b24f-b89594f870c2"
}]
},
"links": [{
"href": "http://openstack.example.com/v1/containers/b0694d40-70af-4488-b104-10f66b593347",
"rel": "self"
},
{"href": "http://openstack.example.com/containers/b0694d40-70af-4488-b104-10f66b593347", "rel": "bookmark"}
],
"image": "ubuntu",
"labels": {
"app": "hello"
},
"security_groups": [],
"image_pull_policy": "always",
"uuid": "b0694d40-70af-4488-b104-10f66b593347",
"hostname": "zun-sandbox-5812822d-6794-4839-85c0-1c01665c0d48",
"environment": {
"foo": "bar"
},
"memory": "500M",
"status": "Stopped",
"workdir": "/home/ubuntu",
"status_detail": "Exited(0) 8 mins ago ",
"host": "ubuntu",
"image_driver": "docker",
"task_state": null,
"status_reason": null,
"name": "test-new",
"restart_policy": {
"MaximumRetryCount": "0",
"Name": "no"
},
"ports": [],
"command": "/bin/sh -c 'echo hello'",
"cpu": 2.0,
"interactive": false
}