faasd-in-rust/docs/openapi.yaml
Samuel Dai 308e9bcc5d
refactor: project structure and better interfaces (#100)
* refactor: basically rewrite all interface

* refactor: rename crates to make clear meaning; use tokio runtime and handle shutdown within Provider

* remove tracker in main

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* feat(provider): enhance Provider trait with list, update, and status methods; refactor existing methods to async

* fix(containerd): fetch handle from environment and initialize it.

* fix(init): BACKEND init add handle fetching

* fix: add test framework

* fix: move the snapshot logic into snapshot.rs

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* fix: change some spec setting

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* feat: add created_at field, add http status code convertion

* refactor(spec): use builder to generate spec

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* fix: clippy

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* manage reference, fix boot issue

* fix: ip parsing

* feat: add cleanup logic on fail

* fix style: clippy for return function

* feat: add response message

* fix:1.修复proxy和resolve的逻辑 2.spec内netns的路径问题以及传参顺序

* feat:add update list status  service implmentation

* fix: move some consts into consts.rs

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* fix: fmt & clippy

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* fix: update dependecy

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* feat: add function with_vm_network

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>

* feat: integrate cni into containerd crate

* fix:修复proxy的路径正则匹配并添加单元测试

* fix:fix proxy_path and add default namespace for Query::from

* fix: integration_test

* fix: path dispatch test

* fix: more specified url dispatch in proxy handle

* feat: add persistent container record for restart service

* feat: add task error type

* fix: delete error handle logic

---------

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Co-authored-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Co-authored-by: dolzhuying <1240800466@qq.com>
Co-authored-by: scutKKsix <1129332011@qq.com>
2025-05-22 21:43:16 +08:00

192 lines
5.4 KiB
YAML

openapi: 3.0.1
info:
title: faasd-in-rs API Gateway
description: faasd-in-rs API documentation
license:
name: GPL-3.0
version: 0.1.0
servers:
- url: "http://localhost:8080"
description: Local server
tags:
- name: internal
description: Internal use only
- name: system
description: System endpoints for managing functions and related objects
- name: function
description: Endpoints for invoking functions
paths:
"/system/functions":
get:
operationId: GetFunctions
description: Get a list of deployed functions
summary: 'Get a list of deployed functions with: stats and image digest'
tags:
- system
responses:
'200':
description: List of deployed functions.
content:
application/json:
schema:
type: array
items:
"$ref": "#/components/schemas/FunctionStatus"
'400':
description: Bad Request
'500':
description: Internal Server Error
post:
operationId: DeployFunction
description: Deploy a new function.
summary: Deploy a new function.
tags:
- system
requestBody:
description: Function to deploy
content:
application/json:
schema:
"$ref": "#/components/schemas/FunctionDeployment"
required: true
responses:
'202':
description: Accepted
'400':
description: Bad Request
'500':
description: Internal Server Error
delete:
operationId: DeleteFunction
description: Remove a deployed function.
summary: Remove a deployed function.
tags:
- system
requestBody:
description: Function to delete
content:
application/json:
schema:
"$ref": "#/components/schemas/DeleteFunctionRequest"
required: true
responses:
'200':
description: OK
'404':
description: Not Found
'500':
description: Internal Server Error
"/function/{function_name}":
post:
operationId: InvokeFunction
description: Invoke a function in the default namespace.
summary: |
Synchronously invoke a function defined in te default namespace.
Any additional path segments and query parameters will be passed to the function as is.
tags:
- function
parameters:
- name: function_name
in: path
description: Function name
required: true
schema:
type: string
requestBody:
description: "(Optional) data to pass to function"
content:
"*/*":
schema:
type: string
format: binary
example: '{"hello": "world"}'
required: false
responses:
'200':
description: Value returned from function
'404':
description: Not Found
'405':
description: Method Not Allowed
'500':
description: Internal server error
'503':
description: Error Service Unavailable
components:
schemas:
FunctionDeployment:
required:
- function_name
- image
type: object
properties:
function_name:
type: string
description: Name of deployed function
example: nginx
image:
type: string
description: Docker image in accessible registry
example: docker.io/library/nginx:alpine
namespace:
type: string
description: Namespace to deploy function to. When omitted, the default namespace
is used, typically this is `faasd-in-rs-fn` but is configured by the provider.
example: faasd-in-rs-fn
envProcess:
type: string
description: |
Process for watchdog to fork, i.e. the command to start the function process.
This value configures the `fprocess` env variable.
example: main
envVars:
type: object
additionalProperties:
type: string
description: Overrides to environmental variables
labels:
type: object
nullable: true
additionalProperties:
type: string
description: A map of labels for making scheduling or routing decisions
example:
foo: bar
DeleteFunctionRequest:
required:
- function_name
type: object
properties:
function_name:
type: string
description: Name of deployed function
example: nginx
FunctionStatus:
type: object
required:
- function_name
- image
properties:
function_name:
type: string
description: The name of the function
example: nginx
image:
type: string
description: The fully qualified docker image name of the function
example: docker.io/library/nginx:alpine
namespace:
type: string
description: The namespace of the function
example: faasd-in-rs-fn
envProcess:
type: string
description: Process for watchdog to fork
example: main
envVars:
type: object
additionalProperties:
type: string
description: environment variables for the function runtime