remove dead code in aws.py - execute_with_async_client (#2287)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
from typing import IO, Any, Callable
|
from typing import IO, Any
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import aioboto3
|
import aioboto3
|
||||||
@@ -16,20 +16,6 @@ class AWSClientType(StrEnum):
|
|||||||
ECS = "ecs"
|
ECS = "ecs"
|
||||||
|
|
||||||
|
|
||||||
def execute_with_async_client(client_type: AWSClientType) -> Callable:
|
|
||||||
def decorator(f: Callable) -> Callable:
|
|
||||||
async def wrapper(*args: list[Any], **kwargs: dict[str, Any]) -> Any:
|
|
||||||
self = args[0]
|
|
||||||
assert isinstance(self, AsyncAWSClient)
|
|
||||||
session = aioboto3.Session()
|
|
||||||
async with session.client(client_type, region_name=settings.AWS_REGION) as client:
|
|
||||||
return await f(*args, client=client, **kwargs)
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
|
|
||||||
class AsyncAWSClient:
|
class AsyncAWSClient:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user