|
6 | 6 | import fire |
7 | 7 | from aws_session_assume import get_boto_session |
8 | 8 |
|
9 | | -from nrlf.core.constants import AccessControls, PointerTypes |
| 9 | +from nrlf.core.constants import ( |
| 10 | + AccessControls, |
| 11 | + ConsumerApiInteractions, |
| 12 | + PointerTypes, |
| 13 | + ProducerApiInteractions, |
| 14 | +) |
10 | 15 |
|
11 | 16 |
|
12 | 17 | def get_file_folders(s3_client, bucket_name, prefix=""): |
@@ -49,10 +54,29 @@ def add_test_files(folder, file_name, local_path): |
49 | 54 | json.dump(PointerTypes.list(), f) |
50 | 55 |
|
51 | 56 |
|
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 | +): |
53 | 70 | folder_path.mkdir(parents=True, exist_ok=True) |
54 | 71 | 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 | + ) |
56 | 80 |
|
57 | 81 |
|
58 | 82 | def add_feature_test_files(local_path): |
|
0 commit comments