Skip to content

Commit 235693f

Browse files
authored
Merge pull request #2 from AllenInstitute/feature/add-tags-to-filter-efs-mount-point-config
Adding optional tags to filter on mount point config build function
2 parents ebccbe2 + a1e39b1 commit 235693f

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/aibs_informatics_aws_utils/efs/mount_point.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,27 @@ def build(
237237
mount_point: StrPath,
238238
access_point: Optional[Union[str, AccessPointDescriptionTypeDef]] = None,
239239
file_system: Optional[Union[str, FileSystemDescriptionTypeDef]] = None,
240+
access_point_tags: Optional[Dict[str, str]] = None,
241+
file_system_tags: Optional[Dict[str, str]] = None,
240242
) -> MountPointConfiguration:
241243
"""Creates a new config from the given mount point and access point or file system.
242244
245+
Important: Must provide either access point or file system.
246+
243247
Args:
244248
mount_point (StrPath): Intended mount point of the EFS file system on the host.
245-
access_point (Optional[Union[str, AccessPointDescriptionTypeDef]]): Identifier of the access point or the access point description. If specified as a string, can be either the access point id or name. Defaults to None.
246-
file_system (Optional[Union[str, FileSystemDescriptionTypeDef]]): Identifier of the file system or the file system description. If specified as a string, can be either the file system id or name. Defaults to None.
247-
249+
access_point (Optional[Union[str, AccessPointDescriptionTypeDef]]):
250+
Identifier of the access point or the access point description.
251+
If specified as a string, can be either the access point id or name.
252+
Defaults to None.
253+
file_system (Optional[Union[str, FileSystemDescriptionTypeDef]]):
254+
Identifier of the file system or the file system description.
255+
If specified as a string, can be either the file system id or name.
256+
Defaults to None.
257+
access_point_tags (Optional[Dict[str, str]]): Tags to filter the access point.
258+
Defaults to None.
259+
file_system_tags (Optional[Dict[str, str]]): Tags to filter the file system.
260+
Defaults to None.
248261
Raises:
249262
ValueError: if neither access point nor file system is provided.
250263
@@ -263,7 +276,9 @@ def build(
263276
if FileSystemId.is_valid(file_system)
264277
else (None, file_system)
265278
)
266-
file_system = get_efs_file_system(name=fs_name, file_system_id=fs_id)
279+
file_system = get_efs_file_system(
280+
name=fs_name, file_system_id=fs_id, tags=file_system_tags
281+
)
267282
file_system_id = file_system["FileSystemId"]
268283
logger.info(f"Resolved file system id {file_system_id}")
269284

@@ -279,6 +294,7 @@ def build(
279294
access_point_name=ap_name,
280295
access_point_id=ap_id,
281296
file_system_id=file_system_id,
297+
access_point_tags=access_point_tags,
282298
)
283299
access_point_id = access_point.get("AccessPointId")
284300
logger.info(f"Resolved access point id {access_point_id}")

0 commit comments

Comments
 (0)