From f558707746906341af9ad5a981dba30786bdfe54 Mon Sep 17 00:00:00 2001 From: miaohb Date: Mon, 16 Oct 2017 04:34:37 -0700 Subject: [PATCH] Add api-ref for container execute resize This patch adds api-ref for container execute resize. Change-Id: If037734d7e85412ac84ca061c391eaf44c8acb9f Closes-Bug: #1720926 --- api-ref/source/containers.inc | 48 ++++++++++++++++++- api-ref/source/parameters.yaml | 11 +++++ .../container-execute-resize-resp.json | 4 ++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 api-ref/source/samples/container-execute-resize-resp.json diff --git a/api-ref/source/containers.inc b/api-ref/source/containers.inc index f785fba45..84ca6ba89 100644 --- a/api-ref/source/containers.inc +++ b/api-ref/source/containers.inc @@ -8,7 +8,8 @@ Lists, creates, shows details for, stats, updates, deletes, starts, resizes, stops, pauses, unpauses, restarts, renames, commits, kills, attaches to containers, gets archive from container, puts archive to container, and adds security group for specified container, executes command in a running container, gets logs -of a container, displays the running processes in a container. +of a container, displays the running processes in a container, resizes +the tty session used by the exec. Create new container ==================== @@ -1048,6 +1049,51 @@ Response Example :language: javascript +Resize tty when execute command in a container +============================================== + +.. rest_method:: POST /v1/containers/{container_ident}/execute_resize?h={height}&&exec_id={exec_id}&w={width} + +Resize tty when execute command in a container. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + - 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - container_ident: container_ident + - height: height + - exec_id: exec_resize_id + - width: width + +Response +-------- + +.. rest_parameters:: parameters.yaml + + - exec_resize_output: exec_resize_output + +Response Example +---------------- + +.. literalinclude:: samples/container-execute-resize-resp.json + :language: javascript + + Get logs of a container ======================= diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 6646b529f..2961b7706 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -35,6 +35,12 @@ exec_interactive: in: query required: false type: boolean +exec_resize_id: + description: | + The ID of the exec instance. + in: query + required: true + type: string exec_run: description: | Whether to run the command or not. If this parameter is set to true, @@ -249,6 +255,11 @@ exec_output: The output of the command executed in a container. in: body type: dict +exec_resize_output: + description: | + The output of exec_resize, including exec_id and websocket url. + in: body + type: array exec_url: description: | The URL to start an exec instance. diff --git a/api-ref/source/samples/container-execute-resize-resp.json b/api-ref/source/samples/container-execute-resize-resp.json new file mode 100644 index 000000000..98ef36375 --- /dev/null +++ b/api-ref/source/samples/container-execute-resize-resp.json @@ -0,0 +1,4 @@ +{ + "exec_id": "c75e81815181bb22558306fffcaa7d049f4a79378ea70802ee6c4334d0597860", + "url": "ws://0.0.0.0:6784/?token=062411f1-7995-413b-988f-ba8f6c553c6c&uuid=b7074d3a-14e4-4d5a-95cc-579fef16e033" +}