{ "swagger": "2.0", "info": { "description": "OSCAR API documentation", "version": "0.0.1", "title": "On-premises Serverless Container-aware ARchitectures API Gateway", "license": { "name": "Apache2" } }, "basePath": "/", "schemes": [ "http" ], "paths": { "/events": { "post": { "summary": "Process Minio events", "description": "", "operationId": "events_post", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "body", "description": "Minio webhook endpoint", "required": true, "schema": { "$ref": "#/definitions/InBody" } } ], "responses": { "202": { "description": "Accepted" }, "400": { "description": "Bad Request" }, "500": { "description": "Internal Server Error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" } }, "/functions": { "get": { "summary": "Get a list of deployed functions with: stats and image digest", "operationId": "functions_get", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [], "responses": { "200": { "description": "List of deployed functions.", "schema": { "type": "array", "items": { "$ref": "#/definitions/FunctionListEntry" } } } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" }, "post": { "summary": "Deploy a new function.", "description": "", "operationId": "functions_post", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "body", "description": "Function to deploy", "required": true, "schema": { "$ref": "#/definitions/FunctionDefinition" } } ], "responses": { "202": { "description": "Accepted" }, "400": { "description": "Bad Request" }, "500": { "description": "Internal Server Error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" }, "put": { "summary": "Update a function.", "description": "", "operationId": "functions_put", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "body", "description": "Function to update", "required": true, "schema": { "$ref": "#/definitions/FunctionDefinition" } } ], "responses": { "200": { "description": "Accepted" }, "400": { "description": "Bad Request" }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" }, "delete": { "summary": "Remove a deployed function.", "description": "", "operationId": "functions_delete", "consumes": [ "application/json" ], "produces": [ "application/json" ], "parameters": [ { "in": "body", "name": "body", "description": "Function to delete", "required": true, "schema": { "$ref": "#/definitions/DeleteFunctionRequest" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "Bad Request" }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" } }, "/function/async/{functionName}": { "post": { "summary": "Invoke a function asynchronously", "operationId": "function_async_function_name_post", "parameters": [ { "name": "functionName", "in": "path", "description": "Function name", "required": true, "type": "string" }, { "in": "body", "name": "data", "description": "(Optional) data to pass to function", "required": false, "schema": { "type": "string", "format": "binary", "example": "{\"hello\": \"world\"}" } } ], "responses": { "202": { "description": "Request accepted and queued" }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" } }, "/function/{functionName}": { "get": { "summary": "Get a summary of an OpenFaaS function", "operationId": "function_function_name_get", "parameters": [ { "name": "functionName", "in": "path", "description": "Function name", "required": true, "type": "string" } ], "responses": { "200": { "description": "Function Summary", "schema": { "$ref": "#/definitions/FunctionListEntry" } }, "404": { "description": "Not Found" }, "500": { "description": "Internal Server Error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" }, "post": { "summary": "Invoke a defined function", "operationId": "function_function_name_post", "consumes": [ "application/json", "text/plain" ], "parameters": [ { "name": "functionName", "in": "path", "description": "Function name", "required": true, "type": "string" }, { "in": "body", "name": "data", "description": "(Optional) data to pass to function", "required": false, "schema": { "type": "string", "format": "binary", "example": "{\"hello\": \"world\"}" } } ], "responses": { "200": { "description": "Value returned from function" }, "404": { "description": "Not Found" }, "500": { "description": "Internal server error" } }, "x-swagger-router-controller": "swagger_server.controllers.default_controller" } } }, "securityDefinitions": { "basicAuth": { "type": "basic" } }, "definitions": { "DeleteFunctionRequest": { "type": "object", "required": [ "functionName" ], "properties": { "name": { "type": "string", "example": "nodeinfo", "description": "Name of deployed function" }, "deleteBuckets": { "type": "boolean", "example": false, "description": "Delete linked buckets" } }, "example": { "name": "nodeinfo", "deleteBuckets": false } }, "FunctionDefinition": { "type": "object", "required": [ "image", "name", "script" ], "properties": { "name": { "type": "string", "example": "nodeinfo", "description": "Name of deployed function" }, "image": { "type": "string", "example": "functions/nodeinfo:latest", "description": "Docker image in accessible registry" }, "script": { "type": "string", "example": "ZWNobyAiaXQgd29ya3MhIg==", "description": "Script to be executed inside the function coded in base64" }, "envVars": { "type": "object", "description": "Overrides to environmental variables", "additionalProperties": { "type": "string" } }, "labels": { "type": "object", "description": "An dictionary of labels used by the back-end for making scheduling or routing decisions", "additionalProperties": { "type": "string" } }, "annotations": { "type": "object", "description": "An dictionary of annotations used by the back-end for management, orchestration, events and build tasks", "additionalProperties": { "type": "string" } }, "constraints": { "type": "array", "items": { "type": "string", "example": "node.platform.os == linux", "description": "Constraints are specific to the OpenFaaS Provider" } }, "network": { "type": "string", "example": "func_functions", "description": "Docker swarm network, usually func_functions" }, "secrets": { "type": "array", "items": { "type": "string", "example": "secret-name-1", "description": "An array of names of secrets that are required to be loaded from the Docker Swarm." } }, "registryAuth": { "type": "string", "example": "dXNlcjpwYXNzd29yZA==", "description": "Private registry base64-encoded basic auth (as present in ~/.docker/config.json)" }, "limits": { "$ref": "#/definitions/FunctionDefinition_limits" }, "requests": { "$ref": "#/definitions/FunctionDefinition_limits" } }, "example": { "image": "functions/nodeinfo:latest", "name": "nodeinfo", "envVars": { "key": "envVars" }, "annotations": { "key1": "annotation1", "key2": "annotation2" }, "registryAuth": "dXNlcjpwYXNzd29yZA==", "requests": { "memory": "128M", "cpu": "0.01" }, "constraints": [ "node.platform.os == linux", "node.platform.os == linux" ], "secrets": [ "secret-name-1", "secret-name-1" ], "script": "ZWNobyAiaXQgd29ya3MhIg==", "limits": { "memory": "128M", "cpu": "0.01" }, "labels": { "key1": "label1", "key2": "label2" }, "network": "func_functions" } }, "FunctionListEntry": { "type": "object", "required": [ "availableReplicas", "envProcess", "image", "invocationCount", "labels", "name", "replicas" ], "properties": { "name": { "type": "string", "example": "nodeinfo", "description": "The name of the function" }, "image": { "type": "string", "example": "functions/nodeinfo:latest", "description": "The fully qualified docker image name of the function" }, "invocationCount": { "type": "number", "format": "integer", "example": 1337, "description": "The amount of invocations for the specified function" }, "replicas": { "type": "number", "format": "integer", "example": 2, "description": "The current minimal ammount of replicas" }, "availableReplicas": { "type": "number", "format": "integer", "example": 2, "description": "The current available amount of replicas" }, "envProcess": { "type": "string", "example": "node main.js", "description": "Process for watchdog to fork" }, "labels": { "type": "object", "additionalProperties": { "type": "string" } }, "annotations": { "type": "object", "additionalProperties": { "type": "string" } } }, "example": { "image": "functions/nodeinfo:latest", "envProcess": "node main.js", "replicas": 2, "name": "nodeinfo", "invocationCount": 1337, "annotations": { "key": "annotations" }, "availableReplicas": 2, "labels": { "key": "labels" } } }, "InBody": { "type": "object" }, "FunctionDefinition_limits": { "properties": { "memory": { "type": "string", "example": "128M" }, "cpu": { "type": "string", "example": "0.01" } }, "example": { "memory": "128M", "cpu": "0.01" } } }, "externalDocs": { "description": "More documentation available on Github", "url": "https://github.com/grycap/oscar" } }