Skip to content

Commit 1e47ab9

Browse files
rename endpoint for clarity
1 parent 9525160 commit 1e47ab9

File tree

6 files changed

+44
-13
lines changed

6 files changed

+44
-13
lines changed

docs/local_installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Try out the API at <http://localhost:8080/_status> or <http://localhost:8080/doc
7171
7272
## Run Nextflow workflows with Gen3Workflow
7373

74-
- Hit the `/storage/info` endpoint to get your working directory
74+
- Hit the `/storage/setup` endpoint to get your working directory
7575
- Configure Nextflow. Example Nextflow configuration:
7676
```
7777
plugins {

docs/openapi.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,35 @@ paths:
498498
- S3
499499
/storage/info:
500500
get:
501-
description: Get details about the current user's storage setup
501+
description: 'Return details about the current user''s storage setup.
502+
503+
This endpoint also serves as a mandatory "first time setup" for the user''s
504+
bucket
505+
506+
and authz.'
507+
operationId: get_storage_info_2
508+
responses:
509+
'200':
510+
content:
511+
application/json:
512+
schema:
513+
additionalProperties: true
514+
title: Response Get Storage Info 2
515+
type: object
516+
description: Successful Response
517+
security:
518+
- HTTPBearer: []
519+
summary: Get Storage Info
520+
tags:
521+
- Storage
522+
/storage/setup:
523+
get:
524+
description: 'Return details about the current user''s storage setup.
525+
526+
This endpoint also serves as a mandatory "first time setup" for the user''s
527+
bucket
528+
529+
and authz.'
502530
operationId: get_storage_info
503531
responses:
504532
'200':

gen3workflow/aws_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def create_iam_role_for_bucket_access(user_id: str) -> str:
226226
if config["KMS_ENCRYPTION_ENABLED"]:
227227
_, kms_key_arn = get_existing_kms_key_for_bucket(bucket_name)
228228
if not kms_key_arn:
229-
err_msg = "Bucket misconfigured. Hit the `GET /storage/info` endpoint and try again."
229+
err_msg = "Bucket misconfigured. Hit the `GET /storage/setup` endpoint and try again."
230230
logger.error(
231231
f"No existing KMS key found for bucket '{bucket_name}'. {err_msg}"
232232
)

gen3workflow/routes/s3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ async def s3_endpoint(path: str, request: Request):
282282
if config["KMS_ENCRYPTION_ENABLED"] and request.method == "PUT":
283283
_, kms_key_arn = aws_utils.get_existing_kms_key_for_bucket(user_bucket)
284284
if not kms_key_arn:
285-
err_msg = "Bucket misconfigured. Hit the `GET /storage/info` endpoint and try again."
285+
err_msg = "Bucket misconfigured. Hit the `GET /storage/setup` endpoint and try again."
286286
logger.error(
287287
f"No existing KMS key found for bucket '{user_bucket}'. {err_msg}"
288288
)

gen3workflow/routes/storage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
router = APIRouter(prefix="/storage")
1616

1717

18+
# TODO: remove the /storage/info path once CI has been updated to use /storage/setup
1819
@router.get("/info", status_code=HTTP_200_OK)
1920
@router.get("/info/", status_code=HTTP_200_OK, include_in_schema=False)
21+
@router.get("/setup", status_code=HTTP_200_OK)
22+
@router.get("/setup/", status_code=HTTP_200_OK, include_in_schema=False)
2023
async def get_storage_info(request: Request, auth=Depends(Auth)) -> dict:
2124
"""
22-
Get details about the current user's storage setup.
25+
Return details about the current user's storage setup.
2326
This endpoint also serves as a mandatory "first time setup" for the user's bucket
2427
and authz.
2528
"""

tests/test_misc.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async def test_storage_info(
9898
client, access_token_patcher, mock_aws_services, trailing_slash
9999
):
100100
"""
101-
Check that S3 buckets are correctly created and configured by the `/storage/info` endpoint.
101+
Check that S3 buckets are correctly created and configured by the `/storage/setup` endpoint.
102102
When users who does not yet have access to their own data (NEW_TEST_USER_ID) hit this
103103
endpoint, calls to Arborist should be made to create resources, roles, policies and users, and to grant the users access.
104104
"""
@@ -112,9 +112,9 @@ async def test_storage_info(
112112
e.value.response.get("ResponseMetadata", {}).get("HTTPStatusCode") == 404
113113
), f"Bucket exists: {e.value}"
114114

115-
# hit the /storage/info endpoint
115+
# hit the /storage/setup endpoint
116116
res = await client.get(
117-
f"/storage/info{'/' if trailing_slash else ''}",
117+
f"/storage/setup{'/' if trailing_slash else ''}",
118118
headers={"Authorization": f"bearer {TEST_USER_TOKEN}"},
119119
)
120120
assert res.status_code == 200, res.text
@@ -130,7 +130,7 @@ async def test_storage_info(
130130
"kms_key_arn": kms_key_arn,
131131
}
132132

133-
# check that the bucket was created after the call to `/storage/info`
133+
# check that the bucket was created after the call to `/storage/setup`
134134
bucket_exists = aws_utils.s3_client.head_bucket(Bucket=expected_bucket_name)
135135
assert bucket_exists, "Bucket does not exist"
136136

@@ -242,7 +242,7 @@ async def test_bucket_enforces_encryption(
242242
the right key.
243243
"""
244244
res = await client.get(
245-
"/storage/info", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
245+
"/storage/setup", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
246246
)
247247
assert res.status_code == 200, res.text
248248
storage_info = res.json()
@@ -291,7 +291,7 @@ async def test_delete_user_bucket(
291291

292292
# Create the bucket if it doesn't exist
293293
res = await client.get(
294-
"/storage/info", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
294+
"/storage/setup", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
295295
)
296296
bucket_name = res.json()["bucket"]
297297

@@ -331,7 +331,7 @@ async def test_delete_user_bucket_with_files(
331331

332332
# Create the bucket if it doesn't exist
333333
res = await client.get(
334-
"/storage/info", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
334+
"/storage/setup", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
335335
)
336336
bucket_name = res.json()["bucket"]
337337

@@ -416,7 +416,7 @@ async def test_delete_user_bucket_objects_with_existing_files(
416416

417417
# Create the bucket if it doesn't exist
418418
res = await client.get(
419-
"/storage/info", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
419+
"/storage/setup", headers={"Authorization": f"bearer {TEST_USER_TOKEN}"}
420420
)
421421
bucket_name = res.json()["bucket"]
422422

0 commit comments

Comments
 (0)