无法列出 GCP 资源的标签绑定。

huangapple go评论76阅读模式
英文:

Unable to list tag bindings for a GCP resource

问题

我正在尝试使用 Python 客户端库 resourcemanager_v3.TagBindingsClient 列出计算实例的标签绑定,但它要求一个位置参数,而在文档中提供的请求参数中没有这个参数。我以为如果我提供实例的完整 URL,它会将实例的位置作为位置参数,但结果仍然出现了相同的错误。这是我的代码:

client = resourcemanager_v3.TagBindingsClient()
request = resourcemanager_v3.ListEffectiveTagsRequest(
    parent = "//compute.googleapis.com/projects/{projectId}/zones/{zone}/instances/{instanceId}"
)
page_result = client.list_effective_tags(request = request)

for response in page_result:
    print(response)

我检查了列出标签绑定的 REST API,但它也没有位置参数。是否有解决方法?

英文:

I'm trying to list tag bindings for a compute instance using python client libraries resourcemanager_v3.TagBindingsClient
but it is asking for a location parameter, which is not there in the request parameters provided in the docs. I thought that It will take the location of the instance as the location parameter if I provide the full URL of the instance but it results in the same error. Here's my code

client = resourcemanager_v3.TagBindingsClient()
request = resourcemanager_v3.ListEffectiveTagsRequest(
    parent = "//compute.googleapis.com/projects/{projectId}/zones/{zone}/instances/{instanceId}"
)
page_result = client.list_effective_tags(request = request)

for response in page_result:
    print(response)

I checked REST API for list tag bindings but it doesn't have location argument as well. Is there any solution for this?

答案1

得分: 1

很抱歉,对于 list_effective_tags 函数,没有位置参数。这是 Terraform 中的一个问题,他们在 Terraform 中已经解决了这个问题,但是在 Python 客户端库中尚未解决。

英文:

Unfortunately there is no location parameter for list_effective_tags. This was an issue in terraform and they solved it but not on python client libraries

huangapple
  • 本文由 发表于 2023年7月3日 21:54:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605425.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定