在GCP中查询项目列表

时间:2019-12-26 21:27:33

标签: google-cloud-platform

我正在尝试gcp的python SDK。这是一个简单的脚本,适用于名为“ my-project-name”的项目。

如果要获取组织中每个项目的清单该怎么办?

非常感谢

from oauth2client.client import GoogleCredentials
from googleapiclient import discovery

from pprint import pprint
from oauth2client.client import GoogleCredentials
from googleapiclient import discovery

credentials = GoogleCredentials.get_application_default()
service = discovery.build('cloudresourcemanager', 'v1', credentials=credentials)
project_id = 'my-project-name'
request = service.projects().get(projectId=project_id)
response = request.execute()
pprint(response)


0 个答案:

没有答案