Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion api/specs/web-server/_auth_api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from models_library.generics import Envelope
from models_library.rest_error import EnvelopedError
from simcore_service_webserver._meta import API_VTAG
from simcore_service_webserver.api_keys._controller_rest import ApiKeysPathParams
from simcore_service_webserver.api_keys._exceptions_handlers import _TO_HTTP_ERROR_MAP
from simcore_service_webserver.api_keys._rest import ApiKeysPathParams

router = APIRouter(
prefix=f"/{API_VTAG}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,40 +180,6 @@ async def delete_api_key(
await conn.execute(stmt)


async def delete_by_name(
app: web.Application,
connection: AsyncConnection | None = None,
*,
display_name: str,
user_id: UserID,
product_name: ProductName,
) -> None:
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
stmt = api_keys.delete().where(
(api_keys.c.user_id == user_id)
& (api_keys.c.display_name == display_name)
& (api_keys.c.product_name == product_name)
)
await conn.execute(stmt)


async def delete_by_key(
app: web.Application,
connection: AsyncConnection | None = None,
*,
api_key: str,
user_id: UserID,
product_name: ProductName,
) -> None:
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
stmt = api_keys.delete().where(
(api_keys.c.user_id == user_id)
& (api_keys.c.api_key == api_key)
& (api_keys.c.product_name == product_name)
)
await conn.execute(stmt)


async def prune_expired(
app: web.Application, connection: AsyncConnection | None = None
) -> list[str]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ..products.plugin import setup_products
from ..rabbitmq import setup_rabbitmq
from ..rest.plugin import setup_rest
from . import _rest, _rpc
from . import _controller_rest, _controller_rpc

_logger = logging.getLogger(__name__)

Expand All @@ -26,9 +26,9 @@ def setup_api_keys(app: web.Application):

# http api
setup_rest(app)
app.router.add_routes(_rest.routes)
app.router.add_routes(_controller_rest.routes)

# rpc api
setup_rabbitmq(app)
if app[APP_SETTINGS_KEY].WEBSERVER_RABBITMQ:
app.on_startup.append(_rpc.register_rpc_routes_on_startup)
app.on_startup.append(_controller_rpc.register_rpc_routes_on_startup)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""
Scheduled task that periodically runs prune in the garbage collector service
Scheduled task that periodically runs prune in the garbage collector service

"""

import asyncio
import logging
from collections.abc import AsyncIterator, Callable
Expand All @@ -11,7 +12,7 @@
from tenacity.before_sleep import before_sleep_log
from tenacity.wait import wait_exponential

from ..api_keys.api import prune_expired_api_keys
from ..api_keys.service_api_keys import prune_expired_api_keys

logger = logging.getLogger(__name__)

Expand Down
Loading