Skip to content
Snippets Groups Projects
Commit 4fd04172 authored by Templum's avatar Templum Committed by Alex Ellis
Browse files

Updated Swagger Documentation


Changes:
Increased version to reflect latest
Every path now is in ''
Added all receivable Status Codes
Made use of Schemas
Added required annotation to models

Signed-off-by: default avatarSimon Pelczer <templum.dev@gmail.com>
parent 9d9ab0d9
No related branches found
No related tags found
No related merge requests found
swagger: '2.0' swagger: '2.0'
info: info:
description: OpenFaaS API documentation description: OpenFaaS API documentation
version: 0.8.1 version: 0.8.2
title: OpenFaaS API Gateway title: OpenFaaS API Gateway
license: license:
name: MIT name: MIT
basePath: / basePath: /
schemes: schemes:
- http - http
- https
paths: paths:
/system/functions: '/system/functions':
get: get:
summary: 'Get a list of deployed functions with: stats and image digest' summary: 'Get a list of deployed functions with: stats and image digest'
description: ''
consumes: consumes:
- application/json - application/json
produces: produces:
...@@ -20,12 +20,10 @@ paths: ...@@ -20,12 +20,10 @@ paths:
responses: responses:
'200': '200':
description: List of deployed functions. description: List of deployed functions.
examples: schema:
application/json: |- type: array
[ items:
{"name":"func_payroll","image":"alexellis2/faas-payroll:latest@sha256:0bc2773613c76d9ee4906bf3887ea2527f135cb7a0d0f430743e7c6712949709","invocationCount":16,"replicas":1}, $ref: '#/definitions/FunctionListEntry'
{"name":"func_fanclub","image":"alexellis2/fanclub:18-04-2017@sha256:37bb3fabee7e36abab7e6250bb7d13c9ab66e983782b35200470fe2a3aa14daa","invocationCount":1125,"replicas":1}
]
post: post:
summary: Deploy a new function. summary: Deploy a new function.
description: '' description: ''
...@@ -39,10 +37,14 @@ paths: ...@@ -39,10 +37,14 @@ paths:
description: Function to deploy description: Function to deploy
required: true required: true
schema: schema:
$ref: '#/definitions/CreateFunctionRequest' $ref: '#/definitions/FunctionDefintion'
responses: responses:
'200': '202':
description: OK description: Accepted
'400':
description: Bad Request
'500':
description: Internal server error
put: put:
summary: Update a function. summary: Update a function.
description: '' description: ''
...@@ -56,10 +58,16 @@ paths: ...@@ -56,10 +58,16 @@ paths:
description: Function to update description: Function to update
required: true required: true
schema: schema:
$ref: '#/definitions/CreateFunctionRequest' $ref: '#/definitions/FunctionDefintion'
responses: responses:
'200': '200':
description: OK description: Accepted
'400':
description: Bad Request
'404':
description: Not Found
'500':
description: Internal server error
delete: delete:
summary: Remove a deployed function. summary: Remove a deployed function.
description: '' description: ''
...@@ -77,9 +85,13 @@ paths: ...@@ -77,9 +85,13 @@ paths:
responses: responses:
'200': '200':
description: OK description: OK
'400':
description: Bade Request
'404': '404':
description: Function not found in gateway description: Not Found
/system/alert: '500':
description: Internal server error
'/system/alert':
post: post:
summary: 'Event-sink for AlertManager, for auto-scaling' summary: 'Event-sink for AlertManager, for auto-scaling'
description: 'Internal use for AlertManager, requires valid AlertManager alert JSON' description: 'Internal use for AlertManager, requires valid AlertManager alert JSON'
...@@ -169,7 +181,7 @@ paths: ...@@ -169,7 +181,7 @@ paths:
'202': '202':
description: Request accepted and queued description: Request accepted and queued
'404': '404':
description: Requested function not found description: Not Found
'500': '500':
description: Internal server error description: Internal server error
'/function/{functionName}': '/function/{functionName}':
...@@ -194,9 +206,9 @@ paths: ...@@ -194,9 +206,9 @@ paths:
'200': '200':
description: Value returned from function description: Value returned from function
'404': '404':
description: Function not found description: Not Found
'500': '500':
description: Error connecting to function description: Internal server error
'/system/scale-function/{functionName}': '/system/scale-function/{functionName}':
get: get:
summary: Scale a function summary: Scale a function
...@@ -235,11 +247,13 @@ paths: ...@@ -235,11 +247,13 @@ paths:
required: true required: true
responses: responses:
'200': '200':
description: Function definition description: Function Summary
schema:
$ref: '#/definitions/FunctionListEntry'
'404': '404':
description: Function not found description: Not Found
'500': '500':
description: Error querying function description: Internal server error
'/system/info': '/system/info':
get: get:
summary: Get info such as provider version number and provider orchestrator summary: Get info such as provider version number and provider orchestrator
...@@ -251,10 +265,12 @@ paths: ...@@ -251,10 +265,12 @@ paths:
examples: examples:
application/json: |- application/json: |-
{"provider":"faas-swarm","version":{"sha":"7108418d9dd6b329ddff40e7393b3166f8160a88","release":"0.2.6"},"orchestration":"swarm"} {"provider":"faas-swarm","version":{"sha":"7108418d9dd6b329ddff40e7393b3166f8160a88","release":"0.2.6"},"orchestration":"swarm"}
schema:
$ref: '#/definitions/Info'
'404': '404':
description: Provider does not support info endpoint description: Endpoint Info not supported
'500': '500':
description: Error finding info description: Internal server error
'/healthz': '/healthz':
get: get:
summary: Healthcheck summary: Healthcheck
...@@ -264,13 +280,34 @@ paths: ...@@ -264,13 +280,34 @@ paths:
'500': '500':
description: Not healthy description: Not healthy
definitions: definitions:
Info:
type: object
properties:
provider:
type: string
version:
type: object
properties:
sha:
type: string
release:
type: string
format: semver
orchestration:
type: string
required:
- provider
- version
- orchestration
DeleteFunctionRequest: DeleteFunctionRequest:
type: object type: object
properties: properties:
functionName: functionName:
type: string type: string
description: Name of deployed function description: Name of deployed function
CreateFunctionRequest: required:
- functionName
FunctionDefintion:
type: object type: object
properties: properties:
service: service:
...@@ -290,6 +327,11 @@ definitions: ...@@ -290,6 +327,11 @@ definitions:
additionalProperties: additionalProperties:
type: string type: string
description: Overrides to environmental variables description: Overrides to environmental variables
constraints:
type: array
items:
type: string
description: Constraints are specific to back-end orchestration platform
labels: labels:
type: array type: array
items: items:
...@@ -310,6 +352,49 @@ definitions: ...@@ -310,6 +352,49 @@ definitions:
description: >- description: >-
Private registry base64-encoded basic auth (as present in Private registry base64-encoded basic auth (as present in
~/.docker/config.json) ~/.docker/config.json)
limits:
type: object
properties:
memory:
type: string
example: "128M"
cpu:
type: string
example: "0.01"
requests:
type: object
required:
- service
- image
- envProcess
FunctionListEntry:
type: object
properties:
name:
type: string
image:
type: string
invocationCount:
type: number
format: integer
replicas:
type: number
format: integer
availableReplicas:
type: number
format: integer
envProcess:
type: string
labels:
type: object
required:
- name
- image
- invocationCount
- replicas
- availableReplicas
- envProcess
- labels
externalDocs: externalDocs:
description: More documentation available on Github description: More documentation available on Github
url: 'https://github.com/openfaas/faas' url: 'https://github.com/openfaas/faas'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment