List networks in region

Retrieves a list of VMWare Engine networks defined in given region.

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_networks(
    project_id: str, region: str
) -> Iterable[vmwareengine_v1.VmwareEngineNetwork]:
    """
    Retrieves a list of VMware Engine networks defined in given region.

    Args:
        project_id: name of the project you want to use.
        region: name of the region for which you want to list networks.

    Returns:
        An iterable collection containing the VMWareEngineNetworks.
    """
    client = vmwareengine_v1.VmwareEngineClient()

    return client.list_vmware_engine_networks(
        parent=f"projects/{project_id}/locations/{region}"
    )

What's next

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