简体   繁体   English

如何创建启用了服务管理API的Google Cloud项目?

[英]How to create a Google Cloud project with service management API enabled?

We're deploying our software on behalf (OAuth2) of users on Google Cloud. 我们正在Google Cloud上代表用户(OAuth2)部署我们的软件。 We've managed to automate most of it, but there's one bit that's missing. 我们已经成功实现了大部分的自动化,但有一点缺失了。

  1. Creating the project is done with https://godoc.org/google.golang.org/api/cloudresourcemanager/v1#ProjectsService.Create 使用https://godoc.org/google.golang.org/api/cloudresourcemanager/v1#ProjectsService.Create创建项目
  2. Enabling the required APIs (compute, storage, etc) is done with google.golang.org/api/servicemanagement/v1#ServicesService.Enable (can't post as full link thanks to the very bright SO limitations) 使用google.golang.org/api/servicemanagement/v1#ServicesService.Enable启用所需的API(计算,存储等)(由于非常明亮的SO限制,无法发布为完整链接)
  3. Creating the instance is done with google.golang.org/api/compute/v1#InstancesService.Insert 使用google.golang.org/api/compute/v1#InstancesService.Insert创建实例

The missing bit is between step 1 and step 2: in order to make use of the Service Management API to enable the needed APIs , we need the Service Management API itself to be enabled on the project (how ironic). 缺少的位在步骤1和步骤2之间:为了利用Service Management API to enable the needed APIs ,我们需要在项目上启用Service Management API本身(多么具有讽刺意味)。 I'm hoping there must be a way to create a project with some APIs enabled from the start, maybe with cloudresourcemanager, or maybe with https://godoc.org/google.golang.org/api/deploymentmanager/v2 , but I haven't found it so far. 我希望必须有一种方法来创建一个项目,从一开始就启用一些API,可能使用cloudresourcemanager,或者可能使用https://godoc.org/google.golang.org/api/deploymentmanager/v2 ,但我到目前为止还没有找到它。

So, to restate: does anyone know if it's possible (in Go) to create a Google Cloud project with some specific Google Cloud APIs enabled right on/after creation? 重申:有没有人知道是否可以(在Go中)创建一个Google Cloud项目,在创建之后/之后启用一些特定的Google Cloud API?

The Google Cloud Resource Manager API is very limited in what it will allow you to do. Google Cloud Resource Manager API在允许您执行的操作方面非常有限。

while it does have a projects.update method it does not support enabling APIs. 虽然它有一个projects.update方法,但它不支持启用API。 Your going to have to manually edit the project. 您将不得不手动编辑项目。

Use the Service Usage API: https://cloud.google.com/service-usage/docs/reference/rest/ 使用服务使用API​​: https//cloud.google.com/service-usage/docs/reference/rest/

(updated) (更新)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在calculateService.Zones.List(项目)Google Cloud Platform API中添加过滤器 - How to add filter in computeService.Zones.List(project) Google Cloud Platform API 使用 Google Cloud Platform 服务帐户查询 GSuite Directory API - Query GSuite Directory API with a Google Cloud Platform service account 如何使用Go API客户端以编程方式创建Google Cloud Function - How can I programmatically create a Google Cloud Function using the Go API client Google Cloud Vision API。 Golang。 如何获得API JSON - Google Cloud Vision API. Golang . How to get API JSON 如何使用 Go SDK for Google Cloud Platform 获取项目 ID? - How to get project ID using Go SDK for Google cloud platform? 如何在 Google Cloud 服务上找到 IPv4 地址? - How do I find the IPv4 address on a Google Cloud service? 如何使用 Go SDK for google cloud platform 获取项目元数据? - How to get project metadata using Go SDK for google cloud platform? 使用服务帐户域范围访问的 Google Cloud 函数调用 Gmail API - Google Cloud Function Calling Gmail API Using Service Account Domain-Wide Access 如何在Google Cloud Run for Firebase中创建上下文对象 - how to create a context object in google cloud run for firebase 将 google PubSub 与 Cloud Run gRPC 服务结合使用 - Using google PubSub with a Cloud Run gRPC service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM