TOSIT-IO / tdp-server

REST API for tdp-lib orchestration
2 stars 2 forks source link

Feat new server implementation #131

Open SteBaum opened 10 months ago

SteBaum commented 10 months ago

Discussion

This PR is a server started from scratch.

Choice between two different endpoint specifications regarding the url path and categorization:

Choice 1
configurations
GET: /api/v1/configurations
GET: /api/v1/configurations/history
GET: /api/v1/configurations/validate
GET: /api/v1/configurations/services
GET: /api/v1/configurations/services/{service_id}
PUT: /api/v1/configurations/services/{service_id}
GET: /api/v1/configurations/services/{service_id}/variables
PUT: /api/v1/configurations/services/{service_id}/variables
PATCH: /api/v1/configurations/services/{service_id}/variables
GET: /api/v1/configurations/services/{service_id}/schema
GET: /api/v1/configurations/services{service_id}/history
GET: /api/v1/configurations/services/{service_id}/components
GET: /api/v1/configurations/services/{service_id}/components/{component_id}
PUT: /api/v1/configurations/services/{service_id}/components/{component_id}
GET: /api/v1/configurations/services/{service_id}/components/{component_id}/variables
PUT: /api/v1/configurations/services/{service_id}/components/{component_id}/variables
PATCH: /api/v1/configurations/services/{service_id}/components/{component_id}/variables
GET: /api/v1/configurations/services/{service_id}/components/{component_id}/history

deployments
GET: /api/v1/deployments
GET: /api/v1/deployments/{deployement_id}
GET: /api/v1/deployments/{deployement_id}/operations/{operation_order}

deploy
POST: /api/v1/deploy
GET: /api/v1/deploy

operations
GET: /api/v1/operations

plan
GET: /api/v1/plan
POST: /api/v1/plan/dag
POST: /api/v1/plan/operations
POST: /api/v1/plan/resume
POST: /api/v1/plan/reconfigure
POST: /api/v1/plan/import
POST: /api/v1/plan/custom

default
GET: /
Choice 2

The configurations category has been splitted in two categories status and variables. The rest is identical; below are the changes :

status
GET: /api/v1/status
GET: /api/v1/status/history
GET: /api/v1/status/{service_id}
PUT: /api/v1/status/{service_id}
GET: /api/v1/status/{service_id}/history]
GET: /api/v1/status/{service_id}/components
GET: /api/v1/status/{service_id}/components/{component_id}
PUT: /api/v1/status/{service_id}/components/{component_id}
GET: /api/v1/status/{service_id}/components/{component_id}/history

variables
GET: /api/v1/variables/validate
GET: /api/v1/variables/{service_id}
PUT: /api/v1/variables/{service_id}
PATCH: /api/v1/variables/{service_id}
GET: /api/v1/variables/{service_id}/schema
GET: /api/v1/variables/{service_id}/components/{component_id}
PUT: /api/v1/variables/{service_id}/components/{component_id}
PATCH: /api/v1/variables/{service_id}/components/{component_id}

Functionalities are identical in both versions, just the path and category is different. More details of the endpoints can be seen in the swagger.

To see the second choice in the swagger, modify line 5 in main.py from from tdp_server.api.v1.api import api_router to from tdp_server.api.v2.api import api_router.

Agreements