List VMWare Engine clusters

Retrieves a list of clusters in private cloud.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

Python

To authenticate to VMware Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

from typing import Iterable

from google.cloud import vmwareengine_v1


def list_clusters(
    project_id: str, zone: str, private_cloud_name: str
) -> Iterable[vmwareengine_v1.Cluster]:
    """
    Retrieves a list of clusters in private cloud.

    Args:
        project_id: name of the project hosting the private cloud.
        zone: zone in which the private cloud is located.
        private_cloud_name: name of the cloud of which you want to list cluster.

    Returns:
        An iterable collection of Cluster objects.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    return client.list_clusters(
        parent=f"projects/{project_id}/locations/{zone}/privateClouds/{private_cloud_name}"
    )

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.