Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions docs/reference/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ info:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: BlueAPI Control
version: 1.3.0
version: 1.3.1
openapi: 3.1.0
paths:
/api/v1/devices:
Expand Down Expand Up @@ -826,7 +826,7 @@ paths:
description: Successful Response
summary: Get Devices
tags:
- Device
- Deprecated
/devices/{name}:
get:
deprecated: true
Expand Down Expand Up @@ -854,7 +854,7 @@ paths:
description: Validation Error
summary: Get Device By Name
tags:
- Device
- Deprecated
/environment:
delete:
deprecated: true
Expand All @@ -870,7 +870,7 @@ paths:
description: Successful Response
summary: Delete Environment
tags:
- Environment
- Deprecated
get:
deprecated: true
description: Get the current state of the environment, i.e. initialization state.
Expand All @@ -884,7 +884,7 @@ paths:
description: Successful Response
summary: Get Environment
tags:
- Environment
- Deprecated
/healthz:
get:
description: If able to serve this, server is live and ready for requests.
Expand Down Expand Up @@ -913,7 +913,7 @@ paths:
description: Successful Response
summary: Get Plans
tags:
- Plan
- Deprecated
/plans/{name}:
get:
deprecated: true
Expand Down Expand Up @@ -941,7 +941,7 @@ paths:
description: Validation Error
summary: Get Plan By Name
tags:
- Plan
- Deprecated
/python_environment:
get:
deprecated: true
Expand Down Expand Up @@ -983,7 +983,7 @@ paths:
description: Validation Error
summary: Get Python Environment
tags:
- Environment
- Deprecated
/tasks:
get:
deprecated: true
Expand Down Expand Up @@ -1013,7 +1013,7 @@ paths:
description: Validation Error
summary: Get Tasks
tags:
- Task
- Deprecated
post:
deprecated: true
description: Submit a task to the worker.
Expand Down Expand Up @@ -1045,7 +1045,7 @@ paths:
description: Validation Error
summary: Submit Task
tags:
- Task
- Deprecated
/tasks/{task_id}:
delete:
deprecated: true
Expand All @@ -1072,7 +1072,7 @@ paths:
description: Validation Error
summary: Delete Submitted Task
tags:
- Task
- Deprecated
get:
deprecated: true
description: Retrieve a task
Expand All @@ -1099,7 +1099,7 @@ paths:
description: Validation Error
summary: Get Task
tags:
- Task
- Deprecated
/worker/state:
get:
deprecated: true
Expand All @@ -1114,7 +1114,7 @@ paths:
description: Successful Response
summary: Get State
tags:
- Task
- Deprecated
put:
deprecated: true
description: "Request that the worker is put into a particular state.\nReturns\
Expand Down Expand Up @@ -1155,7 +1155,7 @@ paths:
description: Validation Error
summary: Set State
tags:
- Task
- Deprecated
/worker/task:
get:
deprecated: true
Expand All @@ -1169,7 +1169,7 @@ paths:
description: Successful Response
summary: Get Active Task
tags:
- Task
- Deprecated
put:
deprecated: true
description: 'Set a task to active status, the worker should begin it as soon
Expand Down Expand Up @@ -1200,4 +1200,4 @@ paths:
description: Validation Error
summary: Set Active Task
tags:
- Task
- Deprecated
4 changes: 3 additions & 1 deletion src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class Tag(StrEnum):
DEVICE = "Device"
ENV = "Environment"
META = "Meta"
DEPRECATED = "Deprecated"


