def get_cluster_console_url()

in src/hyperpod_cli/utils.py [0:0]


def get_cluster_console_url():
    hyperpod_context_cluster = _retrieve_current_hyperpod_context()
    console_url = None
    if (
        hyperpod_context_cluster
        and hyperpod_context_cluster.get("ClusterArn")
        and hyperpod_context_cluster.get("ClusterName")
    ):
        region = hyperpod_context_cluster.get("ClusterArn").split(":")[3]
        cluster_name = hyperpod_context_cluster.get("ClusterName")

        console_url = (
            f"https://{region}.console.aws.amazon.com/sagemaker/"
            f"home?region={region}#/cluster-management/{cluster_name}"
        )
        if _validate_link(console_url) and validate_region_and_cluster_name(region, cluster_name):
            return console_url
    return None