-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ web-api interface for tags sharing and add to services (#6298)
- Loading branch information
Showing
17 changed files
with
3,782 additions
and
3,097 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# pylint: disable=redefined-outer-name | ||
# pylint: disable=unused-argument | ||
# pylint: disable=unused-variable | ||
# pylint: disable=too-many-arguments | ||
|
||
|
||
from typing import Annotated | ||
|
||
from fastapi import APIRouter, Depends | ||
from models_library.api_schemas_webserver.catalog import CatalogServiceGet | ||
from models_library.generics import Envelope | ||
from simcore_service_webserver._meta import API_VTAG | ||
from simcore_service_webserver.catalog._tags_handlers import ( | ||
ServicePathParams, | ||
ServiceTagPathParams, | ||
) | ||
from simcore_service_webserver.tags.schemas import TagGet | ||
|
||
router = APIRouter( | ||
prefix=f"/{API_VTAG}", | ||
tags=[ | ||
"catalog", | ||
"tags", | ||
], | ||
) | ||
|
||
|
||
@router.get( | ||
"/catalog/services/{service_key}/{service_version}/tags", | ||
response_model=Envelope[list[TagGet]], | ||
) | ||
def list_service_tags( | ||
_path_params: Annotated[ServicePathParams, Depends()], | ||
): | ||
... | ||
|
||
|
||
@router.post( | ||
"/catalog/services/{service_key}/{service_version}/tags/{tag_id}:add", | ||
response_model=Envelope[CatalogServiceGet], | ||
) | ||
def add_service_tag( | ||
_path_params: Annotated[ServiceTagPathParams, Depends()], | ||
): | ||
... | ||
|
||
|
||
@router.post( | ||
"/catalog/services/{service_key}/{service_version}/tags/{tag_id}:remove", | ||
response_model=Envelope[CatalogServiceGet], | ||
) | ||
def remove_service_tag( | ||
_path_params: Annotated[ServiceTagPathParams, Depends()], | ||
): | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,7 @@ | |
|
||
router = APIRouter( | ||
prefix=f"/{API_VTAG}", | ||
tags=[ | ||
"projects", | ||
], | ||
tags=["projects", "groups"], | ||
) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# pylint: disable=redefined-outer-name | ||
# pylint: disable=unused-argument | ||
# pylint: disable=unused-variable | ||
# pylint: disable=too-many-arguments | ||
|
||
|
||
from typing import Annotated | ||
|
||
from fastapi import APIRouter, Depends, status | ||
from models_library.generics import Envelope | ||
from simcore_service_webserver._meta import API_VTAG | ||
from simcore_service_webserver.tags.schemas import ( | ||
TagGet, | ||
TagGroupCreate, | ||
TagGroupGet, | ||
TagGroupPathParams, | ||
TagPathParams, | ||
) | ||
|
||
router = APIRouter( | ||
prefix=f"/{API_VTAG}", | ||
tags=[ | ||
"tags", | ||
"groups", | ||
], | ||
) | ||
|
||
|
||
@router.get( | ||
"/tags/{tag_id}/groups", | ||
response_model=Envelope[list[TagGroupGet]], | ||
) | ||
async def list_tag_groups(_path_params: Annotated[TagPathParams, Depends()]): | ||
... | ||
|
||
|
||
@router.post( | ||
"/tags/{tag_id}/groups/{group_id}", | ||
response_model=Envelope[TagGet], | ||
status_code=status.HTTP_201_CREATED, | ||
) | ||
async def create_tag_group( | ||
_path_params: Annotated[TagGroupPathParams, Depends()], _body: TagGroupCreate | ||
): | ||
... | ||
|
||
|
||
@router.put( | ||
"/tags/{tag_id}/groups/{group_id}", | ||
response_model=Envelope[list[TagGroupGet]], | ||
) | ||
async def replace_tag_groups( | ||
_path_params: Annotated[TagGroupPathParams, Depends()], _body: TagGroupCreate | ||
): | ||
... | ||
|
||
|
||
@router.delete( | ||
"/tags/{tag_id}/groups/{group_id}", | ||
status_code=status.HTTP_204_NO_CONTENT, | ||
) | ||
async def delete_tag_group(_path_params: Annotated[TagGroupPathParams, Depends()]): | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.