class ApplicationConfig(BlueapiBaseModel):
Expand All @@ -303,7 +304,7 @@ class ApplicationConfig(BlueapiBaseModel):
"""

#: API version to publish in OpenAPI schema
REST_API_VERSION: ClassVar[str] = "1.3.0"
REST_API_VERSION: ClassVar[str] = "1.3.1"

LICENSE_INFO: ClassVar[dict[str, str]] = {
"name": "Apache 2.0",
Expand All @@ -324,6 +325,7 @@ class ApplicationConfig(BlueapiBaseModel):
{"name": Tag.DEVICE, "description": "Endpoints to get devices"},
{"name": Tag.ENV, "description": "Endpoints related to server environment"},
{"name": Tag.META, "description": "Endpoints used for auxiliary functions"},
{"name": Tag.DEPRECATED, "description": "Deprecated endpoints"},
]

stomp: StompConfig = Field(default_factory=StompConfig)
Expand Down
30 changes: 12 additions & 18 deletions src/blueapi/service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def inner(app: FastAPI):


open_router = APIRouter()
secure_router = APIRouter(deprecated=True)
secure_router = APIRouter(deprecated=True, tags=[Tag.DEPRECATED])
secure_router_v1 = APIRouter(prefix="/api/v1")


Expand Down Expand Up @@ -191,7 +191,7 @@ def root_redirect() -> RedirectResponse:


@secure_router_v1.get("/environment", tags=[Tag.ENV])
@secure_router.get("/environment", tags=[Tag.ENV])
@secure_router.get("/environment")
@start_as_current_span(TRACER, "runner")
def get_environment(
runner: Annotated[WorkerDispatcher, Depends(_runner)],
Expand All @@ -201,7 +201,7 @@ def get_environment(


@secure_router_v1.delete("/environment", tags=[Tag.ENV])
@secure_router.delete("/environment", tags=[Tag.ENV])
@secure_router.delete("/environment")
async def delete_environment(
background_tasks: BackgroundTasks,
runner: Annotated[WorkerDispatcher, Depends(_runner)],
Expand Down Expand Up @@ -232,7 +232,7 @@ def get_oidc_config(


@secure_router_v1.get("/plans", tags=[Tag.PLAN])
@secure_router.get("/plans", tags=[Tag.PLAN])
@secure_router.get("/plans")
@start_as_current_span(TRACER)
def get_plans(runner: Annotated[WorkerDispatcher, Depends(_runner)]) -> PlanResponse:
"""Retrieve information about all available plans."""
Expand All @@ -241,7 +241,7 @@ def get_plans(runner: Annotated[WorkerDispatcher, Depends(_runner)]) -> PlanResp


@secure_router_v1.get("/plans/{name}", tags=[Tag.PLAN])
@secure_router.get("/plans/{name}", tags=[Tag.PLAN])
@secure_router.get("/plans/{name}")
@start_as_current_span(TRACER, "name")
def get_plan_by_name(
name: str, runner: Annotated[WorkerDispatcher, Depends(_runner)]
Expand All @@ -251,7 +251,7 @@ def get_plan_by_name(


@secure_router_v1.get("/devices", tags=[Tag.DEVICE])
@secure_router.get("/devices", tags=[Tag.DEVICE])
@secure_router.get("/devices")
@start_as_current_span(TRACER)
def get_devices(
runner: Annotated[WorkerDispatcher, Depends(_runner)],
Expand All @@ -262,7 +262,7 @@ def get_devices(


@secure_router_v1.get("/devices/{name}", tags=[Tag.DEVICE])
@secure_router.get("/devices/{name}", tags=[Tag.DEVICE])
@secure_router.get("/devices/{name}")
@start_as_current_span(TRACER, "name")
def get_device_by_name(
name: str, runner: Annotated[WorkerDispatcher, Depends(_runner)]
Expand All @@ -279,7 +279,7 @@ def get_device_by_name(


@secure_router_v1.post("/tasks", status_code=status.HTTP_201_CREATED, tags=[Tag.TASK])
@secure_router.post("/tasks", status_code=status.HTTP_201_CREATED, tags=[Tag.TASK])
@secure_router.post("/tasks", status_code=status.HTTP_201_CREATED)
@start_as_current_span(
TRACER,
"request",
Expand Down Expand Up @@ -330,9 +330,7 @@ def submit_task(
@secure_router_v1.delete(
"/tasks/{task_id}", status_code=status.HTTP_200_OK, tags=[Tag.TASK]
)
@secure_router.delete(
"/tasks/{task_id}", status_code=status.HTTP_200_OK, tags=[Tag.TASK]
)
@secure_router.delete("/tasks/{task_id}", status_code=status.HTTP_200_OK)
@start_as_current_span(TRACER, "task_id")
def delete_submitted_task(
task_id: str,
Expand All @@ -350,7 +348,7 @@ def validate_task_status(v: str) -> TaskStatusEnum:


@secure_router_v1.get("/tasks", status_code=status.HTTP_200_OK, tags=[Tag.TASK])
@secure_router.get("/tasks", status_code=status.HTTP_200_OK, tags=[Tag.TASK])
@secure_router.get("/tasks", status_code=status.HTTP_200_OK)
@start_as_current_span(TRACER)
def get_tasks(
runner: Annotated[WorkerDispatcher, Depends(_runner)],
Expand Down Expand Up @@ -384,7 +382,6 @@ def get_tasks(
@secure_router.put(
"/worker/task",
responses={status.HTTP_409_CONFLICT: {}},
tags=[Tag.TASK],
)
@start_as_current_span(TRACER, "task.task_id")
def set_active_task(
Expand Down Expand Up @@ -416,7 +413,7 @@ def get_passthrough_headers(request: Request) -> dict[str, str]:


@secure_router_v1.get("/tasks/{task_id}", tags=[Tag.TASK])
@secure_router.get("/tasks/{task_id}", tags=[Tag.TASK])
@secure_router.get("/tasks/{task_id}")
@start_as_current_span(TRACER, "task_id")
def get_task(
task_id: str,
Expand All @@ -435,7 +432,6 @@ def get_task(
)
@secure_router.get(
"/worker/task",
tags=[Tag.TASK],
)
@start_as_current_span(TRACER)
def get_active_task(
Expand All @@ -452,7 +448,6 @@ def get_active_task(
)
@secure_router.get(
"/worker/state",
tags=[Tag.TASK],
)
@start_as_current_span(TRACER)
def get_state(runner: Annotated[WorkerDispatcher, Depends(_runner)]) -> WorkerState:
Expand Down Expand Up @@ -491,7 +486,6 @@ def get_state(runner: Annotated[WorkerDispatcher, Depends(_runner)]) -> WorkerSt
status.HTTP_400_BAD_REQUEST: {},
status.HTTP_202_ACCEPTED: {},
},
tags=[Tag.TASK],
)
@start_as_current_span(TRACER, "state_change_request.new_state")
def set_state(
Expand Down Expand Up @@ -543,7 +537,7 @@ def set_state(


@secure_router_v1.get("/python_environment", tags=[Tag.ENV])
@secure_router.get("/python_environment", tags=[Tag.ENV])
@secure_router.get("/python_environment")
@start_as_current_span(TRACER)
def get_python_environment(
runner: Annotated[WorkerDispatcher, Depends(_runner)],
Expand Down
Loading