【问题标题】:How to query for shared VPC networks?如何查询共享 VPC 网络?
【发布时间】:2020-02-10 21:57:11
【问题描述】:

如何查看共享 VPC 中可供我使用的网络/子网列表?以下仅返回当前项目中的子网列表,不共享给它:

from googleapiclient.discovery import build
compute = build('compute', 'v1')
compute.networks().list(project='project').execute()
compute.subnetworks().listUsable(project='project').execute()

【问题讨论】:

    标签: python google-cloud-platform google-compute-engine google-api-client


    【解决方案1】:

    考虑到all of the existing VPC networks in the host project are Shared VPC networks,您可以使用getXpnHost method from the REST API 来获取您的项目链接到的共享VPC 宿主项目,并使用相同的networks().list()subnetworks().listUsable() 来获取所需的信息。

    【讨论】:

    • 谢谢!不幸的是,这似乎是唯一的方法
    猜你喜欢
    • 2020-10-14
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多