Last active
July 31, 2020 16:51
-
-
Save johanste/f548af6afef359912979e844e5fa0ca3 to your computer and use it in GitHub Desktop.
Training/openapi example for service description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Example service", | |
"version": "1.1" | |
}, | |
"paths": { | |
"/ComputeNodes": { | |
"parameters": [ | |
{ | |
"$ref": "#/parameters/ClientRequestId" | |
} | |
], | |
"get": { | |
"operationId": "ComputeNodeAdministration_List", | |
"tags": [ "Administration" ], | |
"responses": { | |
"200": { | |
"description": "Successfully listed (one page of) ComputeNodes", | |
"schema": { | |
"$ref": "#/definitions/PageOfComputeNodes" | |
} | |
}, | |
"default": { | |
"description": "Failed to get ComputeNodes", | |
"schema": { | |
"$ref": "#/definitions/Error" | |
} | |
} | |
} | |
} | |
}, | |
"/ComputeNodes/{nodeName}": { | |
"parameters": [ | |
{ | |
"$ref": "#/parameters/ClientRequestId" | |
}, | |
{ | |
"$ref": "#/parameters/NodeName" | |
} | |
], | |
"put": { | |
"operationId": "ComputeNodeAdministration_Create", | |
"tags": [ "Administration" ], | |
"parameters": [ | |
{ | |
"name": "computeNode", | |
"in": "body", | |
"schema": { | |
"$ref": "#/definitions/ComputeNode" | |
} | |
}, | |
{ | |
"name": "if-match", | |
"in": "header", | |
"type": "string" | |
} | |
], | |
"responses": { | |
"201": { | |
"description": "Successfully created a new ComputeNode", | |
"schema": { | |
"$ref": "#/definitions/ComputeNode" | |
} | |
}, | |
"200": { | |
"description": "Successfully replace an existing ComputeNode", | |
"schema": { | |
"$ref": "#/definitions/ComputeNode" | |
} | |
}, | |
"default": { | |
"description": "Something went wrong", | |
"schema": { | |
"$ref": "#/definitions/Error" | |
} | |
} | |
} | |
}, | |
"get": { | |
"operationId": "ComputeNodeAdministration_Get", | |
"tags": [ "Administration" ], | |
"responses": { | |
"200": { | |
"description": "Successfully got the computeNode", | |
"schema": { | |
"$ref": "#/definitions/ComputeNode" | |
} | |
} | |
} | |
} | |
}, | |
"/ComputeNodes/{nodeName}/computePi": { | |
"parameters": [ | |
{ | |
"$ref": "#/parameters/ClientRequestId" | |
}, | |
{ | |
"$ref": "#/parameters/NodeName" | |
} | |
], | |
"post": { | |
"operationId": "Computation_ComputePi", | |
"tags": [ "Computation" ], | |
"parameters": [ | |
{ | |
"name": "precision", | |
"in": "query", | |
"type": "integer", | |
"default": 17, | |
"minimum": 0 | |
} | |
], | |
"responses": { | |
"202": { | |
"description": "Started long running process", | |
"headers": { | |
"Operation-Location": { | |
"description": "This will point to an operation (/operations/{operationId}) that can be used to monitor the progress", | |
"type": "string", | |
"format": "uri" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/operations/{operationId}": { | |
"parameters": [ | |
{ | |
"name": "operationId", | |
"type": "string", | |
"in": "path", | |
"required": true | |
}, | |
{ | |
"$ref": "#/parameters/ClientRequestId" | |
} | |
], | |
"get": { | |
"tags": [ "Computation" ], | |
"responses": { | |
"200": { | |
"description": "Successfully got the operation status", | |
"headers": { | |
"Location": { | |
"type": "string", | |
"format": "uri" | |
} | |
}, | |
"schema": { | |
"$ref": "#/definitions/Operation" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"parameters": { | |
"NodeName": { | |
"name": "nodeName", | |
"in": "path", | |
"type": "string", | |
"required": true | |
}, | |
"ClientRequestId": { | |
"in": "header", | |
"type": "string", | |
"required": false, | |
"name": "x-ms-client-request-id", | |
"description": "Optional client-provided request id" | |
} | |
}, | |
"definitions": { | |
"Error": { | |
"type": "object" | |
}, | |
"PageOfComputeNodes": { | |
"type": "object", | |
"required": [ | |
"value" | |
], | |
"properties": { | |
"value": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/ComputeNode" | |
} | |
}, | |
"nextLink": { | |
"type": "string" | |
} | |
} | |
}, | |
"ComputeNode": { | |
"type": "object", | |
"required": [ | |
"kind" | |
], | |
"discriminator": "kind", | |
"properties": { | |
"eTag": { | |
"readOnly": true, | |
"type": "string" | |
}, | |
"name": { | |
"readOnly": true, | |
"type": "string" | |
}, | |
"kind": { | |
"type": "string" | |
} | |
} | |
}, | |
"LinuxComputeNode": { | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/definitions/ComputeNode" | |
} | |
], | |
"required": [ | |
"sshPublicKey" | |
], | |
"properties": { | |
"sshPublicKey": { | |
"type": "string" | |
} | |
} | |
}, | |
"WindowsComputeNode": { | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/definitions/ComputeNode" | |
} | |
], | |
"required": [ | |
"userName" | |
], | |
"properties": { | |
"userName": { | |
"type": "string" | |
} | |
} | |
}, | |
"Operation": { | |
"type": "object", | |
"properties": { | |
"createdDateTime": { | |
"readOnly": true, | |
"type": "string", | |
"format": "date-time" | |
}, | |
"percentComplete": { | |
"readOnly": true, | |
"type": "number", | |
"minimum": 0, | |
"maximum": 100 | |
}, | |
"status": { | |
"type": "string", | |
"readOnly": true, | |
"enum": [ | |
"notstarted", | |
"running", | |
"succeeded", | |
"failed", | |
"cancelled" | |
] | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment