in cli/src/pcluster/schemas/cluster_schema.py [0:0]
def make_resource(self, data, **kwargs):
"""Generate the right type of shared storage according to the child type (EBS vs EFS vs FsxLustre)."""
storage_type = data.get("storage_type")
shared_volume_attributes = {"mount_dir": data.get("mount_dir"), "name": data.get("name")}
settings = (
data.get("efs_settings", None)
or data.get("ebs_settings", None)
or data.get("fsx_lustre_settings", None)
or data.get("fsx_open_zfs_settings", None)
or data.get("fsx_ontap_settings", None)
or data.get("file_cache_settings", None)
)
if settings:
shared_volume_attributes.update(**settings)
if storage_type == "Efs":
return SharedEfs(**shared_volume_attributes)
elif storage_type == "Ebs":
return SharedEbs(**shared_volume_attributes)
elif storage_type == FSX_LUSTRE:
return SharedFsxLustre(**shared_volume_attributes)
elif storage_type == FSX_OPENZFS:
return ExistingFsxOpenZfs(**shared_volume_attributes)
elif storage_type == FSX_ONTAP:
return ExistingFsxOntap(**shared_volume_attributes)
elif storage_type == FILE_CACHE:
return ExistingFileCache(**shared_volume_attributes)
return None