forked from phoenix/litellm-mirror
sync_read_secret
This commit is contained in:
parent
8b8746c9a6
commit
dbea2eef14
1 changed files with 24 additions and 0 deletions
|
@ -94,6 +94,30 @@ class AWSSecretsManagerV2(BaseAWSLLM):
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def sync_read_secret(
|
||||||
|
self,
|
||||||
|
secret_name: str,
|
||||||
|
optional_params: Optional[dict] = None,
|
||||||
|
timeout: Optional[Union[float, httpx.Timeout]] = None,
|
||||||
|
) -> Optional[str]:
|
||||||
|
"""
|
||||||
|
Sync function to read a secret from AWS Secrets Manager
|
||||||
|
|
||||||
|
Done for backwards compatibility with existing codebase, since get_secret is a sync function
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
except RuntimeError:
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
return loop.run_until_complete(
|
||||||
|
self.async_read_secret(
|
||||||
|
secret_name=secret_name,
|
||||||
|
optional_params=optional_params,
|
||||||
|
timeout=timeout,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
async def async_write_secret(
|
async def async_write_secret(
|
||||||
self,
|
self,
|
||||||
secret_name: str,
|
secret_name: str,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue