From 532911c4408ad0b32c90415ea212670051ac0302 Mon Sep 17 00:00:00 2001 From: shaiic-pai Date: Mon, 21 Sep 2020 14:20:59 +0800 Subject: [PATCH] fix put/delete tag CI --- .tests/apiTestCase.json | 17328 ++++++++++++++++++++++++++++++++- tests/common/apiTestCases.ts | 40 +- 2 files changed, 17347 insertions(+), 21 deletions(-) diff --git a/.tests/apiTestCase.json b/.tests/apiTestCase.json index 6c85f6b..78295c5 100644 --- a/.tests/apiTestCase.json +++ b/.tests/apiTestCase.json @@ -1 +1,17327 @@ -{"tests":[], "map":{}} +{ + "tests": [ + { + "description": "get /api/v2/info", + "tests": [ + { + "operation": { + "tag": "api", + "operationId": "getClusterInfo", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "PAI RESTfulAPI" + }, + "version": { + "type": "string", + "description": "cluster version in v0.X.0 format" + }, + "launcherType": { + "type": "string", + "enum": [ + "yarn", + "k8s" + ] + }, + "authnMethod": { + "type": "string", + "enum": [ + "basic", + "OIDC" + ] + } + }, + "required": [ + "name", + "version", + "launcherType", + "authnMethod" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "PAI RESTfulAPI" + }, + "version": { + "type": "string", + "description": "cluster version in v0.X.0 format" + }, + "launcherType": { + "type": "string", + "enum": [ + "yarn", + "k8s" + ] + }, + "authnMethod": { + "type": "string", + "enum": [ + "basic", + "OIDC" + ] + } + }, + "required": [ + "name", + "version", + "launcherType", + "authnMethod" + ] + }, + "example": { + "name": "PAI RESTful API", + "version": "v1.0.1", + "launcherType": "k8s", + "authnMethod": "basic" + } + } + } + } + } + }, + { + "before": [ + { + "tag": "token", + "operationId": "createApplicationToken" + } + ], + "tests": [ + { + "description": "Get tokens with user token", + "operation": { + "tag": "token", + "operationId": "getTokens", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "tokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "JWT string list" + } + }, + "required": [ + "tokens" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Get tokens with unauthorized token", + "customizedTest": "getTokensWithUnauthorizedUser", + "operation": { + "tag": "token", + "operationId": "getTokens", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "tokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "JWT string list" + } + }, + "required": [ + "tokens" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "tokens": { + "type": "array", + "items": { + "type": "string" + }, + "description": "JWT string list" + } + }, + "required": [ + "tokens" + ] + }, + "example": { + "tokens": [ + "JWT Token Example" + ] + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + } + }, + "description": "get /api/v2/tokens" + }, + { + "before": [ + { + "tag": "token", + "operationId": "createApplicationToken" + } + ], + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ], + "tag": "token", + "operationId": "deleteToken", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "revoke successfully" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + } + }, + "description": "delete /api/v2/tokens/{token}" + }, + { + "tests": [ + { + "operation": { + "tag": "token", + "operationId": "createApplicationToken", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "your access token" + }, + "application": { + "type": "boolean", + "description": "true" + } + } + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "testResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "your access token" + }, + "application": { + "type": "boolean", + "description": "true" + } + } + }, + "example": { + "token": "JWT Token Example", + "application": true + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + } + }, + "description": "post /api/v2/tokens/application" + }, + { + "description": "get /api/v2/authn/oidc/login", + "tests": [ + { + "operation": { + "tag": "authn", + "operationId": "oidcLogin", + "parameters": [] + } + } + ], + "schemas": { + "302": { + "description": "Redirect" + } + } + }, + { + "description": "get /api/v2/authn/oidc/logout", + "tests": [ + { + "operation": { + "tag": "authn", + "operationId": "oidcLogout", + "parameters": [] + } + } + ], + "schemas": { + "302": { + "description": "Redirect" + } + } + }, + { + "tests": [ + { + "description": "login with correct username and password", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "pwd" + } + ], + "tag": "authn", + "operationId": "basicLogin", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "your access token" + }, + "user": { + "type": "string", + "description": "username" + }, + "admin": { + "type": "boolean", + "description": "true if user is admin" + } + }, + "required": [ + "token", + "user", + "admin" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "login with non-existent username", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "nonexistentuser" + }, + { + "type": "raw", + "value": "password" + } + ], + "response": { + "statusCode": 400, + "expectResult": { + "code": "NoUserError", + "message": "User nonexistentuser is not found." + }, + "schema": { + "description": "NoUserError or IncorrectPasswordError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + }, + "tag": "authn", + "operationId": "basicLogin" + } + }, + { + "description": "login with incorrect password", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "incorrectpassword" + } + ], + "response": { + "statusCode": 400, + "expectResult": { + "code": "IncorrectPasswordError", + "message": "Password is incorrect." + }, + "schema": { + "description": "NoUserError or IncorrectPasswordError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + } + }, + "tag": "authn", + "operationId": "basicLogin" + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "testResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "your access token" + }, + "user": { + "type": "string", + "description": "username" + }, + "admin": { + "type": "boolean", + "description": "true if user is admin" + } + }, + "required": [ + "token", + "user", + "admin" + ] + }, + "example": { + "token": "JWT Token Example", + "user": "user", + "admin": true + } + } + } + }, + "400": { + "description": "NoUserError or IncorrectPasswordError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + } + }, + "description": "post /api/v2/authn/basic/login" + }, + { + "before": [ + { + "tag": "authn", + "operationId": "basicLogin", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "pwd" + } + ] + } + ], + "tests": [ + { + "description": "Logout with correct token", + "customizedTest": "logoutWithCorrectToken", + "operation": { + "tag": "authn", + "operationId": "basicLogout", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Logout with incorrect token", + "customizedTest": "logoutWithIncorrectToken", + "operation": { + "tag": "authn", + "operationId": "basicLogout", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "Logout successfully" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + } + }, + "description": "delete /api/v2/authn/basic/logout" + }, + { + "before": [ + { + "tag": "token", + "operationId": "createApplicationToken" + } + ], + "tests": [ + { + "description": "Create a user", + "operation": { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Create a conflict user", + "operation": { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 409, + "schema": { + "description": "ConflictUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ConflictUserError": { + "value": { + "code": "ConflictUserError", + "message": "User name {user} already exists." + } + } + } + } + } + } + } + } + }, + { + "description": "Create a user by application token", + "customizedTest": "createUserByApplicationToken", + "operation": { + "tag": "user", + "operationId": "createUser", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Create a user by non-admin user token", + "customizedTest": "createUserByNonadminToken", + "operation": { + "tag": "user", + "operationId": "createUser", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "user", + "operationId": "deleteUser", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "User is created successfully" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "409": { + "description": "ConflictUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ConflictUserError": { + "value": { + "code": "ConflictUserError", + "message": "User name {user} already exists." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "post /api/v2/users" + }, + { + "description": "get /api/v2/users", + "tests": [ + { + "operation": { + "tag": "user", + "operationId": "getAllUser", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "description": "Array with all users in the system.", + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "user name" + }, + "admin": { + "type": "boolean", + "description": "Admin or not." + }, + "virtualCluster": { + "type": "array", + "description": "The list of virtualCluster which the user can access.", + "items": { + "type": "string", + "description": "virtual cluster name." + } + }, + "storageConfig": { + "type": "array", + "description": "storageconfig string arry", + "items": { + "type": "string" + } + }, + "email": { + "type": "string", + "description": "email address" + }, + "extension": { + "type": "object", + "description": "extension field." + } + }, + "required": [ + "username", + "admin", + "virtualCluster", + "storageConfig", + "email", + "extension" + ] + } + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "description": "Array with all users in the system.", + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "user name" + }, + "admin": { + "type": "boolean", + "description": "Admin or not." + }, + "virtualCluster": { + "type": "array", + "description": "The list of virtualCluster which the user can access.", + "items": { + "type": "string", + "description": "virtual cluster name." + } + }, + "storageConfig": { + "type": "array", + "description": "storageconfig string arry", + "items": { + "type": "string" + } + }, + "email": { + "type": "string", + "description": "email address" + }, + "extension": { + "type": "object", + "description": "extension field." + } + }, + "required": [ + "username", + "admin", + "virtualCluster", + "storageConfig", + "email", + "extension" + ] + } + }, + "example": [ + { + "username": "username", + "admin": true, + "virtualCluster": [], + "storageConfig": [], + "email": "email@test.com", + "extension": {} + } + ] + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + } + }, + { + "before": [ + { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "token", + "operationId": "createApplicationToken" + } + ], + "tests": [ + { + "description": "Update a user, patch: true", + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "email": "new_email@test1.com" + } + } + ], + "tag": "user", + "operationId": "updateUser", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Update a user, patch: false", + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "email": "new_email@test2.com", + "virtualCluster": [ + "default" + ], + "admin": false, + "password": "new_test_password", + "extension": {} + } + }, + { + "type": "raw", + "value": false + } + ], + "tag": "user", + "operationId": "updateUser", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Update a non-existent user", + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "username": "non_exist_user", + "email": "new_email@test1.com" + } + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + } + }, + "tag": "user", + "operationId": "updateUser" + } + }, + { + "description": "Update a user by application token", + "customizedTest": "updateUserByApplicationToken", + "operation": { + "tag": "user", + "operationId": "updateUser", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Update a user by non-admin user token", + "customizedTest": "updateUserByNonadminToken", + "operation": { + "tag": "user", + "operationId": "updateUser", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "user", + "operationId": "deleteUser", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 1 + } + ] + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "update group {username} successfully." + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/users" + }, + { + "tests": [ + { + "description": "Update user self, patch: true", + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test", + "email": "new_email@test1.com" + } + } + ], + "tag": "user", + "operationId": "updateUserSelf", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Update user self, patch: false", + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test", + "email": "new_email@test2.com", + "oldPassword": "pwd", + "newPassword": "pwd" + } + }, + { + "type": "raw", + "value": false + } + ], + "tag": "user", + "operationId": "updateUserSelf", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Update user self with incorrect username", + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "username": "incorrect_username", + "email": "new_email@test1.com" + } + } + ], + "response": { + "statusCode": 403, + "schema": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + } + }, + "tag": "user", + "operationId": "updateUserSelf" + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "update group {username} successfully." + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/users/me" + }, + { + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + } + ], + "tag": "user", + "operationId": "getUser", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "user name" + }, + "admin": { + "type": "boolean", + "description": "Admin or not." + }, + "virtualCluster": { + "type": "array", + "description": "The list of virtualCluster which the user can access.", + "items": { + "type": "string", + "description": "virtual cluster name." + } + }, + "storageConfig": { + "type": "array", + "description": "storageconfig string arry", + "items": { + "type": "string" + } + }, + "email": { + "type": "string", + "description": "email address" + }, + "extension": { + "type": "object", + "description": "extension field." + } + }, + "required": [ + "username", + "admin", + "virtualCluster", + "storageConfig", + "email", + "extension" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "user name" + }, + "admin": { + "type": "boolean", + "description": "Admin or not." + }, + "virtualCluster": { + "type": "array", + "description": "The list of virtualCluster which the user can access.", + "items": { + "type": "string", + "description": "virtual cluster name." + } + }, + "storageConfig": { + "type": "array", + "description": "storageconfig string arry", + "items": { + "type": "string" + } + }, + "email": { + "type": "string", + "description": "email address" + }, + "extension": { + "type": "object", + "description": "extension field." + } + }, + "required": [ + "username", + "admin", + "virtualCluster", + "storageConfig", + "email", + "extension" + ] + }, + "example": { + "username": "username", + "admin": true, + "virtualCluster": [], + "storageConfig": [], + "email": "email@test.com", + "extension": {} + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/users/{user}" + }, + { + "before": [ + { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "token", + "operationId": "createApplicationToken" + } + ], + "tests": [ + { + "description": "Delete a user", + "operation": { + "tag": "user", + "operationId": "deleteUser", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Delete a non-existent user", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "non_exist_user" + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + } + }, + "tag": "user", + "operationId": "deleteUser" + } + }, + { + "description": "Delete a user by application token", + "customizedTest": "deleteUserByApplicationToken", + "operation": { + "tag": "user", + "operationId": "deleteUser", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Delete a user by non-admin user token", + "customizedTest": "deleteUserByNonadminToken", + "operation": { + "tag": "user", + "operationId": "deleteUser", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 1 + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "user is removed successfully" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "delete /api/v2/users/{user}" + }, + { + "before": [ + { + "tag": "token", + "operationId": "createApplicationToken" + }, + { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "group", + "operationId": "createGroup", + "parameters": [ + { + "type": "raw", + "value": { + "groupname": "sdktestgroup" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "tests": [ + { + "description": "Add a group to a user's grouplist", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + }, + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "tag": "user", + "operationId": "updateUserGroup", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Add a group to a non-existent user's grouplist", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "non_exist_user" + }, + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + } + }, + "tag": "user", + "operationId": "updateUserGroup" + } + }, + { + "description": "Add a group to a user's grouplist by application token", + "customizedTest": "updateUserGroupByApplicationToken", + "operation": { + "tag": "user", + "operationId": "updateUserGroup", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Add a group to a user's grouplist by non-admin user token", + "customizedTest": "updateUserGroupByNonadminToken", + "operation": { + "tag": "user", + "operationId": "updateUserGroup", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + }, + { + "tag": "user", + "operationId": "deleteUser", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "group", + "operationId": "deleteGroup", + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "User {username} is added into group {groupname}" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/users/{user}/group/" + }, + { + "before": [ + { + "tag": "token", + "operationId": "createApplicationToken" + }, + { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "group", + "operationId": "createGroup", + "parameters": [ + { + "type": "raw", + "value": { + "groupname": "sdktestgroup" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "user", + "operationId": "updateUserGroup", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + }, + { + "type": "raw", + "value": "sdktestgroup" + } + ] + } + ], + "tests": [ + { + "description": "Remove a group to a user's grouplist", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + }, + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "tag": "user", + "operationId": "deleteUserGroup", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Remove a group to a non-existent user's grouplist", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "non_exist_user" + }, + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + } + }, + "tag": "user", + "operationId": "deleteUserGroup" + } + }, + { + "description": "Remove a group to a user's grouplist by application token", + "customizedTest": "deleteUserGroupByApplicationToken", + "operation": { + "tag": "user", + "operationId": "deleteUserGroup", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Remove a group to a user's grouplist by non-admin user token", + "customizedTest": "deleteUserGroupByNonadminToken", + "operation": { + "tag": "user", + "operationId": "deleteUserGroup", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + }, + { + "tag": "user", + "operationId": "deleteUser", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + }, + { + "tag": "group", + "operationId": "deleteGroup", + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "User {username} is removed from group {groupname}" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "delete /api/v2/users/{user}/group/" + }, + { + "before": [ + { + "tag": "token", + "operationId": "createApplicationToken" + }, + { + "tag": "user", + "operationId": "createUser", + "parameters": [ + { + "type": "raw", + "value": { + "username": "sdk_test_user", + "password": "test_password" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "tests": [ + { + "description": "Replace a user's grouplist", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + }, + { + "type": "raw", + "value": [ + "default" + ] + } + ], + "tag": "user", + "operationId": "updateUserGrouplist", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Replace a non-existent user's grouplist", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "non_exist_user" + }, + { + "type": "raw", + "value": [ + "default" + ] + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + } + }, + "tag": "user", + "operationId": "updateUserGrouplist" + } + }, + { + "description": "Replace a user's grouplist by application token", + "customizedTest": "updateUserGrouplistByApplicationToken", + "operation": { + "tag": "user", + "operationId": "updateUserGrouplist", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Replace a user's grouplist by non-admin user token", + "customizedTest": "updateUserGrouplistByNonadminToken", + "operation": { + "tag": "user", + "operationId": "updateUserGrouplist", + "parameters": [], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "token", + "operationId": "deleteToken", + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "token" + ], + "resultIndex": 0 + } + ] + }, + { + "tag": "user", + "operationId": "deleteUser", + "parameters": [ + { + "type": "raw", + "value": "sdk_test_user" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "update user grouplist successfully." + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoUserError": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/users/{user}/grouplist/" + }, + { + "description": "get /api/v2/groups", + "tests": [ + { + "operation": { + "tag": "group", + "operationId": "getAllGroup", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "description": "Array with all groups in the system.", + "type": "array", + "items": { + "type": "object", + "properties": { + "groupname": { + "type": "string", + "description": "group name" + }, + "description": { + "type": "string", + "description": "description for the group" + }, + "externalName": { + "type": "string", + "description": "the external group name binding with the group in OpenPAI" + }, + "extension": { + "type": "object" + } + } + } + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "description": "Array with all groups in the system.", + "type": "array", + "items": { + "type": "object", + "properties": { + "groupname": { + "type": "string", + "description": "group name" + }, + "description": { + "type": "string", + "description": "description for the group" + }, + "externalName": { + "type": "string", + "description": "the external group name binding with the group in OpenPAI" + }, + "extension": { + "type": "object" + } + } + } + }, + "example": [ + { + "groupname": "groupName", + "description": "description", + "externalName": "externalName", + "extension": {} + } + ] + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + } + }, + { + "tests": [ + { + "operation": { + "tag": "group", + "operationId": "createGroup", + "parameters": [ + { + "type": "raw", + "value": { + "groupname": "sdktestgroup" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "group", + "operationId": "deleteGroup", + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "group is created successfully" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "post /api/v2/groups" + }, + { + "before": [ + { + "tag": "group", + "operationId": "createGroup", + "parameters": [ + { + "type": "raw", + "value": { + "groupname": "sdktestgroup" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "raw", + "value": { + "data": { + "groupname": "sdktestgroup", + "description": "test update group" + }, + "patch": true + } + } + ], + "tag": "group", + "operationId": "updateGroup", + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "group", + "operationId": "deleteGroup", + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "update group {groupname} successfully." + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoGroupError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoGroupError": { + "value": { + "code": "NoGroupError", + "message": "Group {groupname} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/groups" + }, + { + "before": [ + { + "tag": "group", + "operationId": "createGroup", + "parameters": [ + { + "type": "raw", + "value": { + "groupname": "sdktestgroup" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "tag": "group", + "operationId": "getGroup", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "groupname": { + "type": "string", + "description": "group name" + }, + "description": { + "type": "string", + "description": "description for the group" + }, + "externalName": { + "type": "string", + "description": "the external group name binding with the group in OpenPAI" + }, + "extension": { + "type": "object" + } + }, + "required": [ + "groupname", + "description", + "externalName", + "extension" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "group", + "operationId": "deleteGroup", + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "groupname": { + "type": "string", + "description": "group name" + }, + "description": { + "type": "string", + "description": "description for the group" + }, + "externalName": { + "type": "string", + "description": "the external group name binding with the group in OpenPAI" + }, + "extension": { + "type": "object" + } + }, + "required": [ + "groupname", + "description", + "externalName", + "extension" + ] + }, + "example": { + "groupname": "groupName", + "description": "description", + "externalName": "externalName", + "extension": {} + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "404": { + "description": "NoGroupError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoGroupError": { + "value": { + "code": "NoGroupError", + "message": "Group {groupname} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/groups/{group}" + }, + { + "before": [ + { + "tag": "group", + "operationId": "createGroup", + "parameters": [ + { + "type": "raw", + "value": { + "groupname": "sdktestgroup" + } + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + ], + "tests": [ + { + "operation": { + "tag": "group", + "operationId": "deleteGroup", + "parameters": [ + { + "type": "raw", + "value": "sdktestgroup" + } + ], + "response": { + "statusCode": 201, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "201": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "group is removed successfully" + } + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "delete /api/v2/groups/{group}" + }, + { + "description": "get /api/v2/groups/{group}/userlist", + "tests": [ + { + "operation": { + "tag": "group", + "operationId": "getGroupMembers", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "description": "Array with all users in the group.", + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "user name" + }, + "clusterAdmin": { + "type": "boolean", + "description": "Cluster admin or not." + } + } + } + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "description": "Array with all users in the group.", + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "user name" + }, + "clusterAdmin": { + "type": "boolean", + "description": "Cluster admin or not." + } + } + } + }, + "example": [ + { + "username": "username", + "clusterAdmin": false + } + ] + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + } + }, + { + "description": "get /api/v2/virtual-clusters", + "tests": [ + { + "operation": { + "tag": "virtual cluster", + "operationId": "listVirtualClusters", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "capacity": { + "type": "number", + "description": "capacity percentage this virtual cluster can use of entire cluster" + }, + "usedCapacity": { + "type": "number", + "description": "used capacity percentage this virtual cluster can use of entire cluster" + }, + "maxCapacity": { + "type": "number", + "description": "max capacity percentage this virtual cluster can use of entire cluster" + }, + "dedicated": { + "type": "boolean", + "description": "dedicated virtual cluster or not" + }, + "resourcesUsed": { + "type": "object", + "description": "used resources", + "properties": { + "cpu": { + "type": "integer", + "description": "used cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "used memory in MB" + }, + "gpu": { + "type": "integer", + "description": "used gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesGuaranteed": { + "type": "object", + "description": "guaranteed resources, including used and free", + "properties": { + "cpu": { + "type": "integer", + "description": "guaranteed cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "guaranteed memory in MB" + }, + "gpu": { + "type": "integer", + "description": "guaranteed gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesTotal": { + "type": "object", + "description": "total resources, including guaranteed and bad", + "properties": { + "cpu": { + "type": "integer", + "description": "total cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "total memory in MB" + }, + "gpu": { + "type": "integer", + "description": "total gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + } + }, + "required": [ + "capacity", + "usedCapacity", + "maxCapacity", + "resourcesUsed", + "resourcesGuaranteed", + "resourcesTotal" + ] + } + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "capacity": { + "type": "number", + "description": "capacity percentage this virtual cluster can use of entire cluster" + }, + "usedCapacity": { + "type": "number", + "description": "used capacity percentage this virtual cluster can use of entire cluster" + }, + "maxCapacity": { + "type": "number", + "description": "max capacity percentage this virtual cluster can use of entire cluster" + }, + "dedicated": { + "type": "boolean", + "description": "dedicated virtual cluster or not" + }, + "resourcesUsed": { + "type": "object", + "description": "used resources", + "properties": { + "cpu": { + "type": "integer", + "description": "used cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "used memory in MB" + }, + "gpu": { + "type": "integer", + "description": "used gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesGuaranteed": { + "type": "object", + "description": "guaranteed resources, including used and free", + "properties": { + "cpu": { + "type": "integer", + "description": "guaranteed cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "guaranteed memory in MB" + }, + "gpu": { + "type": "integer", + "description": "guaranteed gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesTotal": { + "type": "object", + "description": "total resources, including guaranteed and bad", + "properties": { + "cpu": { + "type": "integer", + "description": "total cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "total memory in MB" + }, + "gpu": { + "type": "integer", + "description": "total gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + } + }, + "required": [ + "capacity", + "usedCapacity", + "maxCapacity", + "resourcesUsed", + "resourcesGuaranteed", + "resourcesTotal" + ] + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + } + }, + { + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "raw", + "value": "default" + } + ], + "tag": "virtual cluster", + "operationId": "getVirtualCluster", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "capacity": { + "type": "number", + "description": "capacity percentage this virtual cluster can use of entire cluster" + }, + "usedCapacity": { + "type": "number", + "description": "used capacity percentage this virtual cluster can use of entire cluster" + }, + "maxCapacity": { + "type": "number", + "description": "max capacity percentage this virtual cluster can use of entire cluster" + }, + "dedicated": { + "type": "boolean", + "description": "dedicated virtual cluster or not" + }, + "resourcesUsed": { + "type": "object", + "description": "used resources", + "properties": { + "cpu": { + "type": "integer", + "description": "used cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "used memory in MB" + }, + "gpu": { + "type": "integer", + "description": "used gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesGuaranteed": { + "type": "object", + "description": "guaranteed resources, including used and free", + "properties": { + "cpu": { + "type": "integer", + "description": "guaranteed cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "guaranteed memory in MB" + }, + "gpu": { + "type": "integer", + "description": "guaranteed gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesTotal": { + "type": "object", + "description": "total resources, including guaranteed and bad", + "properties": { + "cpu": { + "type": "integer", + "description": "total cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "total memory in MB" + }, + "gpu": { + "type": "integer", + "description": "total gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + } + }, + "required": [ + "capacity", + "usedCapacity", + "maxCapacity", + "resourcesUsed", + "resourcesGuaranteed", + "resourcesTotal" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "capacity": { + "type": "number", + "description": "capacity percentage this virtual cluster can use of entire cluster" + }, + "usedCapacity": { + "type": "number", + "description": "used capacity percentage this virtual cluster can use of entire cluster" + }, + "maxCapacity": { + "type": "number", + "description": "max capacity percentage this virtual cluster can use of entire cluster" + }, + "dedicated": { + "type": "boolean", + "description": "dedicated virtual cluster or not" + }, + "resourcesUsed": { + "type": "object", + "description": "used resources", + "properties": { + "cpu": { + "type": "integer", + "description": "used cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "used memory in MB" + }, + "gpu": { + "type": "integer", + "description": "used gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesGuaranteed": { + "type": "object", + "description": "guaranteed resources, including used and free", + "properties": { + "cpu": { + "type": "integer", + "description": "guaranteed cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "guaranteed memory in MB" + }, + "gpu": { + "type": "integer", + "description": "guaranteed gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + }, + "resourcesTotal": { + "type": "object", + "description": "total resources, including guaranteed and bad", + "properties": { + "cpu": { + "type": "integer", + "description": "total cpu number" + }, + "vCores": { + "type": "integer", + "description": "same as cpu" + }, + "memory": { + "type": "integer", + "description": "total memory in MB" + }, + "gpu": { + "type": "integer", + "description": "total gpu number" + }, + "GPUs": { + "type": "integer", + "description": "same as gpu" + } + } + } + }, + "required": [ + "capacity", + "usedCapacity", + "maxCapacity", + "resourcesUsed", + "resourcesGuaranteed", + "resourcesTotal" + ] + }, + "example": { + "capacity": 70, + "usedCapacity": 30, + "dedicated": false, + "resourcesUsed": { + "cpu": 1, + "memory": 1024, + "gpu": 1, + "vCores": 1, + "GPUs": 1 + }, + "resourcesGuaranteed": { + "cpu": 2, + "memory": 2048, + "gpu": 2, + "vCores": 2, + "GPUs": 2 + }, + "resourcesTotal": { + "cpu": 2, + "memory": 2048, + "gpu": 2, + "vCores": 2, + "GPUs": 2 + }, + "maxCapacity": 70 + } + } + } + }, + "404": { + "description": "NoVirtualClusterError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoVirtualClusterError": { + "value": { + "code": "NoVirtualClusterError", + "message": "Virtual cluster {vc} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/virtual-clusters/{vc}" + }, + { + "description": "get /api/v2/storages", + "tests": [ + { + "operation": { + "tag": "storage", + "operationId": "getStorages", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "description": "summary of configured PV storage", + "properties": { + "storages": { + "type": "array", + "items": { + "type": "object", + "description": "summary of each storage", + "properties": { + "name": { + "type": "string" + }, + "share": { + "type": "boolean" + }, + "volumeName": { + "type": "string" + }, + "default": { + "type": "boolean" + } + }, + "required": [ + "name", + "share", + "volumeName", + "default" + ] + } + } + }, + "required": [ + "storages" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "summary of configured PV storage", + "properties": { + "storages": { + "type": "array", + "items": { + "type": "object", + "description": "summary of each storage", + "properties": { + "name": { + "type": "string" + }, + "share": { + "type": "boolean" + }, + "volumeName": { + "type": "string" + }, + "default": { + "type": "boolean" + } + }, + "required": [ + "name", + "share", + "volumeName", + "default" + ] + } + } + }, + "required": [ + "storages" + ] + }, + "example": { + "storages": [ + { + "name": "name", + "share": true, + "volumeName": "volumeName", + "default": true + } + ] + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + } + }, + { + "before": [ + { + "tag": "storage", + "operationId": "getStorages" + } + ], + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "fromResult", + "resultType": "beforeResults", + "resultPath": [ + "storages", + 0, + "name" + ], + "resultIndex": 0 + } + ], + "tag": "storage", + "operationId": "getStorage", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "description": "detail of configured PV storage", + "properties": { + "name": { + "type": "string" + }, + "share": { + "type": "boolean" + }, + "volumeName": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "nfs", + "samba", + "azureFile", + "azureBlob", + "other", + "unknown" + ] + }, + "data": { + "anyOf": [ + { + "type": "object", + "description": "nfs type", + "properties": { + "server": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "required": [ + "server", + "path" + ] + }, + { + "type": "object", + "description": "samba type", + "properties": { + "address": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "address" + ] + }, + { + "type": "object", + "description": "azureFile type", + "properties": { + "shareName": { + "type": "string" + }, + "accountName": { + "type": "string" + }, + "accountKey": { + "type": "string" + } + }, + "required": [ + "shareName" + ] + }, + { + "type": "object", + "description": "azureBlob type", + "properties": { + "containerName": { + "type": "string" + }, + "accountName": { + "type": "string" + }, + "accountKey": { + "type": "string" + }, + "accountSASToken": { + "type": "string" + } + }, + "required": [ + "containerName" + ] + }, + { + "type": "object", + "description": "other/unknown type", + "properties": {} + } + ] + }, + "readOnly": { + "type": "boolean" + }, + "secretName": { + "type": "string" + }, + "mountOptions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "share", + "volumeName", + "type", + "data" + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "detail of configured PV storage", + "properties": { + "name": { + "type": "string" + }, + "share": { + "type": "boolean" + }, + "volumeName": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "nfs", + "samba", + "azureFile", + "azureBlob", + "other", + "unknown" + ] + }, + "data": { + "anyOf": [ + { + "type": "object", + "description": "nfs type", + "properties": { + "server": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "required": [ + "server", + "path" + ] + }, + { + "type": "object", + "description": "samba type", + "properties": { + "address": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "address" + ] + }, + { + "type": "object", + "description": "azureFile type", + "properties": { + "shareName": { + "type": "string" + }, + "accountName": { + "type": "string" + }, + "accountKey": { + "type": "string" + } + }, + "required": [ + "shareName" + ] + }, + { + "type": "object", + "description": "azureBlob type", + "properties": { + "containerName": { + "type": "string" + }, + "accountName": { + "type": "string" + }, + "accountKey": { + "type": "string" + }, + "accountSASToken": { + "type": "string" + } + }, + "required": [ + "containerName" + ] + }, + { + "type": "object", + "description": "other/unknown type", + "properties": {} + } + ] + }, + "readOnly": { + "type": "boolean" + }, + "secretName": { + "type": "string" + }, + "mountOptions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "share", + "volumeName", + "type", + "data" + ] + }, + "example": { + "name": "nfs-storage-name", + "share": true, + "volumeName": "nfs-volume-name", + "default": true, + "type": "nfs", + "data": { + "server": "", + "path": "/data" + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "User {user} is not allowed to access {storage}." + } + } + } + } + } + }, + "404": { + "description": "NoStorageError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoVirtualClusterError": { + "value": { + "code": "NoStorageError", + "message": "Storage {storage} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/storages/{storage}" + }, + { + "tests": [ + { + "operation": { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_joba81555da", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ], + "response": { + "statusCode": 202, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_joba81555da" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "202": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "update job {job} successfully" + } + } + } + }, + "400": { + "description": "NoVirtualClusterError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoVirtualClusterError": { + "value": { + "code": "NoVirtualClusterError", + "message": "Virtual cluster {vc} is not found." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + }, + "409": { + "description": "ConflictJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ConflictJobError": { + "value": { + "code": "ConflictJobError", + "message": "Job name {job} already exists." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "post /api/v2/jobs" + }, + { + "description": "get /api/v2/jobs", + "tests": [ + { + "operation": { + "tag": "job", + "operationId": "listJobs", + "parameters": [], + "response": { + "statusCode": 200, + "schema": { + "oneOf": [ + { + "type": "array", + "description": "job summary list", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "job name" + }, + "username": { + "type": "string", + "description": "user name or \"unknown\"" + }, + "state": { + "type": "string", + "description": "general job state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "subState": { + "type": "string", + "description": "job state in framework controller", + "enum": [ + "AttemptCreationPending", + "AttemptCreationRequested", + "AttemptPreparing", + "AttemptRunning", + "AttemptDeletionPending", + "AttemptDeletionRequested", + "AttemptDeleting", + "AttemptCompleted", + "Completed" + ] + }, + "executionType": { + "type": "string", + "description": "start or stop", + "enum": [ + "START", + "STOP" + ] + }, + "tags": { + "type": "array", + "description": "tags", + "items": { + "type": "string" + } + }, + "retries": { + "type": "integer", + "description": "job retried times" + }, + "retryDetails": { + "type": "object", + "properties": { + "user": { + "type": "integer" + }, + "platform": { + "type": "integer" + }, + "resource": { + "type": "integer" + } + } + }, + "retryDelayTime": { + "type": "integer", + "nullable": true, + "description": "retry delay time" + }, + "submissionTime": { + "type": "integer", + "description": "job submitted time, in number of milliseconds since the Unix Epoch." + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "job created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time, in number of milliseconds since the Unix Epoch." + }, + "appExitCode": { + "type": "integer", + "nullable": true, + "description": "job exit code" + }, + "virtualCluster": { + "type": "string", + "description": "virtual cluster to which the job submitted, or \"unknown\"" + }, + "totalGpuNumber": { + "type": "integer", + "description": "total gpu number used in the job" + }, + "totalTaskNumber": { + "type": "integer", + "description": "total task number used in the job" + }, + "totalTaskRoleNumber": { + "type": "integer", + "description": "total task role number used in the job" + }, + "debugId": { + "type": "string", + "description": "md5 hash name for the job in framework controller, used for debug purpose" + } + }, + "required": [ + "name", + "username", + "virtualCluster", + "state", + "subState", + "executionType", + "retries", + "createdTime", + "completedTime", + "appExitCode" + ] + } + }, + { + "type": "object", + "properties": { + "totalCount": { + "type": "number", + "description": "total count of jobs with given filters" + }, + "data": { + "type": "array", + "description": "job summary list", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "job name" + }, + "username": { + "type": "string", + "description": "user name or \"unknown\"" + }, + "state": { + "type": "string", + "description": "general job state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "subState": { + "type": "string", + "description": "job state in framework controller", + "enum": [ + "AttemptCreationPending", + "AttemptCreationRequested", + "AttemptPreparing", + "AttemptRunning", + "AttemptDeletionPending", + "AttemptDeletionRequested", + "AttemptDeleting", + "AttemptCompleted", + "Completed" + ] + }, + "executionType": { + "type": "string", + "description": "start or stop", + "enum": [ + "START", + "STOP" + ] + }, + "tags": { + "type": "array", + "description": "tags", + "items": { + "type": "string" + } + }, + "retries": { + "type": "integer", + "description": "job retried times" + }, + "retryDetails": { + "type": "object", + "properties": { + "user": { + "type": "integer" + }, + "platform": { + "type": "integer" + }, + "resource": { + "type": "integer" + } + } + }, + "retryDelayTime": { + "type": "integer", + "nullable": true, + "description": "retry delay time" + }, + "submissionTime": { + "type": "integer", + "description": "job submitted time, in number of milliseconds since the Unix Epoch." + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "job created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time, in number of milliseconds since the Unix Epoch." + }, + "appExitCode": { + "type": "integer", + "nullable": true, + "description": "job exit code" + }, + "virtualCluster": { + "type": "string", + "description": "virtual cluster to which the job submitted, or \"unknown\"" + }, + "totalGpuNumber": { + "type": "integer", + "description": "total gpu number used in the job" + }, + "totalTaskNumber": { + "type": "integer", + "description": "total task number used in the job" + }, + "totalTaskRoleNumber": { + "type": "integer", + "description": "total task role number used in the job" + }, + "debugId": { + "type": "string", + "description": "md5 hash name for the job in framework controller, used for debug purpose" + } + }, + "required": [ + "name", + "username", + "virtualCluster", + "state", + "subState", + "executionType", + "retries", + "createdTime", + "completedTime", + "appExitCode" + ] + } + } + }, + "required": [ + "totalCount", + "data" + ] + } + ] + }, + "contentType": "application/json" + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "array", + "description": "job summary list", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "job name" + }, + "username": { + "type": "string", + "description": "user name or \"unknown\"" + }, + "state": { + "type": "string", + "description": "general job state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "subState": { + "type": "string", + "description": "job state in framework controller", + "enum": [ + "AttemptCreationPending", + "AttemptCreationRequested", + "AttemptPreparing", + "AttemptRunning", + "AttemptDeletionPending", + "AttemptDeletionRequested", + "AttemptDeleting", + "AttemptCompleted", + "Completed" + ] + }, + "executionType": { + "type": "string", + "description": "start or stop", + "enum": [ + "START", + "STOP" + ] + }, + "tags": { + "type": "array", + "description": "tags", + "items": { + "type": "string" + } + }, + "retries": { + "type": "integer", + "description": "job retried times" + }, + "retryDetails": { + "type": "object", + "properties": { + "user": { + "type": "integer" + }, + "platform": { + "type": "integer" + }, + "resource": { + "type": "integer" + } + } + }, + "retryDelayTime": { + "type": "integer", + "nullable": true, + "description": "retry delay time" + }, + "submissionTime": { + "type": "integer", + "description": "job submitted time, in number of milliseconds since the Unix Epoch." + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "job created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time, in number of milliseconds since the Unix Epoch." + }, + "appExitCode": { + "type": "integer", + "nullable": true, + "description": "job exit code" + }, + "virtualCluster": { + "type": "string", + "description": "virtual cluster to which the job submitted, or \"unknown\"" + }, + "totalGpuNumber": { + "type": "integer", + "description": "total gpu number used in the job" + }, + "totalTaskNumber": { + "type": "integer", + "description": "total task number used in the job" + }, + "totalTaskRoleNumber": { + "type": "integer", + "description": "total task role number used in the job" + }, + "debugId": { + "type": "string", + "description": "md5 hash name for the job in framework controller, used for debug purpose" + } + }, + "required": [ + "name", + "username", + "virtualCluster", + "state", + "subState", + "executionType", + "retries", + "createdTime", + "completedTime", + "appExitCode" + ] + } + }, + { + "type": "object", + "properties": { + "totalCount": { + "type": "number", + "description": "total count of jobs with given filters" + }, + "data": { + "type": "array", + "description": "job summary list", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "job name" + }, + "username": { + "type": "string", + "description": "user name or \"unknown\"" + }, + "state": { + "type": "string", + "description": "general job state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "subState": { + "type": "string", + "description": "job state in framework controller", + "enum": [ + "AttemptCreationPending", + "AttemptCreationRequested", + "AttemptPreparing", + "AttemptRunning", + "AttemptDeletionPending", + "AttemptDeletionRequested", + "AttemptDeleting", + "AttemptCompleted", + "Completed" + ] + }, + "executionType": { + "type": "string", + "description": "start or stop", + "enum": [ + "START", + "STOP" + ] + }, + "tags": { + "type": "array", + "description": "tags", + "items": { + "type": "string" + } + }, + "retries": { + "type": "integer", + "description": "job retried times" + }, + "retryDetails": { + "type": "object", + "properties": { + "user": { + "type": "integer" + }, + "platform": { + "type": "integer" + }, + "resource": { + "type": "integer" + } + } + }, + "retryDelayTime": { + "type": "integer", + "nullable": true, + "description": "retry delay time" + }, + "submissionTime": { + "type": "integer", + "description": "job submitted time, in number of milliseconds since the Unix Epoch." + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "job created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time, in number of milliseconds since the Unix Epoch." + }, + "appExitCode": { + "type": "integer", + "nullable": true, + "description": "job exit code" + }, + "virtualCluster": { + "type": "string", + "description": "virtual cluster to which the job submitted, or \"unknown\"" + }, + "totalGpuNumber": { + "type": "integer", + "description": "total gpu number used in the job" + }, + "totalTaskNumber": { + "type": "integer", + "description": "total task number used in the job" + }, + "totalTaskRoleNumber": { + "type": "integer", + "description": "total task role number used in the job" + }, + "debugId": { + "type": "string", + "description": "md5 hash name for the job in framework controller, used for debug purpose" + } + }, + "required": [ + "name", + "username", + "virtualCluster", + "state", + "subState", + "executionType", + "retries", + "createdTime", + "completedTime", + "appExitCode" + ] + } + } + }, + "required": [ + "totalCount", + "data" + ] + } + ] + }, + "example": [ + { + "protocolVersion": "2", + "name": "job name", + "username": "user name", + "state": "SUCCEEDED", + "subState": "Completed", + "executionType": "STOP", + "tags": [ + "abnormal", + "low_gpu_utilization" + ], + "retries": 0, + "submissionTime": 0, + "createdTime": 0, + "completedTime": 0, + "appExitCode": 0, + "virtualCluster": "unknown" + } + ] + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + } + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_job01272f47", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + } + ], + "tests": [ + { + "description": "Get a job detail", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job01272f47" + } + ], + "tag": "job", + "operationId": "getJob", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "description": "job details", + "properties": { + "name": { + "type": "string", + "description": "job name" + }, + "tags": { + "type": "array", + "description": "tags", + "items": { + "type": "string" + } + }, + "jobStatus": { + "type": "object", + "description": "job status", + "properties": { + "username": { + "type": "string", + "description": "user name or \"unknown\"" + }, + "state": { + "type": "string", + "description": "general job state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "subState": { + "type": "string", + "description": "job state in framework controller", + "enum": [ + "AttemptCreationPending", + "AttemptCreationRequested", + "AttemptPreparing", + "AttemptRunning", + "AttemptDeletionPending", + "AttemptDeletionRequested", + "AttemptDeleting", + "AttemptCompleted", + "Completed" + ] + }, + "executionType": { + "type": "string", + "description": "start or stop", + "enum": [ + "START", + "STOP" + ] + }, + "retries": { + "type": "integer", + "description": "job retried times" + }, + "retryDetails": { + "type": "object", + "properties": { + "user": { + "type": "integer" + }, + "platform": { + "type": "integer" + }, + "resource": { + "type": "integer" + } + } + }, + "retryDelayTime": { + "type": "integer", + "nullable": true, + "description": "retry delay time" + }, + "submissionTime": { + "type": "integer", + "description": "job submitted time, in number of milliseconds since the Unix Epoch." + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "job created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time, in number of milliseconds since the Unix Epoch." + }, + "appId": { + "type": "string", + "description": "unique id for the job" + }, + "appLaunchedTime": { + "type": "integer", + "nullable": true, + "description": "job launched time for last attempt, in number of milliseconds since the Unix Epoch." + }, + "appCompletedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time for last attempt, in number of milliseconds since the Unix Epoch. to get durations for last attempt:\n wholeDuration = completedTime - createdTime;\n runningDuration = appCompletedTime - appLaunchedTime;\n waitingDuration = wholeDuration - runningDuration.\nto get durations for all attempts:\n runningDuration = sum(appCompletedTime - appLaunchedTime) for all attempts.\n" + }, + "appExitCode": { + "type": "integer", + "nullable": true, + "description": "job exit code" + }, + "appExitSpec": { + "type": "object", + "nullable": true, + "description": "job exit spec", + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "appExitDiagnostics": { + "type": "string", + "nullable": true, + "description": "job exit diagnostics" + }, + "appExitMessages": { + "type": "object", + "nullable": true, + "properties": { + "container": { + "type": "string", + "nullable": true + }, + "runtime": { + "type": "string", + "nullable": true + }, + "launcher": { + "type": "string", + "nullable": true + } + } + }, + "appExitTriggerMessage": { + "type": "string", + "nullable": true, + "description": "job completion message" + }, + "appExitTriggerTaskRoleName": { + "type": "string", + "nullable": true, + "description": "task role name which triggered job completion" + }, + "appExitTriggerTaskIndex": { + "type": "integer", + "nullable": true, + "description": "task index which triggered job completion" + }, + "appExitType": { + "type": "string", + "nullable": true, + "description": "job completion type" + }, + "virtualCluster": { + "type": "string", + "description": "virtual cluster to which the job submitted, or \"unknown\"" + } + }, + "required": [ + "username", + "virtualCluster", + "state", + "subState", + "executionType", + "retries", + "createdTime", + "completedTime", + "appLaunchedTime", + "appCompletedTime", + "appExitCode" + ] + }, + "taskRoles": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "task role status", + "properties": { + "taskRoleStatus": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "task role name" + } + }, + "required": [ + "name" + ] + }, + "taskStatuses": { + "type": "array", + "description": "task statuses in the task role", + "items": { + "type": "object", + "properties": { + "taskIndex": { + "type": "integer", + "description": "task index" + }, + "taskState": { + "type": "string", + "description": "task state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "containerId": { + "type": "string", + "nullable": true, + "description": "uid of the task container" + }, + "containerIp": { + "type": "string", + "nullable": true, + "description": "ip of the task container" + }, + "containerNodeName": { + "type": "string", + "nullable": true, + "description": "node name of task container" + }, + "containerPorts": { + "type": "object", + "description": "ports of the task container" + }, + "containerGpus": { + "type": "string", + "nullable": true, + "description": "gpu of the task container" + }, + "containerLog": { + "type": "string", + "description": "log url of the task container" + }, + "containerExitCode": { + "type": "integer", + "nullable": true, + "description": "exit code the task container" + }, + "containerExitSpec": { + "type": "object", + "nullable": true, + "description": "container exit spec", + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "containerExitDiagnostics": { + "type": "string", + "nullable": true, + "description": "container exit diagnostics" + }, + "retries": { + "type": "integer" + }, + "accountableRetries": { + "type": "integer" + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "task created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "task completion time, in number of milliseconds since the Unix Epoch." + }, + "currentAttemptLaunchedTime": { + "type": "integer", + "nullable": true, + "description": "the current attempt launched time, in number of milliseconds since the Unix Epoch." + }, + "currentAttemptCompletedTime": { + "type": "integer", + "nullable": true, + "description": "the current attempt completion time, in number of milliseconds since the Unix Epoch." + }, + "hived": { + "type": "object", + "nullable": true + } + } + } + } + }, + "required": [ + "taskRoleStatus", + "taskStatuses" + ] + } + }, + "debugId": { + "type": "string", + "description": "md5 hash name for the job in framework controller, used for debug purpose" + } + }, + "required": [ + "name", + "jobStatus", + "taskRoles" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "Get nonexist job detail", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_nonexist_job" + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + } + } + } + } + } + }, + "tag": "job", + "operationId": "getJob" + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job01272f47" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "job details", + "properties": { + "name": { + "type": "string", + "description": "job name" + }, + "tags": { + "type": "array", + "description": "tags", + "items": { + "type": "string" + } + }, + "jobStatus": { + "type": "object", + "description": "job status", + "properties": { + "username": { + "type": "string", + "description": "user name or \"unknown\"" + }, + "state": { + "type": "string", + "description": "general job state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "subState": { + "type": "string", + "description": "job state in framework controller", + "enum": [ + "AttemptCreationPending", + "AttemptCreationRequested", + "AttemptPreparing", + "AttemptRunning", + "AttemptDeletionPending", + "AttemptDeletionRequested", + "AttemptDeleting", + "AttemptCompleted", + "Completed" + ] + }, + "executionType": { + "type": "string", + "description": "start or stop", + "enum": [ + "START", + "STOP" + ] + }, + "retries": { + "type": "integer", + "description": "job retried times" + }, + "retryDetails": { + "type": "object", + "properties": { + "user": { + "type": "integer" + }, + "platform": { + "type": "integer" + }, + "resource": { + "type": "integer" + } + } + }, + "retryDelayTime": { + "type": "integer", + "nullable": true, + "description": "retry delay time" + }, + "submissionTime": { + "type": "integer", + "description": "job submitted time, in number of milliseconds since the Unix Epoch." + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "job created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time, in number of milliseconds since the Unix Epoch." + }, + "appId": { + "type": "string", + "description": "unique id for the job" + }, + "appLaunchedTime": { + "type": "integer", + "nullable": true, + "description": "job launched time for last attempt, in number of milliseconds since the Unix Epoch." + }, + "appCompletedTime": { + "type": "integer", + "nullable": true, + "description": "job completed time for last attempt, in number of milliseconds since the Unix Epoch. to get durations for last attempt:\n wholeDuration = completedTime - createdTime;\n runningDuration = appCompletedTime - appLaunchedTime;\n waitingDuration = wholeDuration - runningDuration.\nto get durations for all attempts:\n runningDuration = sum(appCompletedTime - appLaunchedTime) for all attempts.\n" + }, + "appExitCode": { + "type": "integer", + "nullable": true, + "description": "job exit code" + }, + "appExitSpec": { + "type": "object", + "nullable": true, + "description": "job exit spec", + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "appExitDiagnostics": { + "type": "string", + "nullable": true, + "description": "job exit diagnostics" + }, + "appExitMessages": { + "type": "object", + "nullable": true, + "properties": { + "container": { + "type": "string", + "nullable": true + }, + "runtime": { + "type": "string", + "nullable": true + }, + "launcher": { + "type": "string", + "nullable": true + } + } + }, + "appExitTriggerMessage": { + "type": "string", + "nullable": true, + "description": "job completion message" + }, + "appExitTriggerTaskRoleName": { + "type": "string", + "nullable": true, + "description": "task role name which triggered job completion" + }, + "appExitTriggerTaskIndex": { + "type": "integer", + "nullable": true, + "description": "task index which triggered job completion" + }, + "appExitType": { + "type": "string", + "nullable": true, + "description": "job completion type" + }, + "virtualCluster": { + "type": "string", + "description": "virtual cluster to which the job submitted, or \"unknown\"" + } + }, + "required": [ + "username", + "virtualCluster", + "state", + "subState", + "executionType", + "retries", + "createdTime", + "completedTime", + "appLaunchedTime", + "appCompletedTime", + "appExitCode" + ] + }, + "taskRoles": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "task role status", + "properties": { + "taskRoleStatus": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "task role name" + } + }, + "required": [ + "name" + ] + }, + "taskStatuses": { + "type": "array", + "description": "task statuses in the task role", + "items": { + "type": "object", + "properties": { + "taskIndex": { + "type": "integer", + "description": "task index" + }, + "taskState": { + "type": "string", + "description": "task state", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "containerId": { + "type": "string", + "nullable": true, + "description": "uid of the task container" + }, + "containerIp": { + "type": "string", + "nullable": true, + "description": "ip of the task container" + }, + "containerNodeName": { + "type": "string", + "nullable": true, + "description": "node name of task container" + }, + "containerPorts": { + "type": "object", + "description": "ports of the task container" + }, + "containerGpus": { + "type": "string", + "nullable": true, + "description": "gpu of the task container" + }, + "containerLog": { + "type": "string", + "description": "log url of the task container" + }, + "containerExitCode": { + "type": "integer", + "nullable": true, + "description": "exit code the task container" + }, + "containerExitSpec": { + "type": "object", + "nullable": true, + "description": "container exit spec", + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "containerExitDiagnostics": { + "type": "string", + "nullable": true, + "description": "container exit diagnostics" + }, + "retries": { + "type": "integer" + }, + "accountableRetries": { + "type": "integer" + }, + "createdTime": { + "type": "integer", + "nullable": true, + "description": "task created time, in number of milliseconds since the Unix Epoch." + }, + "completedTime": { + "type": "integer", + "nullable": true, + "description": "task completion time, in number of milliseconds since the Unix Epoch." + }, + "currentAttemptLaunchedTime": { + "type": "integer", + "nullable": true, + "description": "the current attempt launched time, in number of milliseconds since the Unix Epoch." + }, + "currentAttemptCompletedTime": { + "type": "integer", + "nullable": true, + "description": "the current attempt completion time, in number of milliseconds since the Unix Epoch." + }, + "hived": { + "type": "object", + "nullable": true + } + } + } + } + }, + "required": [ + "taskRoleStatus", + "taskStatuses" + ] + } + }, + "debugId": { + "type": "string", + "description": "md5 hash name for the job in framework controller, used for debug purpose" + } + }, + "required": [ + "name", + "jobStatus", + "taskRoles" + ] + }, + "example": { + "name": "job name", + "tags": [ + "abnormal", + "low_gpu_utilization" + ], + "jobStatus": { + "username": "user name", + "state": "SUCCEEDED", + "subState": "Completed", + "executionType": "STOP", + "retries": 0, + "submissionTime": 0, + "createdTime": 0, + "completedTime": 0, + "appId": "id", + "appLaunchedTime": 0, + "appCompletedTime": 0, + "appExitCode": 0, + "virtualCluster": "unknown" + }, + "taskRoles": { + "taskrole": { + "taskRoleStatus": { + "name": "task role name" + }, + "taskStatuses": [ + { + "taskIndex": 0, + "taskState": "SUCCEEDED" + } + ] + } + } + } + } + } + }, + "404": { + "description": "NoJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/jobs/{user}~{job}" + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_job7e10e71d", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + } + ], + "tests": [ + { + "description": "Get a job config", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job7e10e71d" + } + ], + "tag": "job", + "operationId": "getJobConfig", + "response": { + "statusCode": 200, + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "description": "Job protocol specification.", + "properties": { + "type": { + "type": "string", + "description": "Component type, should be \"job\" here.", + "enum": [ + "job" + ], + "example": "job" + }, + "prerequisites": { + "type": "array", + "description": "Each item is the protocol for data, script, dockerimage, or output type.", + "items": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Component type.", + "enum": [ + "dockerimage" + ] + }, + "auth": { + "type": "object", + "description": "Only available when the type is dockerimage.", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string", + "description": "If a password is needed, it should be referenced as a secret." + }, + "registryuri": { + "type": "string" + } + } + }, + "uri": { + "type": "string" + } + }, + "required": [ + "name", + "type", + "uri" + ] + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Component type.", + "enum": [ + "script", + "output" + ] + }, + "uri": { + "type": "string" + } + }, + "required": [ + "name", + "type", + "uri" + ] + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Component type.", + "enum": [ + "data" + ] + }, + "uri": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "required": [ + "type", + "uri" + ] + } + ] + } + ] + }, + "minItems": 1, + "example": [ + { + "protocolVersion": 2, + "name": "tf_example", + "type": "dockerimage", + "version": "latest", + "contributor": "Alice", + "description": "python3.5, tensorflow", + "auth": { + "username": "user", + "password": "<% $secrets.docker_password %>", + "registryuri": "openpai.azurecr.io" + }, + "uri": "openpai/pai.example.tensorflow" + }, + { + "protocolVersion": 2, + "name": "tensorflow_cifar10_model", + "type": "output", + "version": "latest", + "contributor": "Alice", + "description": "cifar10 data output", + "uri": "hdfs://10.151.40.179:9000/core/cifar10_model" + }, + { + "protocolVersion": 2, + "name": "tensorflow_cnnbenchmarks", + "type": "script", + "version": "84820935288cab696c9c2ac409cbd46a1f24723d", + "contributor": "MaggieQi", + "description": "tensorflow benchmarks", + "uri": "github.com/MaggieQi/benchmarks" + }, + { + "protocolVersion": 2, + "name": "cifar10", + "type": "data", + "version": "latest", + "contributor": "Alice", + "description": "cifar10 dataset, image classification", + "uri": [ + "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz" + ] + } + ] + }, + "parameters": { + "type": "object", + "description": "If specified, the whole parameters object can be referenced as `$parameters`.\nScope of reference `$parameters`: the reference is shared among all task roles.\nSpecify name and value of all the referencable parameters that will be used in the whole job template.\nCan be referenced by `<% $parameters.param1 %>`, `<% $parameters.param2 %>`.\n", + "additionalProperties": true, + "example": { + "model": "resnet20", + "batchsize": 32 + } + }, + "secrets": { + "type": "object", + "description": "If sensitive information including password or API key is needed in the protocol,\nit should be specified here in secrets section and referenced as `$secrets`.\nScope of reference `$secrets`: the reference is shared among all task roles and docker image's `auth` field.\nA system that supports PAI protocol should keep the secret information away from\nunauthorized users (how to define unauthorized user is out of the scope of this protocol).\nFor example, the yaml file used for job cloning, the stdout/stderr should protect all information marked as secrets.\nSpecify name and value of all secrets that will be used in the whole job template.\nCan be referenced by `<% $secrets.secret1 %>`, `<% $secrets.secret2 %>`.\n", + "additionalProperties": true, + "example": { + "docker_password": "password", + "github_token": "cGFzc3dvcmQ=" + } + }, + "jobRetryCount": { + "type": "integer", + "description": "Default is 0.", + "minimum": 0, + "example": 1 + }, + "taskRoles": { + "type": "object", + "description": "Task roles are different types of task in the protocol. One job may have one or more task roles,\neach task role has one or more instances, and each instance runs inside one container.\n", + "additionalProperties": { + "type": "object", + "description": "Property name of the taskRole should be in ^[a-zA-Z_][a-zA-Z0-9_]*$ format (valid C variable name).", + "properties": { + "instances": { + "type": "integer", + "description": "Default is 1, instances of a taskRole, no less than 1.", + "minimum": 1 + }, + "completion": { + "type": "object", + "description": "Completion poclicy for the job, https://github.com/Microsoft/pai/blob/master/subprojects/frameworklauncher/yarn/doc/USERMANUAL.md#ApplicationCompletionPolicy.", + "properties": { + "minFailedInstances": { + "type": "integer", + "description": "Number of failed tasks to fail the entire job, -1 or no less than 1,\nif set to -1 means the job will always succeed regardless any task failure.\nDefault is 1.\n" + }, + "minSucceededInstances": { + "type": "integer", + "description": "Number of succeeded tasks to succeed the entire job, -1 or no less than 1,\nif set to -1 means the job will only succeed until all tasks are completed and minFailedInstances is not triggered.\nDefault is task instances.\n" + } + } + }, + "taskRetryCount": { + "type": "integer", + "description": "Default is 0.", + "minimum": 0 + }, + "dockerImage": { + "type": "string", + "description": "Should reference to a dockerimage defined in prerequisites." + }, + "data": { + "type": "string", + "description": "Select data defined in prerequisites, target can be referenced as `$data` in this task role.\nScope of the reference `$data`, '$output', `$script`: the reference is only valid inside this task role.\nUser cannot reference them from another task role. Reference for `$parameters` is global and shared among task roles.\n" + }, + "output": { + "type": "string", + "description": "Select output defined in prerequisites, target can be referenced as `$output` in this task role." + }, + "script": { + "type": "string", + "description": "Select script defined in prerequisites, target can be referenced as `$script` in this task role." + }, + "extraContainerOptions": { + "type": "object", + "properties": { + "shmMB": { + "type": "integer", + "description": "Config the /dev/shm in a docker container, https://docs.docker.com/compose/compose-file/#shm_size." + }, + "infiniband": { + "type": "boolean", + "description": "Use InfiniBand devices or not in a docker container." + } + } + }, + "resourcePerInstance": { + "type": "object", + "properties": { + "cpu": { + "type": "integer", + "description": "CPU number, unit is CPU vcore." + }, + "memoryMB": { + "type": "integer", + "description": "Memory number, unit is MB." + }, + "gpu": { + "type": "integer", + "description": "GPU number, unit is GPU card." + }, + "ports": { + "type": "object", + "description": "Optional, only for host network, property name is string in ^[a-zA-Z_][a-zA-Z0-9_]*$ format (valid C variable name).", + "additionalProperties": { + "type": "integer", + "description": "Port number for the port label." + } + } + } + }, + "commands": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "dockerImage", + "resourcePerInstance", + "commands" + ] + }, + "example": { + "worker": { + "instances": 1, + "completion": { + "minFailedInstances": 1, + "minSucceededInstances": 1 + }, + "taskRetryCount": 0, + "dockerImage": "tf_example", + "data": "cifar10", + "output": "tensorflow_cifar10_model", + "script": "tensorflow_cnnbenchmarks", + "extraContainerOptions": { + "shmMB": 64 + }, + "resourcePerInstance": { + "cpu": 2, + "memoryMB": 16384, + "gpu": 4, + "ports": { + "ssh": 1, + "http": 1 + } + }, + "commands": [ + "cd script_<% $script.name %>/scripts/tf_cnn_benchmarks", + "python tf_cnn_benchmarks.py --job_name=worker --local_parameter_device=gpu --variable_update=parameter_server --ps_hosts=$PAI_TASK_ROLE_ps_server_HOST_LIST --worker_hosts=$PAI_TASK_ROLE_worker_HOST_LIST --task_index=$PAI_CURRENT_TASK_ROLE_CURRENT_TASK_INDEX --data_name=<% $data.name %> --data_dir=$PAI_WORK_DIR/data_<% $data.name %> --train_dir=$PAI_WORK_DIR/output_<% $output.name %> --model=<% $parameters.model %> --batch_size=<% $parameters.batchsize %>\n" + ] + }, + "ps_server": { + "instances": 1, + "completion": { + "minFailedInstances": 1, + "minSucceededInstances": -1 + }, + "taskRetryCount": 0, + "dockerImage": "tf_example", + "data": "cifar10", + "output": "tensorflow_cifar10_model", + "script": "tensorflow_cnnbenchmarks", + "extraContainerOptions": { + "shmMB": 64 + }, + "resourcePerInstance": { + "cpu": 2, + "memoryMB": 8192, + "gpu": 0, + "ports": { + "ssh": 1, + "http": 1 + } + }, + "commands": [ + "cd script_<% $script.name %>/scripts/tf_cnn_benchmarks", + "python tf_cnn_benchmarks.py --job_name=ps --local_parameter_device=gpu --variable_update=parameter_server --ps_hosts=$PAI_TASK_ROLE_ps_server_HOST_LIST --worker_hosts=$PAI_TASK_ROLE_worker_HOST_LIST --task_index=$PAI_CURRENT_TASK_ROLE_CURRENT_TASK_INDEX --data_dir=$PAI_WORK_DIR/data_<% $data.name %> --data_name=<% $data.name %> --train_dir=$PAI_WORK_DIR/output_<% $output.name %> --model=<% $parameters.model %> --batch_size=<% $parameters.batchsize %>\n" + ] + } + } + }, + "deployments": { + "type": "array", + "description": "To handle that a component may interact with different component differently, user is encouraged to place the codes handling such difference in the \"deployments\" field,\ne.g., a job may get input data through wget, hdfs -dfs cp, copy, or just directly read from remote storage. This logic can be placed here.\nIn summary, the deployments field is responsible to make sure the job to run properly in a deployment specific runtime environment.\nOne could have many deployments, but only one deployment can be activated at runtime by specifying in \"defaults\". User can choose the deployment and specify in \"defaults\" at submission time.\n", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "taskRoles": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "Property name should be in taskRoles.", + "properties": { + "preCommands": { + "type": "array", + "description": "Execute before the taskRole's command.", + "items": { + "type": "string" + }, + "minItems": 1 + }, + "postCommands": { + "type": "array", + "description": "Execute after the taskRole's command.", + "items": { + "type": "string" + }, + "minItems": 1 + } + } + } + } + } + }, + "required": [ + "name" + ], + "example": [ + { + "name": "prod", + "taskRoles": { + "worker": { + "preCommands": [ + "wget <% $data.uri[0] %> -P data_<% $data.name %>", + "git clone https://<% $script.contributor %>:<% $secrets.github_token %>@<% $script.uri %> script_<% $script.name %> && cd script_<% $script.name %> && git checkout <% $script.version %> && cd ..\n" + ] + }, + "ps_server": { + "preCommands": [ + "wget <% $data.uri[0] %> -P data_<% $data.name %>", + "git clone https://<% $script.contributor %>:<% $secrets.github_token %>@<% $script.uri %> script_<% $script.name %> && cd script_<% $script.name %> && git checkout <% $script.version %> && cd ..\n" + ], + "postCommands": [ + "hdfs dfs -cp output_<% $output.name %> <% $output.uri %>" + ] + } + } + } + ] + }, + "defaults": { + "type": "object", + "description": "Optional, default cluster specific settings.", + "properties": { + "virtualCluster": { + "type": "string" + }, + "deployment": { + "type": "string", + "description": "Should reference to deployment defined in deployments." + } + }, + "example": { + "deployment": "prod" + } + }, + "extras": { + "type": "object", + "description": "Extra field, save any information that plugin may use.", + "properties": { + "submitFrom": { + "type": "string", + "example": "submit-job-v2" + }, + "gangAllocation": { + "type": "boolean", + "description": "Gang scheduling or not.", + "example": true + }, + "hivedScheduler": { + "type": "object", + "description": "Hived scheduler configurations.", + "properties": { + "jobPriorityClass": { + "type": "string", + "description": "Priority class for the job, oppo is the lowest priority.", + "enum": [ + "crit", + "prod", + "test", + "oppo" + ] + }, + "taskRoles": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "skuType": { + "type": "string" + }, + "affinityGroupName": { + "type": "string" + } + } + } + } + }, + "example": null + } + } + } + }, + "required": [ + "protocolVersion", + "name", + "type", + "prerequisites", + "taskRoles" + ] + } + ] + }, + "contentType": "text/yaml" + } + } + }, + { + "description": "Get nonexist job config", + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_nonexist_job" + } + ], + "response": { + "statusCode": 404, + "schema": { + "description": "NoJobError or NoJobConfigError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "NoJobConfigError": { + "value": { + "code": "NoJobConfigError", + "message": "Config of job {job} is not found." + } + } + } + } + } + } + }, + "tag": "job", + "operationId": "getJobConfig" + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job7e10e71d" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "text/yaml": { + "schema": { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "description": "Job protocol specification.", + "properties": { + "type": { + "type": "string", + "description": "Component type, should be \"job\" here.", + "enum": [ + "job" + ], + "example": "job" + }, + "prerequisites": { + "type": "array", + "description": "Each item is the protocol for data, script, dockerimage, or output type.", + "items": { + "oneOf": [ + { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Component type.", + "enum": [ + "dockerimage" + ] + }, + "auth": { + "type": "object", + "description": "Only available when the type is dockerimage.", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string", + "description": "If a password is needed, it should be referenced as a secret." + }, + "registryuri": { + "type": "string" + } + } + }, + "uri": { + "type": "string" + } + }, + "required": [ + "name", + "type", + "uri" + ] + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Component type.", + "enum": [ + "script", + "output" + ] + }, + "uri": { + "type": "string" + } + }, + "required": [ + "name", + "type", + "uri" + ] + } + ] + }, + { + "allOf": [ + { + "type": "object", + "properties": { + "protocolVersion": { + "oneOf": [ + { + "type": "number", + "enum": [ + 2 + ] + }, + { + "type": "string", + "enum": [ + "2" + ] + } + ], + "description": "Protocol version, current version is 2.", + "example": 2 + }, + "name": { + "type": "string", + "description": "String in ^[a-zA-Z0-9_-]+$ format, no longer than 255 characters.", + "pattern": "^[a-zA-Z0-9_-]+$", + "minLength": 1, + "maxLength": 255, + "example": "tensorflow_distributed_training" + }, + "version": { + "type": "string", + "description": "Component version, default is latest.", + "example": "v1.0" + }, + "contributor": { + "type": "string", + "example": "OpenPAI" + }, + "description": { + "type": "string", + "example": "Here is the description." + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Component type.", + "enum": [ + "data" + ] + }, + "uri": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "required": [ + "type", + "uri" + ] + } + ] + } + ] + }, + "minItems": 1, + "example": [ + { + "protocolVersion": 2, + "name": "tf_example", + "type": "dockerimage", + "version": "latest", + "contributor": "Alice", + "description": "python3.5, tensorflow", + "auth": { + "username": "user", + "password": "<% $secrets.docker_password %>", + "registryuri": "openpai.azurecr.io" + }, + "uri": "openpai/pai.example.tensorflow" + }, + { + "protocolVersion": 2, + "name": "tensorflow_cifar10_model", + "type": "output", + "version": "latest", + "contributor": "Alice", + "description": "cifar10 data output", + "uri": "hdfs://10.151.40.179:9000/core/cifar10_model" + }, + { + "protocolVersion": 2, + "name": "tensorflow_cnnbenchmarks", + "type": "script", + "version": "84820935288cab696c9c2ac409cbd46a1f24723d", + "contributor": "MaggieQi", + "description": "tensorflow benchmarks", + "uri": "github.com/MaggieQi/benchmarks" + }, + { + "protocolVersion": 2, + "name": "cifar10", + "type": "data", + "version": "latest", + "contributor": "Alice", + "description": "cifar10 dataset, image classification", + "uri": [ + "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz" + ] + } + ] + }, + "parameters": { + "type": "object", + "description": "If specified, the whole parameters object can be referenced as `$parameters`.\nScope of reference `$parameters`: the reference is shared among all task roles.\nSpecify name and value of all the referencable parameters that will be used in the whole job template.\nCan be referenced by `<% $parameters.param1 %>`, `<% $parameters.param2 %>`.\n", + "additionalProperties": true, + "example": { + "model": "resnet20", + "batchsize": 32 + } + }, + "secrets": { + "type": "object", + "description": "If sensitive information including password or API key is needed in the protocol,\nit should be specified here in secrets section and referenced as `$secrets`.\nScope of reference `$secrets`: the reference is shared among all task roles and docker image's `auth` field.\nA system that supports PAI protocol should keep the secret information away from\nunauthorized users (how to define unauthorized user is out of the scope of this protocol).\nFor example, the yaml file used for job cloning, the stdout/stderr should protect all information marked as secrets.\nSpecify name and value of all secrets that will be used in the whole job template.\nCan be referenced by `<% $secrets.secret1 %>`, `<% $secrets.secret2 %>`.\n", + "additionalProperties": true, + "example": { + "docker_password": "password", + "github_token": "cGFzc3dvcmQ=" + } + }, + "jobRetryCount": { + "type": "integer", + "description": "Default is 0.", + "minimum": 0, + "example": 1 + }, + "taskRoles": { + "type": "object", + "description": "Task roles are different types of task in the protocol. One job may have one or more task roles,\neach task role has one or more instances, and each instance runs inside one container.\n", + "additionalProperties": { + "type": "object", + "description": "Property name of the taskRole should be in ^[a-zA-Z_][a-zA-Z0-9_]*$ format (valid C variable name).", + "properties": { + "instances": { + "type": "integer", + "description": "Default is 1, instances of a taskRole, no less than 1.", + "minimum": 1 + }, + "completion": { + "type": "object", + "description": "Completion poclicy for the job, https://github.com/Microsoft/pai/blob/master/subprojects/frameworklauncher/yarn/doc/USERMANUAL.md#ApplicationCompletionPolicy.", + "properties": { + "minFailedInstances": { + "type": "integer", + "description": "Number of failed tasks to fail the entire job, -1 or no less than 1,\nif set to -1 means the job will always succeed regardless any task failure.\nDefault is 1.\n" + }, + "minSucceededInstances": { + "type": "integer", + "description": "Number of succeeded tasks to succeed the entire job, -1 or no less than 1,\nif set to -1 means the job will only succeed until all tasks are completed and minFailedInstances is not triggered.\nDefault is task instances.\n" + } + } + }, + "taskRetryCount": { + "type": "integer", + "description": "Default is 0.", + "minimum": 0 + }, + "dockerImage": { + "type": "string", + "description": "Should reference to a dockerimage defined in prerequisites." + }, + "data": { + "type": "string", + "description": "Select data defined in prerequisites, target can be referenced as `$data` in this task role.\nScope of the reference `$data`, '$output', `$script`: the reference is only valid inside this task role.\nUser cannot reference them from another task role. Reference for `$parameters` is global and shared among task roles.\n" + }, + "output": { + "type": "string", + "description": "Select output defined in prerequisites, target can be referenced as `$output` in this task role." + }, + "script": { + "type": "string", + "description": "Select script defined in prerequisites, target can be referenced as `$script` in this task role." + }, + "extraContainerOptions": { + "type": "object", + "properties": { + "shmMB": { + "type": "integer", + "description": "Config the /dev/shm in a docker container, https://docs.docker.com/compose/compose-file/#shm_size." + }, + "infiniband": { + "type": "boolean", + "description": "Use InfiniBand devices or not in a docker container." + } + } + }, + "resourcePerInstance": { + "type": "object", + "properties": { + "cpu": { + "type": "integer", + "description": "CPU number, unit is CPU vcore." + }, + "memoryMB": { + "type": "integer", + "description": "Memory number, unit is MB." + }, + "gpu": { + "type": "integer", + "description": "GPU number, unit is GPU card." + }, + "ports": { + "type": "object", + "description": "Optional, only for host network, property name is string in ^[a-zA-Z_][a-zA-Z0-9_]*$ format (valid C variable name).", + "additionalProperties": { + "type": "integer", + "description": "Port number for the port label." + } + } + } + }, + "commands": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "dockerImage", + "resourcePerInstance", + "commands" + ] + }, + "example": { + "worker": { + "instances": 1, + "completion": { + "minFailedInstances": 1, + "minSucceededInstances": 1 + }, + "taskRetryCount": 0, + "dockerImage": "tf_example", + "data": "cifar10", + "output": "tensorflow_cifar10_model", + "script": "tensorflow_cnnbenchmarks", + "extraContainerOptions": { + "shmMB": 64 + }, + "resourcePerInstance": { + "cpu": 2, + "memoryMB": 16384, + "gpu": 4, + "ports": { + "ssh": 1, + "http": 1 + } + }, + "commands": [ + "cd script_<% $script.name %>/scripts/tf_cnn_benchmarks", + "python tf_cnn_benchmarks.py --job_name=worker --local_parameter_device=gpu --variable_update=parameter_server --ps_hosts=$PAI_TASK_ROLE_ps_server_HOST_LIST --worker_hosts=$PAI_TASK_ROLE_worker_HOST_LIST --task_index=$PAI_CURRENT_TASK_ROLE_CURRENT_TASK_INDEX --data_name=<% $data.name %> --data_dir=$PAI_WORK_DIR/data_<% $data.name %> --train_dir=$PAI_WORK_DIR/output_<% $output.name %> --model=<% $parameters.model %> --batch_size=<% $parameters.batchsize %>\n" + ] + }, + "ps_server": { + "instances": 1, + "completion": { + "minFailedInstances": 1, + "minSucceededInstances": -1 + }, + "taskRetryCount": 0, + "dockerImage": "tf_example", + "data": "cifar10", + "output": "tensorflow_cifar10_model", + "script": "tensorflow_cnnbenchmarks", + "extraContainerOptions": { + "shmMB": 64 + }, + "resourcePerInstance": { + "cpu": 2, + "memoryMB": 8192, + "gpu": 0, + "ports": { + "ssh": 1, + "http": 1 + } + }, + "commands": [ + "cd script_<% $script.name %>/scripts/tf_cnn_benchmarks", + "python tf_cnn_benchmarks.py --job_name=ps --local_parameter_device=gpu --variable_update=parameter_server --ps_hosts=$PAI_TASK_ROLE_ps_server_HOST_LIST --worker_hosts=$PAI_TASK_ROLE_worker_HOST_LIST --task_index=$PAI_CURRENT_TASK_ROLE_CURRENT_TASK_INDEX --data_dir=$PAI_WORK_DIR/data_<% $data.name %> --data_name=<% $data.name %> --train_dir=$PAI_WORK_DIR/output_<% $output.name %> --model=<% $parameters.model %> --batch_size=<% $parameters.batchsize %>\n" + ] + } + } + }, + "deployments": { + "type": "array", + "description": "To handle that a component may interact with different component differently, user is encouraged to place the codes handling such difference in the \"deployments\" field,\ne.g., a job may get input data through wget, hdfs -dfs cp, copy, or just directly read from remote storage. This logic can be placed here.\nIn summary, the deployments field is responsible to make sure the job to run properly in a deployment specific runtime environment.\nOne could have many deployments, but only one deployment can be activated at runtime by specifying in \"defaults\". User can choose the deployment and specify in \"defaults\" at submission time.\n", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "taskRoles": { + "type": "object", + "additionalProperties": { + "type": "object", + "description": "Property name should be in taskRoles.", + "properties": { + "preCommands": { + "type": "array", + "description": "Execute before the taskRole's command.", + "items": { + "type": "string" + }, + "minItems": 1 + }, + "postCommands": { + "type": "array", + "description": "Execute after the taskRole's command.", + "items": { + "type": "string" + }, + "minItems": 1 + } + } + } + } + } + }, + "required": [ + "name" + ], + "example": [ + { + "name": "prod", + "taskRoles": { + "worker": { + "preCommands": [ + "wget <% $data.uri[0] %> -P data_<% $data.name %>", + "git clone https://<% $script.contributor %>:<% $secrets.github_token %>@<% $script.uri %> script_<% $script.name %> && cd script_<% $script.name %> && git checkout <% $script.version %> && cd ..\n" + ] + }, + "ps_server": { + "preCommands": [ + "wget <% $data.uri[0] %> -P data_<% $data.name %>", + "git clone https://<% $script.contributor %>:<% $secrets.github_token %>@<% $script.uri %> script_<% $script.name %> && cd script_<% $script.name %> && git checkout <% $script.version %> && cd ..\n" + ], + "postCommands": [ + "hdfs dfs -cp output_<% $output.name %> <% $output.uri %>" + ] + } + } + } + ] + }, + "defaults": { + "type": "object", + "description": "Optional, default cluster specific settings.", + "properties": { + "virtualCluster": { + "type": "string" + }, + "deployment": { + "type": "string", + "description": "Should reference to deployment defined in deployments." + } + }, + "example": { + "deployment": "prod" + } + }, + "extras": { + "type": "object", + "description": "Extra field, save any information that plugin may use.", + "properties": { + "submitFrom": { + "type": "string", + "example": "submit-job-v2" + }, + "gangAllocation": { + "type": "boolean", + "description": "Gang scheduling or not.", + "example": true + }, + "hivedScheduler": { + "type": "object", + "description": "Hived scheduler configurations.", + "properties": { + "jobPriorityClass": { + "type": "string", + "description": "Priority class for the job, oppo is the lowest priority.", + "enum": [ + "crit", + "prod", + "test", + "oppo" + ] + }, + "taskRoles": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "skuType": { + "type": "string" + }, + "affinityGroupName": { + "type": "string" + } + } + } + } + }, + "example": null + } + } + } + }, + "required": [ + "protocolVersion", + "name", + "type", + "prerequisites", + "taskRoles" + ] + } + ] + }, + "example": { + "protocolVersion": 2, + "name": "jobconfig", + "type": "job", + "version": "1.0", + "prerequisites": [ + { + "name": "image", + "type": "dockerimage", + "uri": "uri" + } + ], + "taskRoles": { + "taskRole": { + "instances": 1, + "dockerImage": "image", + "resourcePerInstance": { + "cpu": 1, + "memoryMB": 1024, + "gpu": 1 + }, + "commands": [ + "commands" + ] + } + } + } + } + } + }, + "404": { + "description": "NoJobError or NoJobConfigError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "NoJobConfigError": { + "value": { + "code": "NoJobConfigError", + "message": "Config of job {job} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/jobs/{user}~{job}/config" + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_jobb1beca00", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + } + ], + "tests": [ + { + "description": "update job execution type to STOP", + "operation": { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_jobb1beca00" + }, + { + "type": "raw", + "value": "STOP" + } + ], + "response": { + "statusCode": 202, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + }, + { + "description": "update job execution type to START", + "operation": { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_jobb1beca00" + }, + { + "type": "raw", + "value": "START" + } + ], + "response": { + "statusCode": 202, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_jobb1beca00" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "202": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "execute job {job} successfully" + } + } + } + }, + "404": { + "description": "NoJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/jobs/{user}~{job}/executionType" + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_job4bd82bdb", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + } + ], + "tests": [ + { + "operation": { + "tag": "job", + "operationId": "addTag", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job4bd82bdb" + }, + { + "type": "raw", + "value": "testTag" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job4bd82bdb" + }, + { + "type": "raw", + "value": "STOP" + } + ] + }, + { + "tag": "job", + "operationId": "deleteTag", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job4bd82bdb" + }, + { + "type": "raw", + "value": "testTag" + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "Add tag {tag} for job {job} successfully." + } + } + } + }, + "404": { + "description": "NoJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "put /api/v2/jobs/{user}~{job}/tag" + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_job908a0d03", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + }, + { + "tag": "job", + "operationId": "addTag", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job908a0d03" + }, + { + "type": "raw", + "value": "testTag" + } + ] + } + ], + "tests": [ + { + "operation": { + "tag": "job", + "operationId": "deleteTag", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job908a0d03" + }, + { + "type": "raw", + "value": "testTag" + } + ], + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job908a0d03" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "example": { + "message": "Delete tag {tag} from job {job} successfully." + } + } + } + }, + "404": { + "description": "NoJobError or NoTagError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "NoTagError": { + "value": { + "code": "NoTagError", + "message": "Tag {tag} is not found for job {job} ." + } + } + } + } + } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "delete /api/v2/jobs/{user}~{job}/tag" + }, + { + "description": "get /api/v2/jobs/{user}~{job}/job-attempts/healthz", + "tests": [ + { + "operation": { + "tag": "job history", + "operationId": "getJobAttemptsHealthz", + "parameters": [], + "response": { + "statusCode": 200 + } + } + } + ], + "schemas": { + "200": { + "description": "OK" + }, + "501": { + "description": "Not healthy" + } + } + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_jobf69e000e", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + } + ], + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_jobf69e000e" + } + ], + "tag": "job history", + "operationId": "getJobAttempts", + "response": { + "statusCode": 200, + "schema": { + "type": "array", + "items": { + "type": "object", + "description": "job attempt", + "properties": { + "jobName": { + "type": "string" + }, + "frameworkName": { + "type": "string" + }, + "uid": { + "type": "string" + }, + "userName": { + "type": "string" + }, + "state": { + "type": "string" + }, + "originState": { + "type": "string", + "nullable": true + }, + "maxAttemptCount": { + "type": "integer" + }, + "attemptIndex": { + "type": "integer", + "nullable": true + }, + "jobStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptCompletedTime": { + "type": "integer", + "nullable": true + }, + "exitCode": { + "type": "integer", + "nullable": true + }, + "exitPhrase": { + "type": "string", + "nullable": true + }, + "exitType": { + "type": "string", + "nullable": true + }, + "exitDiagnostics": { + "type": "object", + "nullable": true, + "properties": { + "diagnosticsSummary": { + "type": "string" + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string" + } + } + }, + "appExitTriggerMessage": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskRoleName": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskIndex": { + "type": "integer", + "nullable": true + }, + "appExitSpec": { + "type": "object", + "nullable": true, + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "appExitDiagnostics": { + "type": "string", + "nullable": true + }, + "appExitMessages": { + "type": "object", + "nullable": true, + "properties": { + "container": { + "type": "string", + "nullable": true + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string", + "nullable": true + } + } + }, + "totalGpuNumber": { + "type": "integer" + }, + "totalTasknumber": { + "type": "integer" + }, + "totalTaskRoleNumber": { + "type": "integer" + }, + "taskRoles": { + "type": "object", + "properties": { + "taskrole": { + "type": "object", + "properties": { + "taskRoleStatus": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "taskStatuses": { + "type": "array", + "items": { + "type": "object", + "properties": { + "taskIndex": { + "type": "integer" + }, + "taskState": { + "type": "string", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "containerId": { + "type": "string", + "nullable": true + }, + "containerIp": { + "type": "string" + }, + "containerGpus": { + "type": "string", + "nullable": true + }, + "containerLog": { + "type": "string" + }, + "containerExitCode": { + "type": "integer", + "nullable": true + } + } + } + } + }, + "required": [ + "taskRoleStatus", + "taskStatuses" + ] + } + } + }, + "isLatest": { + "type": "boolean" + } + } + }, + "description": "job attempts" + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_jobf69e000e" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "description": "job attempt", + "properties": { + "jobName": { + "type": "string" + }, + "frameworkName": { + "type": "string" + }, + "uid": { + "type": "string" + }, + "userName": { + "type": "string" + }, + "state": { + "type": "string" + }, + "originState": { + "type": "string", + "nullable": true + }, + "maxAttemptCount": { + "type": "integer" + }, + "attemptIndex": { + "type": "integer", + "nullable": true + }, + "jobStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptCompletedTime": { + "type": "integer", + "nullable": true + }, + "exitCode": { + "type": "integer", + "nullable": true + }, + "exitPhrase": { + "type": "string", + "nullable": true + }, + "exitType": { + "type": "string", + "nullable": true + }, + "exitDiagnostics": { + "type": "object", + "nullable": true, + "properties": { + "diagnosticsSummary": { + "type": "string" + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string" + } + } + }, + "appExitTriggerMessage": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskRoleName": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskIndex": { + "type": "integer", + "nullable": true + }, + "appExitSpec": { + "type": "object", + "nullable": true, + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "appExitDiagnostics": { + "type": "string", + "nullable": true + }, + "appExitMessages": { + "type": "object", + "nullable": true, + "properties": { + "container": { + "type": "string", + "nullable": true + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string", + "nullable": true + } + } + }, + "totalGpuNumber": { + "type": "integer" + }, + "totalTasknumber": { + "type": "integer" + }, + "totalTaskRoleNumber": { + "type": "integer" + }, + "taskRoles": { + "type": "object", + "properties": { + "taskrole": { + "type": "object", + "properties": { + "taskRoleStatus": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "taskStatuses": { + "type": "array", + "items": { + "type": "object", + "properties": { + "taskIndex": { + "type": "integer" + }, + "taskState": { + "type": "string", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "containerId": { + "type": "string", + "nullable": true + }, + "containerIp": { + "type": "string" + }, + "containerGpus": { + "type": "string", + "nullable": true + }, + "containerLog": { + "type": "string" + }, + "containerExitCode": { + "type": "integer", + "nullable": true + } + } + } + } + }, + "required": [ + "taskRoleStatus", + "taskStatuses" + ] + } + } + }, + "isLatest": { + "type": "boolean" + } + } + }, + "description": "job attempts" + }, + "example": [ + { + "jobName": "jobName", + "frameworkName": "frameworkName", + "uid": "uid", + "userName": "userName", + "state": "SUCCEEDED", + "originState": "Completed", + "maxAttemptCount": 1, + "attemptIndex": 0, + "jobStartedTime": 0, + "attemptStartedTime": 0, + "attemptCompletedTime": 0, + "exitCode": 0, + "exitPhrase": "Succeeded", + "exitType": "Succeeded", + "exitDiagnostics": { + "diagnosticsSummary": "Pod succeeded", + "runtime": null, + "launcher": "Pod succeeded" + }, + "appExitTriggerMessage": "All Tasks are completed", + "appExitTriggerTaskRoleName": "taskrole", + "appExitTriggerTaskIndex": 0, + "appExitSpec": { + "code": 0, + "phrase": "Succeeded", + "issuer": "USER_CONTAINER", + "causer": "USER_CONTAINER", + "type": "USER_SUCCESS", + "stage": "COMPLETING", + "behavior": "UNKNOWN", + "reaction": "NEVER_RETRY", + "repro": [ + "User program exits with exitcode 0" + ] + }, + "appExitDiagnostics": "Pod succeeded", + "appExitMessages": { + "container": null, + "runtime": null, + "launcher": "Pod succeeded" + }, + "totalGpuNumber": 1, + "totalTaskNumber": 1, + "totalTaskRoleNumber": 1, + "taskRoles": { + "taskrole": { + "taskRoleStatus": { + "name": "taskrole" + }, + "taskStatuses": [ + { + "taskIndex": 0, + "taskState": "SUCCEEDED", + "containerId": "", + "containerIp": "", + "containerExitCode": 0 + } + ] + } + }, + "isLatest": true + } + ] + } + } + }, + "404": { + "description": "NoJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + } + } + } + } + }, + "501": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/jobs/{user}~{job}/job-attempts" + }, + { + "before": [ + { + "tag": "job", + "operationId": "createJob", + "parameters": [ + { + "type": "raw", + "value": { + "contributor": "OpenPAI", + "description": "# Serving a TensorFlow MNIST Digit Recognition Model\nThis example shows you how to use TensorFlow Serving components to export a trained TensorFlow model\nand use the standard tensorflow_model_server to serve it on OpenPAI.\nThis example uses the simple Softmax Regression model introduced in the TensorFlow tutorial for handwritten image (MNIST data) classification.\nReference https://www.tensorflow.org/tfx/serving/serving_basic.\n", + "name": "sdk_test_job323e07cd", + "parameters": { + "modelPath": "/tmp/mnist_model" + }, + "prerequisites": [ + { + "contributor": "OpenPAI", + "description": "This is an [example TensorFlow Serving Docker image on OpenPAI](https://github.com/Microsoft/pai/tree/master/examples/serving).\n", + "name": "tf_serving_example", + "protocolVersion": 2, + "type": "dockerimage", + "uri": "openpai/pai.example.tensorflow-serving", + "version": "1.0-r1.4" + } + ], + "protocolVersion": 2, + "taskRoles": { + "worker": { + "commands": [ + "bazel-bin/tensorflow_serving/example/mnist_saved_model <% $parameters.modelPath %>", + "tensorflow_model_server --port=$PAI_CONTAINER_HOST_model_server_PORT_LIST --model_name=mnist --model_base_path=<% $parameters.modelPath %>" + ], + "dockerImage": "tf_serving_example", + "instances": 1, + "resourcePerInstance": { + "cpu": 4, + "gpu": 1, + "memoryMB": 8192, + "ports": { + "model_server": 1 + } + } + } + }, + "type": "job", + "version": "1.0" + } + } + ] + } + ], + "tests": [ + { + "operation": { + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job323e07cd" + }, + { + "type": "raw", + "value": 0 + } + ], + "tag": "job history", + "operationId": "getJobAttempt", + "response": { + "statusCode": 200, + "schema": { + "type": "object", + "description": "job attempt", + "properties": { + "jobName": { + "type": "string" + }, + "frameworkName": { + "type": "string" + }, + "uid": { + "type": "string" + }, + "userName": { + "type": "string" + }, + "state": { + "type": "string" + }, + "originState": { + "type": "string", + "nullable": true + }, + "maxAttemptCount": { + "type": "integer" + }, + "attemptIndex": { + "type": "integer", + "nullable": true + }, + "jobStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptCompletedTime": { + "type": "integer", + "nullable": true + }, + "exitCode": { + "type": "integer", + "nullable": true + }, + "exitPhrase": { + "type": "string", + "nullable": true + }, + "exitType": { + "type": "string", + "nullable": true + }, + "exitDiagnostics": { + "type": "object", + "nullable": true, + "properties": { + "diagnosticsSummary": { + "type": "string" + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string" + } + } + }, + "appExitTriggerMessage": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskRoleName": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskIndex": { + "type": "integer", + "nullable": true + }, + "appExitSpec": { + "type": "object", + "nullable": true, + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "appExitDiagnostics": { + "type": "string", + "nullable": true + }, + "appExitMessages": { + "type": "object", + "nullable": true, + "properties": { + "container": { + "type": "string", + "nullable": true + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string", + "nullable": true + } + } + }, + "totalGpuNumber": { + "type": "integer" + }, + "totalTasknumber": { + "type": "integer" + }, + "totalTaskRoleNumber": { + "type": "integer" + }, + "taskRoles": { + "type": "object", + "properties": { + "taskrole": { + "type": "object", + "properties": { + "taskRoleStatus": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "taskStatuses": { + "type": "array", + "items": { + "type": "object", + "properties": { + "taskIndex": { + "type": "integer" + }, + "taskState": { + "type": "string", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "containerId": { + "type": "string", + "nullable": true + }, + "containerIp": { + "type": "string" + }, + "containerGpus": { + "type": "string", + "nullable": true + }, + "containerLog": { + "type": "string" + }, + "containerExitCode": { + "type": "integer", + "nullable": true + } + } + } + } + }, + "required": [ + "taskRoleStatus", + "taskStatuses" + ] + } + } + }, + "isLatest": { + "type": "boolean" + } + } + }, + "contentType": "application/json" + } + } + } + ], + "after": [ + { + "tag": "job", + "operationId": "updateJobExecutionType", + "parameters": [ + { + "type": "raw", + "value": "sdk_test" + }, + { + "type": "raw", + "value": "sdk_test_job323e07cd" + }, + { + "type": "raw", + "value": "STOP" + } + ] + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "job attempt", + "properties": { + "jobName": { + "type": "string" + }, + "frameworkName": { + "type": "string" + }, + "uid": { + "type": "string" + }, + "userName": { + "type": "string" + }, + "state": { + "type": "string" + }, + "originState": { + "type": "string", + "nullable": true + }, + "maxAttemptCount": { + "type": "integer" + }, + "attemptIndex": { + "type": "integer", + "nullable": true + }, + "jobStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptStartedTime": { + "type": "integer", + "nullable": true + }, + "attemptCompletedTime": { + "type": "integer", + "nullable": true + }, + "exitCode": { + "type": "integer", + "nullable": true + }, + "exitPhrase": { + "type": "string", + "nullable": true + }, + "exitType": { + "type": "string", + "nullable": true + }, + "exitDiagnostics": { + "type": "object", + "nullable": true, + "properties": { + "diagnosticsSummary": { + "type": "string" + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string" + } + } + }, + "appExitTriggerMessage": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskRoleName": { + "type": "string", + "nullable": true + }, + "appExitTriggerTaskIndex": { + "type": "integer", + "nullable": true + }, + "appExitSpec": { + "type": "object", + "nullable": true, + "properties": { + "code": { + "type": "integer" + }, + "phrase": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "causer": { + "type": "string" + }, + "type": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "behavior": { + "type": "string" + }, + "reaction": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "repro": { + "type": "array", + "items": { + "type": "string" + } + }, + "solution": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "appExitDiagnostics": { + "type": "string", + "nullable": true + }, + "appExitMessages": { + "type": "object", + "nullable": true, + "properties": { + "container": { + "type": "string", + "nullable": true + }, + "runtime": { + "type": "object", + "nullable": true, + "properties": { + "exitCode": { + "type": "integer", + "nullable": true + }, + "originUserExitCode": { + "type": "integer", + "nullable": true + }, + "errorLogs": { + "type": "object", + "nullable": true, + "properties": { + "user": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + }, + "name": { + "type": "string" + } + } + }, + "launcher": { + "type": "string", + "nullable": true + } + } + }, + "totalGpuNumber": { + "type": "integer" + }, + "totalTasknumber": { + "type": "integer" + }, + "totalTaskRoleNumber": { + "type": "integer" + }, + "taskRoles": { + "type": "object", + "properties": { + "taskrole": { + "type": "object", + "properties": { + "taskRoleStatus": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "taskStatuses": { + "type": "array", + "items": { + "type": "object", + "properties": { + "taskIndex": { + "type": "integer" + }, + "taskState": { + "type": "string", + "enum": [ + "WAITING", + "RUNNING", + "STOPPING", + "STOPPED", + "SUCCEEDED", + "FAILED", + "UNKNOWN" + ] + }, + "containerId": { + "type": "string", + "nullable": true + }, + "containerIp": { + "type": "string" + }, + "containerGpus": { + "type": "string", + "nullable": true + }, + "containerLog": { + "type": "string" + }, + "containerExitCode": { + "type": "integer", + "nullable": true + } + } + } + } + }, + "required": [ + "taskRoleStatus", + "taskStatuses" + ] + } + } + }, + "isLatest": { + "type": "boolean" + } + } + }, + "example": { + "jobName": "jobName", + "frameworkName": "frameworkName", + "uid": "uid", + "userName": "userName", + "state": "SUCCEEDED", + "originState": "Completed", + "maxAttemptCount": 1, + "attemptIndex": 0, + "jobStartedTime": 0, + "attemptStartedTime": 0, + "attemptCompletedTime": 0, + "exitCode": 0, + "exitPhrase": "Succeeded", + "exitType": "Succeeded", + "exitDiagnostics": { + "diagnosticsSummary": "Pod succeeded", + "runtime": null, + "launcher": "Pod succeeded" + }, + "appExitTriggerMessage": "All Tasks are completed", + "appExitTriggerTaskRoleName": "taskrole", + "appExitTriggerTaskIndex": 0, + "appExitSpec": { + "code": 0, + "phrase": "Succeeded", + "issuer": "USER_CONTAINER", + "causer": "USER_CONTAINER", + "type": "USER_SUCCESS", + "stage": "COMPLETING", + "behavior": "UNKNOWN", + "reaction": "NEVER_RETRY", + "repro": [ + "User program exits with exitcode 0" + ] + }, + "appExitDiagnostics": "Pod succeeded", + "appExitMessages": { + "container": null, + "runtime": null, + "launcher": "Pod succeeded" + }, + "totalGpuNumber": 1, + "totalTaskNumber": 1, + "totalTaskRoleNumber": 1, + "taskRoles": { + "taskrole": { + "taskRoleStatus": { + "name": "taskrole" + }, + "taskStatuses": [ + { + "taskIndex": 0, + "taskState": "SUCCEEDED", + "containerId": "", + "containerIp": "", + "containerExitCode": 0 + } + ] + } + }, + "isLatest": true + } + } + } + }, + "404": { + "description": "NoJobError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "NoJobError": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + } + } + } + } + }, + "501": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnknownError": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + } + } + } + }, + "description": "get /api/v2/jobs/{user}~{job}/job-attempts/{attemptIndex}" + }, + { + "description": "get /api/v2/kubernetes/nodes", + "tests": [ + { + "operation": { + "tag": "kubernetes", + "operationId": "getK8sNodes", + "parameters": [], + "response": { + "statusCode": 200 + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "example": [ + "Please refer to Kubernetes API doc", + "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#list-node-v1-core" + ] + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + } + } + }, + { + "description": "get /api/v2/kubernetes/pods", + "tests": [ + { + "operation": { + "tag": "kubernetes", + "operationId": "getK8sPods", + "parameters": [], + "response": { + "statusCode": 200 + } + } + } + ], + "schemas": { + "200": { + "description": "Succeeded", + "content": { + "application/json": { + "example": [ + "Please refer to Kubernetes API doc", + "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#list-all-namespaces-pod-v1-core" + ] + } + } + }, + "401": { + "description": "UnauthorizedUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "UnauthorizedUserError": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + } + } + }, + "403": { + "description": "ForbiddenUserError", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "BadConfigurationError", + "ConflictJobError", + "ConflictUserError", + "ConflictVcError", + "ForbiddenUserError", + "ForbiddenKeyError", + "IncorrectPasswordError", + "InvalidParametersError", + "NoApiError", + "NoJobError", + "NoJobConfigError", + "NoJobSshInfoError", + "NoUserError", + "NoGroupError", + "NoVirtualClusterError", + "ReadOnlyJobError", + "RemoveAdminError", + "ReadOnlyVcError", + "RemoveRunningVcError", + "UnauthorizedUserError", + "NoEnoughQuotaError", + "NotImplementedError", + "UnknownError" + ] + }, + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "examples": { + "ForbiddenUserError": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "ForbiddenTokenError": { + "value": { + "code": "ForbiddenUserError", + "message": "Applications are not allowed to do this operation." + } + } + } + } + } + } + } + } + ], + "map": { + "getClusterInfo": { + "path": "/api/v2/info", + "method": "get", + "examples": { + "200": { + "name": "PAI RESTful API", + "version": "v1.0.1", + "launcherType": "k8s", + "authnMethod": "basic" + } + } + }, + "getTokens": { + "path": "/api/v2/tokens", + "method": "get", + "examples": { + "200": { + "tokens": [ + "JWT Token Example" + ] + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + }, + "deleteToken": { + "path": "/api/v2/tokens/{token}", + "method": "delete", + "examples": { + "200": { + "message": "revoke successfully" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + } + } + }, + "createApplicationToken": { + "path": "/api/v2/tokens/application", + "method": "post", + "examples": { + "200": { + "token": "JWT Token Example", + "application": true + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + } + } + }, + "oidcLogin": { + "path": "/api/v2/authn/oidc/login", + "method": "get", + "examples": {} + }, + "oidcLogout": { + "path": "/api/v2/authn/oidc/logout", + "method": "get", + "examples": {} + }, + "basicLogin": { + "path": "/api/v2/authn/basic/login", + "method": "post", + "examples": { + "200": { + "token": "JWT Token Example", + "user": "user", + "admin": true + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + } + } + }, + "basicLogout": { + "path": "/api/v2/authn/basic/logout", + "method": "delete", + "examples": { + "200": { + "message": "Logout successfully" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + } + } + }, + "createUser": { + "path": "/api/v2/users", + "method": "post", + "examples": { + "201": { + "message": "User is created successfully" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "409": { + "value": { + "code": "ConflictUserError", + "message": "User name {user} already exists." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getAllUser": { + "path": "/api/v2/users", + "method": "get", + "examples": { + "200": [ + { + "username": "username", + "admin": true, + "virtualCluster": [], + "storageConfig": [], + "email": "email@test.com", + "extension": {} + } + ], + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "updateUser": { + "path": "/api/v2/users", + "method": "put", + "examples": { + "201": { + "message": "update group {username} successfully." + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "updateUserSelf": { + "path": "/api/v2/users/me", + "method": "put", + "examples": { + "201": { + "message": "update group {username} successfully." + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getUser": { + "path": "/api/v2/users/{user}", + "method": "get", + "examples": { + "200": { + "username": "username", + "admin": true, + "virtualCluster": [], + "storageConfig": [], + "email": "email@test.com", + "extension": {} + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "deleteUser": { + "path": "/api/v2/users/{user}", + "method": "delete", + "examples": { + "200": { + "message": "user is removed successfully" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "updateUserGroup": { + "path": "/api/v2/users/{user}/group/", + "method": "put", + "examples": { + "201": { + "message": "User {username} is added into group {groupname}" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "deleteUserGroup": { + "path": "/api/v2/users/{user}/group/", + "method": "delete", + "examples": { + "201": { + "message": "User {username} is removed from group {groupname}" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "updateUserGrouplist": { + "path": "/api/v2/users/{user}/grouplist/", + "method": "put", + "examples": { + "201": { + "message": "update user grouplist successfully." + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoUserError", + "message": "User {user} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getAllGroup": { + "path": "/api/v2/groups", + "method": "get", + "examples": { + "200": [ + { + "groupname": "groupName", + "description": "description", + "externalName": "externalName", + "extension": {} + } + ], + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "createGroup": { + "path": "/api/v2/groups", + "method": "post", + "examples": { + "201": { + "message": "group is created successfully" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "updateGroup": { + "path": "/api/v2/groups", + "method": "put", + "examples": { + "201": { + "message": "update group {groupname} successfully." + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "404": { + "value": { + "code": "NoGroupError", + "message": "Group {groupname} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getGroup": { + "path": "/api/v2/groups/{group}", + "method": "get", + "examples": { + "200": { + "groupname": "groupName", + "description": "description", + "externalName": "externalName", + "extension": {} + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "404": { + "value": { + "code": "NoGroupError", + "message": "Group {groupname} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "deleteGroup": { + "path": "/api/v2/groups/{group}", + "method": "delete", + "examples": { + "201": { + "message": "group is removed successfully" + }, + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getGroupMembers": { + "path": "/api/v2/groups/{group}/userlist", + "method": "get", + "examples": { + "200": [ + { + "username": "username", + "clusterAdmin": false + } + ], + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "listVirtualClusters": { + "path": "/api/v2/virtual-clusters", + "method": "get", + "examples": { + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getVirtualCluster": { + "path": "/api/v2/virtual-clusters/{vc}", + "method": "get", + "examples": { + "200": { + "capacity": 70, + "usedCapacity": 30, + "dedicated": false, + "resourcesUsed": { + "cpu": 1, + "memory": 1024, + "gpu": 1, + "vCores": 1, + "GPUs": 1 + }, + "resourcesGuaranteed": { + "cpu": 2, + "memory": 2048, + "gpu": 2, + "vCores": 2, + "GPUs": 2 + }, + "resourcesTotal": { + "cpu": 2, + "memory": 2048, + "gpu": 2, + "vCores": 2, + "GPUs": 2 + }, + "maxCapacity": 70 + }, + "404": { + "value": { + "code": "NoVirtualClusterError", + "message": "Virtual cluster {vc} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getStorages": { + "path": "/api/v2/storages", + "method": "get", + "examples": { + "200": { + "storages": [ + { + "name": "name", + "share": true, + "volumeName": "volumeName", + "default": true + } + ] + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getStorage": { + "path": "/api/v2/storages/{storage}", + "method": "get", + "examples": { + "200": { + "name": "nfs-storage-name", + "share": true, + "volumeName": "nfs-volume-name", + "default": true, + "type": "nfs", + "data": { + "server": "", + "path": "/data" + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "User {user} is not allowed to access {storage}." + } + }, + "404": { + "value": { + "code": "NoStorageError", + "message": "Storage {storage} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "createJob": { + "path": "/api/v2/jobs", + "method": "post", + "examples": { + "202": { + "message": "update job {job} successfully" + }, + "400": { + "value": { + "code": "NoVirtualClusterError", + "message": "Virtual cluster {vc} is not found." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + }, + "409": { + "value": { + "code": "ConflictJobError", + "message": "Job name {job} already exists." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "listJobs": { + "path": "/api/v2/jobs", + "method": "get", + "examples": { + "200": [ + { + "protocolVersion": "2", + "name": "job name", + "username": "user name", + "state": "SUCCEEDED", + "subState": "Completed", + "executionType": "STOP", + "tags": [ + "abnormal", + "low_gpu_utilization" + ], + "retries": 0, + "submissionTime": 0, + "createdTime": 0, + "completedTime": 0, + "appExitCode": 0, + "virtualCluster": "unknown" + } + ], + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getJob": { + "path": "/api/v2/jobs/{user}~{job}", + "method": "get", + "examples": { + "200": { + "name": "job name", + "tags": [ + "abnormal", + "low_gpu_utilization" + ], + "jobStatus": { + "username": "user name", + "state": "SUCCEEDED", + "subState": "Completed", + "executionType": "STOP", + "retries": 0, + "submissionTime": 0, + "createdTime": 0, + "completedTime": 0, + "appId": "id", + "appLaunchedTime": 0, + "appCompletedTime": 0, + "appExitCode": 0, + "virtualCluster": "unknown" + }, + "taskRoles": { + "taskrole": { + "taskRoleStatus": { + "name": "task role name" + }, + "taskStatuses": [ + { + "taskIndex": 0, + "taskState": "SUCCEEDED" + } + ] + } + } + }, + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getJobConfig": { + "path": "/api/v2/jobs/{user}~{job}/config", + "method": "get", + "examples": { + "200": { + "protocolVersion": 2, + "name": "jobconfig", + "type": "job", + "version": "1.0", + "prerequisites": [ + { + "name": "image", + "type": "dockerimage", + "uri": "uri" + } + ], + "taskRoles": { + "taskRole": { + "instances": 1, + "dockerImage": "image", + "resourcePerInstance": { + "cpu": 1, + "memoryMB": 1024, + "gpu": 1 + }, + "commands": [ + "commands" + ] + } + } + }, + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "updateJobExecutionType": { + "path": "/api/v2/jobs/{user}~{job}/executionType", + "method": "put", + "examples": { + "202": { + "message": "execute job {job} successfully" + }, + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "addTag": { + "path": "/api/v2/jobs/{user}~{job}/tag", + "method": "put", + "examples": { + "200": { + "message": "Add tag {tag} for job {job} successfully." + }, + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "deleteTag": { + "path": "/api/v2/jobs/{user}~{job}/tag", + "method": "delete", + "examples": { + "200": { + "message": "Delete tag {tag} from job {job} successfully." + }, + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "500": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getJobAttemptsHealthz": { + "path": "/api/v2/jobs/{user}~{job}/job-attempts/healthz", + "method": "get", + "examples": {} + }, + "getJobAttempts": { + "path": "/api/v2/jobs/{user}~{job}/job-attempts", + "method": "get", + "examples": { + "200": [ + { + "jobName": "jobName", + "frameworkName": "frameworkName", + "uid": "uid", + "userName": "userName", + "state": "SUCCEEDED", + "originState": "Completed", + "maxAttemptCount": 1, + "attemptIndex": 0, + "jobStartedTime": 0, + "attemptStartedTime": 0, + "attemptCompletedTime": 0, + "exitCode": 0, + "exitPhrase": "Succeeded", + "exitType": "Succeeded", + "exitDiagnostics": { + "diagnosticsSummary": "Pod succeeded", + "runtime": null, + "launcher": "Pod succeeded" + }, + "appExitTriggerMessage": "All Tasks are completed", + "appExitTriggerTaskRoleName": "taskrole", + "appExitTriggerTaskIndex": 0, + "appExitSpec": { + "code": 0, + "phrase": "Succeeded", + "issuer": "USER_CONTAINER", + "causer": "USER_CONTAINER", + "type": "USER_SUCCESS", + "stage": "COMPLETING", + "behavior": "UNKNOWN", + "reaction": "NEVER_RETRY", + "repro": [ + "User program exits with exitcode 0" + ] + }, + "appExitDiagnostics": "Pod succeeded", + "appExitMessages": { + "container": null, + "runtime": null, + "launcher": "Pod succeeded" + }, + "totalGpuNumber": 1, + "totalTaskNumber": 1, + "totalTaskRoleNumber": 1, + "taskRoles": { + "taskrole": { + "taskRoleStatus": { + "name": "taskrole" + }, + "taskStatuses": [ + { + "taskIndex": 0, + "taskState": "SUCCEEDED", + "containerId": "", + "containerIp": "", + "containerExitCode": 0 + } + ] + } + }, + "isLatest": true + } + ], + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "501": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getJobAttempt": { + "path": "/api/v2/jobs/{user}~{job}/job-attempts/{attemptIndex}", + "method": "get", + "examples": { + "200": { + "jobName": "jobName", + "frameworkName": "frameworkName", + "uid": "uid", + "userName": "userName", + "state": "SUCCEEDED", + "originState": "Completed", + "maxAttemptCount": 1, + "attemptIndex": 0, + "jobStartedTime": 0, + "attemptStartedTime": 0, + "attemptCompletedTime": 0, + "exitCode": 0, + "exitPhrase": "Succeeded", + "exitType": "Succeeded", + "exitDiagnostics": { + "diagnosticsSummary": "Pod succeeded", + "runtime": null, + "launcher": "Pod succeeded" + }, + "appExitTriggerMessage": "All Tasks are completed", + "appExitTriggerTaskRoleName": "taskrole", + "appExitTriggerTaskIndex": 0, + "appExitSpec": { + "code": 0, + "phrase": "Succeeded", + "issuer": "USER_CONTAINER", + "causer": "USER_CONTAINER", + "type": "USER_SUCCESS", + "stage": "COMPLETING", + "behavior": "UNKNOWN", + "reaction": "NEVER_RETRY", + "repro": [ + "User program exits with exitcode 0" + ] + }, + "appExitDiagnostics": "Pod succeeded", + "appExitMessages": { + "container": null, + "runtime": null, + "launcher": "Pod succeeded" + }, + "totalGpuNumber": 1, + "totalTaskNumber": 1, + "totalTaskRoleNumber": 1, + "taskRoles": { + "taskrole": { + "taskRoleStatus": { + "name": "taskrole" + }, + "taskStatuses": [ + { + "taskIndex": 0, + "taskState": "SUCCEEDED", + "containerId": "", + "containerIp": "", + "containerExitCode": 0 + } + ] + } + }, + "isLatest": true + }, + "404": { + "value": { + "code": "NoJobError", + "message": "Job {job} is not found." + } + }, + "501": { + "value": { + "code": "UnknownError", + "message": "Internal error message." + } + } + } + }, + "getK8sNodes": { + "path": "/api/v2/kubernetes/nodes", + "method": "get", + "examples": { + "200": [ + "Please refer to Kubernetes API doc", + "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#list-node-v1-core" + ], + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + } + } + }, + "getK8sPods": { + "path": "/api/v2/kubernetes/pods", + "method": "get", + "examples": { + "200": [ + "Please refer to Kubernetes API doc", + "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#list-all-namespaces-pod-v1-core" + ], + "401": { + "value": { + "code": "UnauthorizedUserError", + "message": "Guest is not allowed to do this operation." + } + }, + "403": { + "value": { + "code": "ForbiddenUserError", + "message": "Non-admin is not allow to do this operation." + } + } + } + } + } +} \ No newline at end of file diff --git a/tests/common/apiTestCases.ts b/tests/common/apiTestCases.ts index 7b453d7..a9529cc 100644 --- a/tests/common/apiTestCases.ts +++ b/tests/common/apiTestCases.ts @@ -81,11 +81,11 @@ const deleteTestGroup: IApiOperation = { }] }; -const addTestTag: IApiOperation = { - tag: 'job', - operationId: 'addTag', - parameters: [ - { +function addTestTag(): IApiOperation { + return { + tag: 'job', + operationId: 'addTag', + parameters: [{ type: 'raw', value: clustersJson[0].username }, @@ -96,15 +96,15 @@ const addTestTag: IApiOperation = { { type: 'raw', value: 'testTag' - } - ] -}; + }] + }; +} -const deleteTestTag: IApiOperation = { - tag: 'job', - operationId: 'deleteTag', - parameters: [ - { +function deleteTestTag(): IApiOperation { + return { + tag: 'job', + operationId: 'deleteTag', + parameters: [{ type: 'raw', value: clustersJson[0].username }, @@ -115,9 +115,9 @@ const deleteTestTag: IApiOperation = { { type: 'raw', value: 'testTag' - } - ] -}; + }] + }; +} function createTestJob(): IApiOperation { return { @@ -939,14 +939,14 @@ export const ApiDefaultTestCases: {[key: string]: IApiTestCase} = { 'put /api/v2/jobs/{user}~{job}/tag': { before: [ createTestJob() ], tests: [{ - operation: addTestTag + operation: addTestTag() }], - after: [ updateTestJobExecutionType('STOP'), deleteTestTag ] + after: [ updateTestJobExecutionType('STOP'), deleteTestTag() ] }, 'delete /api/v2/jobs/{user}~{job}/tag': { - before: [ createTestJob(), addTestTag ], + before: [ createTestJob(), addTestTag() ], tests: [{ - operation: deleteTestTag + operation: deleteTestTag() }], after: [ updateTestJobExecutionType('STOP') ] },