Skip to content

Commit 2b7454f

Browse files
NRL-2055 add all interactions by default to s3 perms for v2 feature tests
1 parent 6b598d2 commit 2b7454f

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

scripts/get_s3_permissions.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
import fire
77
from aws_session_assume import get_boto_session
88

9-
from nrlf.core.constants import AccessControls, PointerTypes
9+
from nrlf.core.constants import (
10+
AccessControls,
11+
ConsumerApiInteractions,
12+
PointerTypes,
13+
ProducerApiInteractions,
14+
)
1015

1116

1217
def get_file_folders(s3_client, bucket_name, prefix=""):
@@ -49,10 +54,29 @@ def add_test_files(folder, file_name, local_path):
4954
json.dump(PointerTypes.list(), f)
5055

5156

52-
def _write_permission_file(folder_path, ods_code, pointer_types, access_controls=None):
57+
def _get_default_interactions(folder_path):
58+
if "producer" in str(folder_path):
59+
return ProducerApiInteractions.list()
60+
return ConsumerApiInteractions.list()
61+
62+
63+
def _write_permission_file(
64+
folder_path,
65+
ods_code,
66+
pointer_types,
67+
access_controls=None,
68+
interactions=None,
69+
):
5370
folder_path.mkdir(parents=True, exist_ok=True)
5471
with open(folder_path / f"{ods_code}.json", "w") as f:
55-
json.dump({"access_controls": access_controls or [], "types": pointer_types}, f)
72+
json.dump(
73+
{
74+
"access_controls": access_controls or [],
75+
"interactions": interactions or _get_default_interactions(folder_path),
76+
"types": pointer_types,
77+
},
78+
f,
79+
)
5680

5781

5882
def add_feature_test_files(local_path):

0 commit comments

Comments
 (0)