列出区域内的网络

检索指定区域中定义的 VMWare Engine 网络列表。

代码示例

Python

如需向 VMware Engine 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证

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}"
    )

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器