-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Adding Container Exec Spec #2584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
7b12627
a60b503
1ec1e3f
24d6011
9fecbb9
3388123
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -175,6 +175,12 @@ | |||
| }, | ||||
| "201": { | ||||
| "description": "Created - the container group is created.", | ||||
| "headers": { | ||||
| "Azure-AsyncOperation": { | ||||
| "description": "Operation Status Location URI", | ||||
| "type": "string" | ||||
| } | ||||
| }, | ||||
| "schema": { | ||||
| "$ref": "#/definitions/ContainerGroup" | ||||
| } | ||||
|
|
@@ -206,6 +212,7 @@ | |||
| { | ||||
| "name": "Resource", | ||||
| "description": "The container group resource with just the tags to be updated.", | ||||
| "required": true, | ||||
| "in": "body", | ||||
| "schema": { | ||||
| "$ref": "#/definitions/Resource" | ||||
|
|
@@ -314,6 +321,39 @@ | |||
| } | ||||
| } | ||||
| }, | ||||
| "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/operations/{operationId}": { | ||||
| "get": { | ||||
| "operationId": "AsyncContainerGroupOperation_Get", | ||||
|
||||
| "x-ms-examples": { | ||||
| "ContainerUsage": { | ||||
| "$ref": "./examples/ContainerGroupUsage.json" | ||||
| } | ||||
| }, | ||||
| "description": "Get the usage for a subscription", | ||||
| "parameters": [ | ||||
| { | ||||
| "$ref": "#/parameters/SubscriptionIdParameter" | ||||
| }, | ||||
| { | ||||
| "$ref": "#/parameters/LocationParameter" | ||||
| }, | ||||
| { | ||||
| "$ref": "#/parameters/OperationIdParameter" | ||||
|
||||
| }, | ||||
| { | ||||
| "$ref": "#/parameters/ApiVersionParameter" | ||||
| } | ||||
| ], | ||||
| "responses": { | ||||
| "200": { | ||||
| "description": "OK", | ||||
| "schema": { | ||||
| "$ref": "#/definitions/AsyncOperation" | ||||
|
||||
| } | ||||
| } | ||||
| } | ||||
| } | ||||
| }, | ||||
| "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs": { | ||||
| "get": { | ||||
| "operationId": "ContainerLogs_List", | ||||
|
|
@@ -360,6 +400,56 @@ | |||
| } | ||||
| } | ||||
| } | ||||
| }, | ||||
| "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec": { | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. action name exec can be more descriptive. launchExecCommand etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
| "post": { | ||||
| "operationId": "StartContainer_Exec", | ||||
| "x-ms-examples": { | ||||
| "ContainerExecStart": { | ||||
| "$ref": "./examples/ContainerExecStart.json" | ||||
| } | ||||
| }, | ||||
| "summary": "Starts the exec command for a specific container instance.", | ||||
| "description": "Starts the exec command for a specified container instance in a specified resource group and container group.", | ||||
| "parameters": [ | ||||
| { | ||||
| "$ref": "#/parameters/SubscriptionIdParameter" | ||||
| }, | ||||
| { | ||||
| "$ref": "#/parameters/ApiVersionParameter" | ||||
| }, | ||||
| { | ||||
| "$ref": "#/parameters/ResourceGroupNameParameter" | ||||
| }, | ||||
| { | ||||
| "$ref": "#/parameters/ContainerGroupNameParameter" | ||||
| }, | ||||
| { | ||||
| "name": "containerName", | ||||
| "in": "path", | ||||
| "description": "The name of the container instance.", | ||||
| "required": true, | ||||
| "type": "string" | ||||
| }, | ||||
| { | ||||
| "name":"containerExecRequest", | ||||
| "in":"body", | ||||
| "description":"The request for the exec command.", | ||||
| "required":true, | ||||
| "schema":{ | ||||
| "$ref":"#/definitions/ContainerExecRequest" | ||||
| } | ||||
| } | ||||
| ], | ||||
| "responses": { | ||||
| "200": { | ||||
| "description": "OK", | ||||
| "schema": { | ||||
| "$ref": "#/definitions/ContainerExecResponse" | ||||
| } | ||||
| } | ||||
| } | ||||
| } | ||||
| } | ||||
| }, | ||||
| "definitions": { | ||||
|
|
@@ -1030,6 +1120,73 @@ | |||
| } | ||||
| } | ||||
| }, | ||||
| "AsyncOperation": { | ||||
|
||||
| "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}": { |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "subid", | ||
| "api-version": "2018-02-01-preview", | ||
| "resourceGroupName": "demo", | ||
| "containerGroupName": "demo1", | ||
| "containerName": "container1", | ||
| "containerExecRequest": { | ||
| "command": "/bin/bash", | ||
| "terminalSize": { | ||
| "row": 12, | ||
| "column": 12 | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "body": { | ||
| "webSocketUri": "wss://web-socket-uri", | ||
| "password": "password" | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any reason for this header, long running operation are handled by the x-ms-long-running-operation flag
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we implemented this feature, we followed the following document about Azure Async Operations:
https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-async-operations
It mentioned:
Azure-AsyncOperation - URL for checking the ongoing status of the operation. If your operation returns this value, always use it (instead of Location) to track the status of the operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure you implemented the server the right way though :)
I'm saying that inside the Swagger, we have a special flag to say this is a ARM async operation and then generators do all this cumbersome work of headers and polling for free.
So you just use that flag, you define your return type with the final resource, and let Autorest deals with the rest.
Example:
azure-rest-api-specs/specification/compute/resource-manager/Microsoft.Compute/stable/2017-12-01/compute.json
Lines 403 to 462 in 8b34c73