{ "openapi" : "3.0.1", "info" : { "description" : "AMOC REST API\n", "title" : "AMOC API", "version" : "1.0.1" }, "servers" : [ { "url" : "/" } ], "paths" : { "/nodes" : { "get" : { "operationId" : "getClusteredNodes", "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/NodesKV" } } }, "description" : "response object" } }, "summary" : "List all AMOC nodes in a cluster.", "tags" : [ "status" ] } }, "/scenarios" : { "get" : { "operationId" : "getAvailableScenarios", "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ScenarioList" } } }, "description" : "response object" } }, "summary" : "List all available scenarios", "tags" : [ "scenarios" ] } }, "/scenarios/info/{id}" : { "get" : { "operationId" : "getScenarioDescription", "parameters" : [ { "description" : "Scenario name", "explode" : false, "in" : "path", "name" : "id", "required" : true, "schema" : { "type" : "string" }, "style" : "simple" } ], "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ScenarioInfo" } } }, "description" : "response object" }, "404" : { "description" : "no scenario with such a name" } }, "summary" : "Get scenario description", "tags" : [ "scenarios" ] } }, "/scenarios/defaults/{id}" : { "get" : { "operationId" : "getScenarioSettings", "parameters" : [ { "description" : "Scenario name", "explode" : false, "in" : "path", "name" : "id", "required" : true, "schema" : { "type" : "string" }, "style" : "simple" } ], "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ScenarioDefaults" } } }, "description" : "response object" }, "404" : { "description" : "no scenario with such a name" } }, "summary" : "Get scenario default settings", "tags" : [ "scenarios" ] } }, "/status" : { "get" : { "operationId" : "getAmocAppStatus", "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/AmocStatus" } } }, "description" : "response object" } }, "summary" : "Get AMOC app status", "tags" : [ "status" ] } }, "/status/{node}" : { "get" : { "operationId" : "getAmocAppStatusOnNode", "parameters" : [ { "description" : "Node name", "explode" : false, "in" : "path", "name" : "node", "required" : true, "schema" : { "$ref" : "#/components/schemas/Node" }, "style" : "simple" } ], "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/AmocStatus" } } }, "description" : "response object" }, "404" : { "description" : "no node with such a name" } }, "summary" : "Get AMOC app status on a remote node", "tags" : [ "status" ] } }, "/scenarios/upload" : { "put" : { "description" : "Uploads new scenario, you can run the next command to upload a file using curl utility\n\n`curl -s -H \"Content-Type: text/plain\" -T http:///upload`", "operationId" : "uploadNewScenario", "requestBody" : { "content" : { "application/octet-stream" : { "schema" : { "$ref" : "#/components/schemas/UploadBody" } }, "text/plain" : { "example" : "Past module source code here!!!", "schema" : { "$ref" : "#/components/schemas/UploadBody" } } } }, "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/UploadResp" } } }, "description" : "response object" }, "400" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Error" } } }, "description" : "response object" } }, "summary" : "Upload a new scenario.", "tags" : [ "scenarios" ] } }, "/execution/start" : { "patch" : { "operationId" : "startScenario", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ExecutionStart" } } }, "description" : "request body (as json)", "required" : true }, "responses" : { "200" : { "description" : "execution started successfully" }, "409" : { "description" : "execution cannot be started (e.g. another scenario is already running)" }, "500" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Error" } } }, "description" : "internal error occurred" } }, "summary" : "Start scenario", "tags" : [ "execution" ] } }, "/execution/stop" : { "patch" : { "operationId" : "stopScenario", "requestBody" : { "content" : { "application/json" : { } }, "description" : "request body (as json)" }, "responses" : { "200" : { "description" : "execution stopped successfully" }, "409" : { "description" : "scenario is not running" }, "500" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Error" } } }, "description" : "internal error occurred" } }, "summary" : "Stop scenario", "tags" : [ "execution" ] } }, "/execution/add_users" : { "patch" : { "operationId" : "addUsers", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ExecutionChangeUsers" } } }, "description" : "request body (as json)", "required" : true }, "responses" : { "200" : { "description" : "users added successfully" }, "409" : { "description" : "scenario is not running" }, "500" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Error" } } }, "description" : "internal error occurred" } }, "summary" : "add new users", "tags" : [ "execution" ] } }, "/execution/remove_users" : { "patch" : { "operationId" : "removeUsers", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ExecutionChangeUsers" } } }, "description" : "request body (as json)", "required" : true }, "responses" : { "200" : { "description" : "users removed successfully" }, "409" : { "description" : "scenario is not running" }, "500" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Error" } } }, "description" : "internal error occurred" } }, "summary" : "stop users", "tags" : [ "execution" ] } }, "/execution/update_settings" : { "patch" : { "operationId" : "updateSettings", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ExecutionUpdateSettings" } } }, "description" : "request body (as json)", "required" : true }, "responses" : { "200" : { "description" : "Settings updated successfully" }, "409" : { "description" : "scenario is not running" }, "500" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Error" } } }, "description" : "internal error occurred" } }, "summary" : "update scenario settings", "tags" : [ "execution" ] } } }, "components" : { "schemas" : { "NodesKV" : { "example" : { "nodes" : { "amoc@host1" : "up", "amoc@host2" : "up" } }, "properties" : { "nodes" : { "additionalProperties" : { "enum" : [ "up", "down" ], "type" : "string" }, "example" : { "amoc@host1" : "up", "amoc@host2" : "up" }, "type" : "object" } }, "required" : [ "nodes" ], "type" : "object" }, "ScenarioList" : { "example" : { "scenarios" : [ "some_scenario", "another_scenario" ] }, "properties" : { "scenarios" : { "example" : [ "some_scenario", "another_scenario" ], "items" : { "type" : "string" }, "type" : "array" } }, "required" : [ "scenarios" ], "type" : "object" }, "ScenarioInfo" : { "example" : { "doc" : "scenario description", "parameters" : { "configuration_parameter_name1" : { "module" : "module_name", "description" : "parameter description", "default_value" : "default value", "verification_fn" : "MFA, 'none' or the list of valid values", "update_fn" : "MFA, 'none' or 'readonly'" }, "configuration_parameter_name2" : { "module" : "module_name", "description" : "parameter description", "default_value" : "default value", "verification_fn" : "MFA, 'none' or the list of valid values", "update_fn" : "MFA, 'none' or 'readonly'" } } }, "properties" : { "doc" : { "example" : "scenario description", "type" : "string" }, "parameters" : { "additionalProperties" : { "$ref" : "#/components/schemas/ScenarioInfo_parameters_value" }, "example" : { "configuration_parameter_name1" : { "module" : "module_name", "description" : "parameter description", "default_value" : "default value", "verification_fn" : "MFA, 'none' or the list of valid values", "update_fn" : "MFA, 'none' or 'readonly'" }, "configuration_parameter_name2" : { "module" : "module_name", "description" : "parameter description", "default_value" : "default value", "verification_fn" : "MFA, 'none' or the list of valid values", "update_fn" : "MFA, 'none' or 'readonly'" } }, "type" : "object" } }, "required" : [ "doc" ], "type" : "object" }, "ScenarioDefaults" : { "example" : { "settings" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" } }, "properties" : { "settings" : { "additionalProperties" : { "type" : "string" }, "description" : "Scenario parameters", "example" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "type" : "object" } }, "required" : [ "settings" ], "type" : "object" }, "ScenarioSettings" : { "additionalProperties" : { "type" : "string" }, "description" : "Scenario parameters", "example" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "type" : "object" }, "AmocStatus" : { "description" : "\"controller\" field is mandatory if \"amoc_status\" is \"up\".\n", "example" : { "controller" : { "status" : "running", "scenario" : "some_scenario", "number_of_users" : 10, "settings" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" } }, "amoc_status" : "up", "env" : { "AMOC_INTERARRIVAL" : "50" } }, "properties" : { "amoc_status" : { "enum" : [ "up", "down" ], "type" : "string" }, "env" : { "additionalProperties" : { "type" : "string" }, "description" : "environment variables", "example" : { "AMOC_INTERARRIVAL" : "50" }, "type" : "object" }, "controller" : { "$ref" : "#/components/schemas/ControllerStatus" } }, "required" : [ "amoc_status", "env" ], "type" : "object" }, "ControllerStatus" : { "description" : "controller is \"disabled\" on the master node.\n\n\"scenario\" and \"settings\" fields are included if \"status\" is \"running\", \"terminating\" or \"finished\"\n\n\"number_of_users\" field is relevant only when controller is in \"running\" state.\n\n\"error\" field is relevant only when controller is in \"error\" state.\n", "example" : { "status" : "running", "scenario" : "some_scenario", "number_of_users" : 10, "settings" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" } }, "properties" : { "status" : { "enum" : [ "idle", "running", "terminating", "finished", "error", "disabled" ], "type" : "string" }, "scenario" : { "type" : "string" }, "number_of_users" : { "type" : "integer" }, "settings" : { "additionalProperties" : { "type" : "string" }, "description" : "Scenario parameters", "example" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "type" : "object" }, "error" : { "type" : "string" } }, "required" : [ "status" ], "type" : "object" }, "UploadBody" : { "format" : "binary", "type" : "string" }, "UploadResp" : { "example" : { "compile" : "ok" }, "properties" : { "compile" : { "description" : "ok | CompilationError", "example" : "ok", "type" : "string" } }, "required" : [ "compile" ], "type" : "object" }, "Error" : { "example" : { "error" : "error description" }, "properties" : { "error" : { "example" : "error description", "type" : "string" } }, "required" : [ "error" ], "type" : "object" }, "ExecutionStart" : { "example" : { "settings" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "scenario" : "some_scenario", "users" : 1000 }, "properties" : { "scenario" : { "description" : "scenario name", "example" : "some_scenario", "type" : "string" }, "users" : { "description" : "Number of users to start", "example" : 1000, "type" : "integer" }, "settings" : { "additionalProperties" : { "type" : "string" }, "description" : "Scenario parameters", "example" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "type" : "object" } }, "required" : [ "scenario" ], "type" : "object" }, "ExecutionChangeUsers" : { "example" : { "nodes" : [ "amoc@host1", "amoc@host2" ], "users" : 1000 }, "properties" : { "users" : { "description" : "Number of users", "example" : 1000, "type" : "integer" }, "nodes" : { "example" : [ "amoc@host1", "amoc@host2" ], "items" : { "$ref" : "#/components/schemas/Node" }, "type" : "array" } }, "required" : [ "users" ], "type" : "object" }, "ExecutionUpdateSettings" : { "example" : { "settings" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "nodes" : [ "amoc@host1", "amoc@host2" ] }, "properties" : { "settings" : { "additionalProperties" : { "type" : "string" }, "description" : "Scenario parameters", "example" : { "atom_parameter" : "atom1", "list_parameter" : "[atom1, atom2]", "tuple_parameter" : "{atom1, atom2}", "string_parameter" : "\"some_string\"", "binary_parameter" : "<<\"some_binary\">>" }, "type" : "object" }, "nodes" : { "example" : [ "amoc@host1", "amoc@host2" ], "items" : { "$ref" : "#/components/schemas/Node" }, "type" : "array" } }, "required" : [ "settings" ], "type" : "object" }, "NodeList" : { "example" : [ "amoc@host1", "amoc@host2" ], "items" : { "$ref" : "#/components/schemas/Node" }, "type" : "array" }, "Node" : { "pattern" : "^[^@]+@[^@]+$", "type" : "string" }, "ScenarioInfo_parameters_value" : { "properties" : { "module" : { "type" : "string" }, "description" : { "type" : "string" }, "default_value" : { "type" : "string" }, "verification_fn" : { "type" : "string" }, "update_fn" : { "type" : "string" } }, "required" : [ "default_value", "description", "module", "update_fn", "verification_fn" ], "type" : "object" } } } }