Skip to content

Commit

Permalink
add presigned put url creation
Browse files Browse the repository at this point in the history
  • Loading branch information
sblack-usu committed Jan 7, 2024
1 parent b326127 commit 8943683
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions app/api/subsetter/app/routers/storage/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,19 @@


@router.get('/presigned/get/{workflow_id}', description="Create a download url")
async def presigned_put_minio(workflow_params: WorkflowDep):
async def presigned_get_minio(workflow_params: WorkflowDep):
submission = workflow_params.user.get_submission(workflow_params.workflow_id)
url = get_minio_client().presigned_get_object(
workflow_params.user.username, f"argo_workflows/{submission.workflow_name}/{submission.workflow_id}/all.gz"
)
return {'url': url}


'''
@router.post('/bucket/create')
async def create_user_bucket(
user: User = Depends(current_active_user), description="Creates a bucket named with the username"
):
if not get_minio_client().bucket_exists(user.username):
get_minio_client().make_bucket(user.username)
@router.get('/upload/{user_name}/workflow/{workflow_id}')
async def share_workflow_with_user(
user_name: str, workflow_params: WorkflowDep, user: User = Depends(current_active_user)
):
submission: Submission = workflow_params.submission
submission.add_user(user_name)
await user.update_submission(submission)
return User.get(user.document_id)
@router.get('/remove/{user_name}/workflow/{workflow_id}')
async def share_workflow_with_user(
user_name: str, workflow_params: WorkflowDep, user: User = Depends(current_active_user)
):
submission: Submission = workflow_params.submission
submission.remove_user(user_name)
await user.update_submission(submission)
return User.get(document_id=user.document_id)
'''
@router.get('/presigned/put/{bucket}', description="Create a PUT file presigned url")
async def presigned_put_minio(bucket: str, path: str):
url = get_minio_client().presigned_put_object(bucket, path)
return {'url': url}


# @router.post('/extract/{workflow_id}')
# async def extract_workflow_artifact(workflow_params: WorkflowDep) -> SubmissionResponseModel:
Expand Down

0 comments on commit 8943683

Please sign in to comment.