使用Go客户端库创建实例组时无法定义网络?

时间:2015-12-16 18:02:51

标签: go google-compute-engine google-cloud-platform

通过GCP控制台创建非托管实例组时,我可以看到REST请求为:

POST https://www.googleapis.com/compute/v1/projects/my-project/zones/us-east1-d/instanceGroups
{
  "name": "ig-web",
  "network": "https://www.googleapis.com/compute/v1/projects/my-project/global/networks/nomad-network",
  "namedPorts": [
    {
      "name": "http",
      "port": 11080
    }
  ]
}

但是,according to the API docsclient library generated code,无法设置network网址。

有人在意澄清吗?

1 个答案:

答案 0 :(得分:0)

这实际上是一个文档错误。以下内容适用:

op, err := gce.service.InstanceGroups.Insert(projectID, zone, &compute.InstanceGroup{
        Name:       name,
        NamedPorts: namedPorts,
        Network:    networkURL}).Do()