feat(chalice): refactored s3 client
This commit is contained in:
parent
42d97bef13
commit
b7e6a237e4
4 changed files with 9 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from decouple import config
|
||||
|
||||
from chalicelib.utils.s3 import client
|
||||
from chalicelib.utils import s3
|
||||
|
||||
|
||||
def __get_devtools_keys(project_id, session_id):
|
||||
|
|
@ -16,7 +16,7 @@ def __get_devtools_keys(project_id, session_id):
|
|||
def get_urls(session_id, project_id):
|
||||
results = []
|
||||
for k in __get_devtools_keys(project_id=project_id, session_id=session_id):
|
||||
results.append(client.generate_presigned_url(
|
||||
results.append(s3.client.generate_presigned_url(
|
||||
'get_object',
|
||||
Params={'Bucket': config("sessions_bucket"), 'Key': k},
|
||||
ExpiresIn=config("PRESIGNED_URL_EXPIRATION", cast=int, default=900)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from decouple import config
|
||||
|
||||
from chalicelib.utils import s3
|
||||
from chalicelib.utils.s3 import client
|
||||
|
||||
|
||||
def __get_mob_keys(project_id, session_id):
|
||||
|
|
@ -22,7 +21,7 @@ def __get_mob_keys_deprecated(session_id):
|
|||
def get_urls(project_id, session_id):
|
||||
results = []
|
||||
for k in __get_mob_keys(project_id=project_id, session_id=session_id):
|
||||
results.append(client.generate_presigned_url(
|
||||
results.append(s3.client.generate_presigned_url(
|
||||
'get_object',
|
||||
Params={'Bucket': config("sessions_bucket"), 'Key': k},
|
||||
ExpiresIn=config("PRESIGNED_URL_EXPIRATION", cast=int, default=900)
|
||||
|
|
@ -33,7 +32,7 @@ def get_urls(project_id, session_id):
|
|||
def get_urls_depercated(session_id):
|
||||
results = []
|
||||
for k in __get_mob_keys_deprecated(session_id=session_id):
|
||||
results.append(client.generate_presigned_url(
|
||||
results.append(s3.client.generate_presigned_url(
|
||||
'get_object',
|
||||
Params={'Bucket': config("sessions_bucket"), 'Key': k},
|
||||
ExpiresIn=100000
|
||||
|
|
@ -42,7 +41,7 @@ def get_urls_depercated(session_id):
|
|||
|
||||
|
||||
def get_ios(session_id):
|
||||
return client.generate_presigned_url(
|
||||
return s3.client.generate_presigned_url(
|
||||
'get_object',
|
||||
Params={
|
||||
'Bucket': config("ios_bucket"),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from fastapi.security import SecurityScopes
|
|||
|
||||
import schemas_ee
|
||||
from chalicelib.core import permissions
|
||||
from chalicelib.utils.s3 import client
|
||||
from chalicelib.utils import s3
|
||||
|
||||
SCOPES = SecurityScopes([schemas_ee.Permissions.dev_tools])
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ def get_urls(session_id, project_id, context: schemas_ee.CurrentContext):
|
|||
return []
|
||||
results = []
|
||||
for k in __get_devtools_keys(project_id=project_id, session_id=session_id):
|
||||
results.append(client.generate_presigned_url(
|
||||
results.append(s3.client.generate_presigned_url(
|
||||
'get_object',
|
||||
Params={'Bucket': config("sessions_bucket"), 'Key': k},
|
||||
ExpiresIn=config("PRESIGNED_URL_EXPIRATION", cast=int, default=900)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from decouple import config
|
||||
|
||||
from chalicelib.utils.s3 import client
|
||||
from chalicelib.utils import s3
|
||||
|
||||
|
||||
def tag_session(file_key, tag_key='retention', tag_value='vault'):
|
||||
|
|
@ -8,7 +8,7 @@ def tag_session(file_key, tag_key='retention', tag_value='vault'):
|
|||
|
||||
|
||||
def tag_file(file_key, bucket, tag_key, tag_value):
|
||||
return client.put_object_tagging(
|
||||
return s3.client.put_object_tagging(
|
||||
Bucket=bucket,
|
||||
Key=file_key,
|
||||
Tagging={
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue