def get_netinfo_for_filesystem()

in source/api/app.py [0:0]


def get_netinfo_for_filesystem(filesystem_id):
    """
    Retrieves network info for a specified filesystem

    :param filesystem_id: The filesystem to get net info for
    :returns: Filesystem network info
    :raises ChaliceViewError
    """
    netinfo = []
    try:
        response = EFS.describe_mount_targets(
            FileSystemId=filesystem_id
        )
    except botocore.exceptions.ClientError as error:
        app.log.debug(error)
        raise ChaliceViewError
    else:
        mount_targets = response['MountTargets']
        app.log.debug(mount_targets)
        for target in mount_targets:
            mount_target_id = target['MountTargetId']
            try:
                response = EFS.describe_mount_target_security_groups(
                    MountTargetId=mount_target_id
                )
            except botocore.exceptions.ClientError as error:
                app.log.debug(error)
                raise ChaliceViewError
            else:
                security_groups = response['SecurityGroups']
                vpc_item = {'{id}'.format(id=mount_target_id): {'security_groups': \
                    security_groups, 'subnet_id': target['SubnetId']}}
                netinfo.append(vpc_item)

    return netinfo