我们代表 (OAuth2) 用户在 Google Cloud 上部署我们的软件。我们已经设法将其中的大部分自动化,但缺少一点。
- 使用https://godoc.org/google.golang.org/api/cloudresourcemanager/v1#ProjectsService.Create完成创建项目
- 使用 google.golang.org/api/servicemanagement/v1#ServicesService.Enable 启用所需的 API(计算、存储等)(由于非常明亮的 SO 限制,无法发布为完整链接)
- 使用 google.golang.org/api/compute/v1#InstancesService.Insert 创建实例
缺少的部分在第 1 步和第 2 步之间:为了使用Service Management API to enable the needed APIs
,我们需要在项目上启用服务管理 API 本身(多么讽刺)。我希望必须有一种方法可以创建一个从一开始就启用了一些 API 的项目,可能使用 cloudresourcemanager,或者可能使用https://godoc.org/google.golang.org/api/deploymentmanager/v2,但我到目前为止还没有找到它。
所以,重申一下:有谁知道是否可以(在 Go 中)创建一个谷歌云项目,并在创建时/之后启用一些特定的谷歌云 API?