Merge pull request #10453 from danawillow/google-ilb

providers/google: Add support for Internal Load Balancing
This commit is contained in:
Paddy 2016-12-12 09:47:20 -08:00 committed by GitHub
commit 8d046c766c
31 changed files with 26356 additions and 1369 deletions

View File

@ -69,6 +69,7 @@ func Provider() terraform.ResourceProvider {
"google_compute_forwarding_rule": resourceComputeForwardingRule(),
"google_compute_global_address": resourceComputeGlobalAddress(),
"google_compute_global_forwarding_rule": resourceComputeGlobalForwardingRule(),
"google_compute_health_check": resourceComputeHealthCheck(),
"google_compute_http_health_check": resourceComputeHttpHealthCheck(),
"google_compute_https_health_check": resourceComputeHttpsHealthCheck(),
"google_compute_image": resourceComputeImage(),
@ -78,6 +79,7 @@ func Provider() terraform.ResourceProvider {
"google_compute_instance_template": resourceComputeInstanceTemplate(),
"google_compute_network": resourceComputeNetwork(),
"google_compute_project_metadata": resourceComputeProjectMetadata(),
"google_compute_region_backend_service": resourceComputeRegionBackendService(),
"google_compute_route": resourceComputeRoute(),
"google_compute_ssl_certificate": resourceComputeSslCertificate(),
"google_compute_subnetwork": resourceComputeSubnetwork(),

View File

@ -28,10 +28,16 @@ func resourceComputeForwardingRule() *schema.Resource {
"target": &schema.Schema{
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: false,
},
"backend_service": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -52,12 +58,33 @@ func resourceComputeForwardingRule() *schema.Resource {
Computed: true,
},
"load_balancing_scheme": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: "EXTERNAL",
},
"network": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"port_range": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"ports": &schema.Schema{
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Set: schema.HashString,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -76,6 +103,13 @@ func resourceComputeForwardingRule() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"subnetwork": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
},
}
}
@ -93,13 +127,24 @@ func resourceComputeForwardingRuleCreate(d *schema.ResourceData, meta interface{
return err
}
ps := d.Get("ports").(*schema.Set).List()
ports := make([]string, 0, len(ps))
for _, v := range ps {
ports = append(ports, v.(string))
}
frule := &compute.ForwardingRule{
IPAddress: d.Get("ip_address").(string),
IPProtocol: d.Get("ip_protocol").(string),
Description: d.Get("description").(string),
Name: d.Get("name").(string),
PortRange: d.Get("port_range").(string),
Target: d.Get("target").(string),
BackendService: d.Get("backend_service").(string),
IPAddress: d.Get("ip_address").(string),
IPProtocol: d.Get("ip_protocol").(string),
Description: d.Get("description").(string),
LoadBalancingScheme: d.Get("load_balancing_scheme").(string),
Name: d.Get("name").(string),
Network: d.Get("network").(string),
PortRange: d.Get("port_range").(string),
Ports: ports,
Subnetwork: d.Get("subnetwork").(string),
Target: d.Get("target").(string),
}
log.Printf("[DEBUG] ForwardingRule insert request: %#v", frule)
@ -186,10 +231,15 @@ func resourceComputeForwardingRuleRead(d *schema.ResourceData, meta interface{})
d.Set("name", frule.Name)
d.Set("target", frule.Target)
d.Set("backend_service", frule.BackendService)
d.Set("description", frule.Description)
d.Set("load_balancing_scheme", frule.LoadBalancingScheme)
d.Set("network", frule.Network)
d.Set("port_range", frule.PortRange)
d.Set("ports", frule.Ports)
d.Set("project", project)
d.Set("region", region)
d.Set("subnetwork", frule.Subnetwork)
d.Set("ip_address", frule.IPAddress)
d.Set("ip_protocol", frule.IPProtocol)
d.Set("self_link", frule.SelfLink)

View File

@ -50,6 +50,27 @@ func TestAccComputeForwardingRule_ip(t *testing.T) {
})
}
func TestAccComputeForwardingRule_internalLoadBalancing(t *testing.T) {
serviceName := fmt.Sprintf("tf-%s", acctest.RandString(10))
checkName := fmt.Sprintf("tf-%s", acctest.RandString(10))
ruleName := fmt.Sprintf("tf-%s", acctest.RandString(10))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeForwardingRule_internalLoadBalancing(serviceName, checkName, ruleName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeForwardingRuleExists(
"google_compute_forwarding_rule.foobar"),
),
},
},
})
}
func testAccCheckComputeForwardingRuleDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
@ -132,3 +153,31 @@ resource "google_compute_forwarding_rule" "foobar" {
}
`, addrName, poolName, ruleName)
}
func testAccComputeForwardingRule_internalLoadBalancing(serviceName, checkName, ruleName string) string {
return fmt.Sprintf(`
resource "google_compute_region_backend_service" "foobar-bs" {
name = "%s"
description = "Resource created for Terraform acceptance testing"
health_checks = ["${google_compute_health_check.zero.self_link}"]
region = "us-central1"
}
resource "google_compute_health_check" "zero" {
name = "%s"
description = "Resource created for Terraform acceptance testing"
check_interval_sec = 1
timeout_sec = 1
tcp_health_check {
port = "80"
}
}
resource "google_compute_forwarding_rule" "foobar" {
description = "Resource created for Terraform acceptance testing"
name = "%s"
load_balancing_scheme = "INTERNAL"
backend_service = "${google_compute_region_backend_service.foobar-bs.self_link}"
ports = ["80"]
}
`, serviceName, checkName, ruleName)
}

View File

@ -0,0 +1,494 @@
package google
import (
"fmt"
"log"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/compute/v1"
"google.golang.org/api/googleapi"
)
func resourceComputeHealthCheck() *schema.Resource {
return &schema.Resource{
Create: resourceComputeHealthCheckCreate,
Read: resourceComputeHealthCheckRead,
Delete: resourceComputeHealthCheckDelete,
Update: resourceComputeHealthCheckUpdate,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"check_interval_sec": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 5,
},
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
"healthy_threshold": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 2,
},
"tcp_health_check": &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"ssl_health_check", "http_health_check", "https_health_check"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 80,
},
"proxy_header": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "NONE",
},
"request": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
"response": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
},
},
},
"ssl_health_check": &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"tcp_health_check", "http_health_check", "https_health_check"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 443,
},
"proxy_header": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "NONE",
},
"request": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
"response": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
},
},
},
"http_health_check": &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"tcp_health_check", "ssl_health_check", "https_health_check"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"host": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: 80,
},
"port": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
},
"proxy_header": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "NONE",
},
"request_path": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "/",
},
},
},
},
"https_health_check": &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"tcp_health_check", "ssl_health_check", "http_health_check"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"host": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: 443,
},
"port": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
},
"proxy_header": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "NONE",
},
"request_path": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "/",
},
},
},
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"self_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"timeout_sec": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 5,
},
"unhealthy_threshold": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Default: 2,
},
},
}
}
func resourceComputeHealthCheckCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
// Build the parameter
hchk := &compute.HealthCheck{
Name: d.Get("name").(string),
}
// Optional things
if v, ok := d.GetOk("description"); ok {
hchk.Description = v.(string)
}
if v, ok := d.GetOk("check_interval_sec"); ok {
hchk.CheckIntervalSec = int64(v.(int))
}
if v, ok := d.GetOk("healthy_threshold"); ok {
hchk.HealthyThreshold = int64(v.(int))
}
if v, ok := d.GetOk("timeout_sec"); ok {
hchk.TimeoutSec = int64(v.(int))
}
if v, ok := d.GetOk("unhealthy_threshold"); ok {
hchk.UnhealthyThreshold = int64(v.(int))
}
if v, ok := d.GetOk("tcp_health_check"); ok {
hchk.Type = "TCP"
tcpcheck := v.([]interface{})[0].(map[string]interface{})
tcpHealthCheck := &compute.TCPHealthCheck{}
if val, ok := tcpcheck["port"]; ok {
tcpHealthCheck.Port = int64(val.(int))
}
if val, ok := tcpcheck["proxy_header"]; ok {
tcpHealthCheck.ProxyHeader = val.(string)
}
if val, ok := tcpcheck["request"]; ok {
tcpHealthCheck.Request = val.(string)
}
if val, ok := tcpcheck["response"]; ok {
tcpHealthCheck.Response = val.(string)
}
hchk.TcpHealthCheck = tcpHealthCheck
}
if v, ok := d.GetOk("ssl_health_check"); ok {
hchk.Type = "SSL"
sslcheck := v.([]interface{})[0].(map[string]interface{})
sslHealthCheck := &compute.SSLHealthCheck{}
if val, ok := sslcheck["port"]; ok {
sslHealthCheck.Port = int64(val.(int))
}
if val, ok := sslcheck["proxy_header"]; ok {
sslHealthCheck.ProxyHeader = val.(string)
}
if val, ok := sslcheck["request"]; ok {
sslHealthCheck.Request = val.(string)
}
if val, ok := sslcheck["response"]; ok {
sslHealthCheck.Response = val.(string)
}
hchk.SslHealthCheck = sslHealthCheck
}
if v, ok := d.GetOk("http_health_check"); ok {
hchk.Type = "HTTP"
httpcheck := v.([]interface{})[0].(map[string]interface{})
httpHealthCheck := &compute.HTTPHealthCheck{}
if val, ok := httpcheck["host"]; ok {
httpHealthCheck.Host = val.(string)
}
if val, ok := httpcheck["port"]; ok {
httpHealthCheck.Port = int64(val.(int))
}
if val, ok := httpcheck["proxy_header"]; ok {
httpHealthCheck.ProxyHeader = val.(string)
}
if val, ok := httpcheck["request_path"]; ok {
httpHealthCheck.RequestPath = val.(string)
}
hchk.HttpHealthCheck = httpHealthCheck
}
if v, ok := d.GetOk("https_health_check"); ok {
hchk.Type = "HTTPS"
httpscheck := v.([]interface{})[0].(map[string]interface{})
httpsHealthCheck := &compute.HTTPSHealthCheck{}
if val, ok := httpscheck["host"]; ok {
httpsHealthCheck.Host = val.(string)
}
if val, ok := httpscheck["port"]; ok {
httpsHealthCheck.Port = int64(val.(int))
}
if val, ok := httpscheck["proxy_header"]; ok {
httpsHealthCheck.ProxyHeader = val.(string)
}
if val, ok := httpscheck["request_path"]; ok {
httpsHealthCheck.RequestPath = val.(string)
}
hchk.HttpsHealthCheck = httpsHealthCheck
}
log.Printf("[DEBUG] HealthCheck insert request: %#v", hchk)
op, err := config.clientCompute.HealthChecks.Insert(
project, hchk).Do()
if err != nil {
return fmt.Errorf("Error creating HealthCheck: %s", err)
}
// It probably maybe worked, so store the ID now
d.SetId(hchk.Name)
err = computeOperationWaitGlobal(config, op, project, "Creating Health Check")
if err != nil {
return err
}
return resourceComputeHealthCheckRead(d, meta)
}
func resourceComputeHealthCheckUpdate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
// Build the parameter
hchk := &compute.HealthCheck{
Name: d.Get("name").(string),
}
// Optional things
if v, ok := d.GetOk("description"); ok {
hchk.Description = v.(string)
}
if v, ok := d.GetOk("check_interval_sec"); ok {
hchk.CheckIntervalSec = int64(v.(int))
}
if v, ok := d.GetOk("healthy_threshold"); ok {
hchk.HealthyThreshold = int64(v.(int))
}
if v, ok := d.GetOk("timeout_sec"); ok {
hchk.TimeoutSec = int64(v.(int))
}
if v, ok := d.GetOk("unhealthy_threshold"); ok {
hchk.UnhealthyThreshold = int64(v.(int))
}
if v, ok := d.GetOk("tcp_health_check"); ok {
hchk.Type = "TCP"
tcpcheck := v.([]interface{})[0].(map[string]interface{})
tcpHealthCheck := &compute.TCPHealthCheck{}
if val, ok := tcpcheck["port"]; ok {
tcpHealthCheck.Port = int64(val.(int))
}
if val, ok := tcpcheck["proxy_header"]; ok {
tcpHealthCheck.ProxyHeader = val.(string)
}
if val, ok := tcpcheck["request"]; ok {
tcpHealthCheck.Request = val.(string)
}
if val, ok := tcpcheck["response"]; ok {
tcpHealthCheck.Response = val.(string)
}
hchk.TcpHealthCheck = tcpHealthCheck
}
if v, ok := d.GetOk("ssl_health_check"); ok {
hchk.Type = "SSL"
sslcheck := v.([]interface{})[0].(map[string]interface{})
sslHealthCheck := &compute.SSLHealthCheck{}
if val, ok := sslcheck["port"]; ok {
sslHealthCheck.Port = int64(val.(int))
}
if val, ok := sslcheck["proxy_header"]; ok {
sslHealthCheck.ProxyHeader = val.(string)
}
if val, ok := sslcheck["request"]; ok {
sslHealthCheck.Request = val.(string)
}
if val, ok := sslcheck["response"]; ok {
sslHealthCheck.Response = val.(string)
}
hchk.SslHealthCheck = sslHealthCheck
}
if v, ok := d.GetOk("http_health_check"); ok {
hchk.Type = "HTTP"
httpcheck := v.([]interface{})[0].(map[string]interface{})
httpHealthCheck := &compute.HTTPHealthCheck{}
if val, ok := httpcheck["host"]; ok {
httpHealthCheck.Host = val.(string)
}
if val, ok := httpcheck["port"]; ok {
httpHealthCheck.Port = int64(val.(int))
}
if val, ok := httpcheck["proxy_header"]; ok {
httpHealthCheck.ProxyHeader = val.(string)
}
if val, ok := httpcheck["request_path"]; ok {
httpHealthCheck.RequestPath = val.(string)
}
hchk.HttpHealthCheck = httpHealthCheck
}
if v, ok := d.GetOk("https_health_check"); ok {
hchk.Type = "HTTPS"
httpscheck := v.([]interface{})[0].(map[string]interface{})
httpsHealthCheck := &compute.HTTPSHealthCheck{}
if val, ok := httpscheck["host"]; ok {
httpsHealthCheck.Host = val.(string)
}
if val, ok := httpscheck["port"]; ok {
httpsHealthCheck.Port = int64(val.(int))
}
if val, ok := httpscheck["proxy_header"]; ok {
httpsHealthCheck.ProxyHeader = val.(string)
}
if val, ok := httpscheck["request_path"]; ok {
httpsHealthCheck.RequestPath = val.(string)
}
hchk.HttpsHealthCheck = httpsHealthCheck
}
log.Printf("[DEBUG] HealthCheck patch request: %#v", hchk)
op, err := config.clientCompute.HealthChecks.Patch(
project, hchk.Name, hchk).Do()
if err != nil {
return fmt.Errorf("Error patching HealthCheck: %s", err)
}
// It probably maybe worked, so store the ID now
d.SetId(hchk.Name)
err = computeOperationWaitGlobal(config, op, project, "Updating Health Check")
if err != nil {
return err
}
return resourceComputeHealthCheckRead(d, meta)
}
func resourceComputeHealthCheckRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
hchk, err := config.clientCompute.HealthChecks.Get(
project, d.Id()).Do()
if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
// The resource doesn't exist anymore
log.Printf("[WARN] Removing Health Check %q because it's gone", d.Get("name").(string))
d.SetId("")
return nil
}
return fmt.Errorf("Error reading HealthCheck: %s", err)
}
d.Set("check_interval_sec", hchk.CheckIntervalSec)
d.Set("healthy_threshold", hchk.HealthyThreshold)
d.Set("timeout_sec", hchk.TimeoutSec)
d.Set("unhealthy_threshold", hchk.UnhealthyThreshold)
d.Set("tcp_health_check", hchk.TcpHealthCheck)
d.Set("ssl_health_check", hchk.SslHealthCheck)
d.Set("http_health_check", hchk.HttpHealthCheck)
d.Set("https_health_check", hchk.HttpsHealthCheck)
d.Set("self_link", hchk.SelfLink)
d.Set("name", hchk.Name)
d.Set("description", hchk.Description)
d.Set("project", project)
return nil
}
func resourceComputeHealthCheckDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
// Delete the HealthCheck
op, err := config.clientCompute.HealthChecks.Delete(
project, d.Id()).Do()
if err != nil {
return fmt.Errorf("Error deleting HealthCheck: %s", err)
}
err = computeOperationWaitGlobal(config, op, project, "Deleting Health Check")
if err != nil {
return err
}
d.SetId("")
return nil
}

View File

@ -0,0 +1,308 @@
package google
import (
"fmt"
"regexp"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
)
func TestAccComputeHealthCheck_tcp(t *testing.T) {
var healthCheck compute.HealthCheck
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeHealthCheck_tcp,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
"google_compute_health_check.foobar", &healthCheck),
testAccCheckComputeHealthCheckThresholds(
3, 3, &healthCheck),
testAccCheckComputeHealthCheckTcpPort(80, &healthCheck),
),
},
},
})
}
func TestAccComputeHealthCheck_tcp_update(t *testing.T) {
var healthCheck compute.HealthCheck
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeHealthCheck_tcp,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
"google_compute_health_check.foobar", &healthCheck),
testAccCheckComputeHealthCheckThresholds(
3, 3, &healthCheck),
testAccCheckComputeHealthCheckTcpPort(80, &healthCheck),
),
},
resource.TestStep{
Config: testAccComputeHealthCheck_tcp_update,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
"google_compute_health_check.foobar", &healthCheck),
testAccCheckComputeHealthCheckThresholds(
10, 10, &healthCheck),
testAccCheckComputeHealthCheckTcpPort(8080, &healthCheck),
),
},
},
})
}
func TestAccComputeHealthCheck_ssl(t *testing.T) {
var healthCheck compute.HealthCheck
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeHealthCheck_ssl,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
"google_compute_health_check.foobar", &healthCheck),
testAccCheckComputeHealthCheckThresholds(
3, 3, &healthCheck),
),
},
},
})
}
func TestAccComputeHealthCheck_http(t *testing.T) {
var healthCheck compute.HealthCheck
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeHealthCheck_http,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
"google_compute_health_check.foobar", &healthCheck),
testAccCheckComputeHealthCheckThresholds(
3, 3, &healthCheck),
),
},
},
})
}
func TestAccComputeHealthCheck_https(t *testing.T) {
var healthCheck compute.HealthCheck
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeHealthCheck_https,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
"google_compute_health_check.foobar", &healthCheck),
testAccCheckComputeHealthCheckThresholds(
3, 3, &healthCheck),
),
},
},
})
}
func TestAccComputeHealthCheck_tcpAndSsl_shouldFail(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeHealthCheck_tcpAndSsl_shouldFail,
ExpectError: regexp.MustCompile("conflicts with tcp_health_check"),
},
},
})
}
func testAccCheckComputeHealthCheckDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_health_check" {
continue
}
_, err := config.clientCompute.HealthChecks.Get(
config.Project, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("HealthCheck %s still exists", rs.Primary.ID)
}
}
return nil
}
func testAccCheckComputeHealthCheckExists(n string, healthCheck *compute.HealthCheck) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.HealthChecks.Get(
config.Project, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.Primary.ID {
return fmt.Errorf("HealthCheck not found")
}
*healthCheck = *found
return nil
}
}
func testAccCheckErrorCreating(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
_, ok := s.RootModule().Resources[n]
if ok {
return fmt.Errorf("HealthCheck %s created successfully with bad config", n)
}
return nil
}
}
func testAccCheckComputeHealthCheckThresholds(healthy, unhealthy int64, healthCheck *compute.HealthCheck) resource.TestCheckFunc {
return func(s *terraform.State) error {
if healthCheck.HealthyThreshold != healthy {
return fmt.Errorf("HealthyThreshold doesn't match: expected %d, got %d", healthy, healthCheck.HealthyThreshold)
}
if healthCheck.UnhealthyThreshold != unhealthy {
return fmt.Errorf("UnhealthyThreshold doesn't match: expected %d, got %d", unhealthy, healthCheck.UnhealthyThreshold)
}
return nil
}
}
func testAccCheckComputeHealthCheckTcpPort(port int64, healthCheck *compute.HealthCheck) resource.TestCheckFunc {
return func(s *terraform.State) error {
if healthCheck.TcpHealthCheck.Port != port {
return fmt.Errorf("Port doesn't match: expected %v, got %v", port, healthCheck.TcpHealthCheck.Port)
}
return nil
}
}
var testAccComputeHealthCheck_tcp = fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
name = "health-test-%s"
timeout_sec = 2
unhealthy_threshold = 3
tcp_health_check {
}
}
`, acctest.RandString(10))
var testAccComputeHealthCheck_tcp_update = fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource updated for Terraform acceptance testing"
healthy_threshold = 10
name = "health-test-%s"
timeout_sec = 2
unhealthy_threshold = 10
tcp_health_check {
port = "8080"
}
}
`, acctest.RandString(10))
var testAccComputeHealthCheck_ssl = fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
name = "health-test-%s"
timeout_sec = 2
unhealthy_threshold = 3
ssl_health_check {
port = "443"
}
}
`, acctest.RandString(10))
var testAccComputeHealthCheck_http = fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
name = "health-test-%s"
timeout_sec = 2
unhealthy_threshold = 3
http_health_check {
port = "80"
}
}
`, acctest.RandString(10))
var testAccComputeHealthCheck_https = fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
name = "health-test-%s"
timeout_sec = 2
unhealthy_threshold = 3
https_health_check {
port = "443"
}
}
`, acctest.RandString(10))
var testAccComputeHealthCheck_tcpAndSsl_shouldFail = fmt.Sprintf(`
resource "google_compute_health_check" "foobar" {
check_interval_sec = 3
description = "Resource created for Terraform acceptance testing"
healthy_threshold = 3
name = "health-test-%s"
timeout_sec = 2
unhealthy_threshold = 3
tcp_health_check {
}
ssl_health_check {
}
}
`, acctest.RandString(10))

View File

@ -0,0 +1,306 @@
package google
import (
"bytes"
"fmt"
"log"
"regexp"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/compute/v1"
"google.golang.org/api/googleapi"
)
func resourceComputeRegionBackendService() *schema.Resource {
return &schema.Resource{
Create: resourceComputeRegionBackendServiceCreate,
Read: resourceComputeRegionBackendServiceRead,
Update: resourceComputeRegionBackendServiceUpdate,
Delete: resourceComputeRegionBackendServiceDelete,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
re := `^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$`
if !regexp.MustCompile(re).MatchString(value) {
errors = append(errors, fmt.Errorf(
"%q (%q) doesn't match regexp %q", k, value, re))
}
return
},
},
"health_checks": &schema.Schema{
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Required: true,
Set: schema.HashString,
},
"backend": &schema.Schema{
Type: schema.TypeSet,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"group": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
},
},
Optional: true,
Set: resourceGoogleComputeRegionBackendServiceBackendHash,
},
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
},
"fingerprint": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"protocol": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"region": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"self_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"timeout_sec": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
},
}
}
func resourceComputeRegionBackendServiceCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
hc := d.Get("health_checks").(*schema.Set).List()
healthChecks := make([]string, 0, len(hc))
for _, v := range hc {
healthChecks = append(healthChecks, v.(string))
}
service := compute.BackendService{
Name: d.Get("name").(string),
HealthChecks: healthChecks,
LoadBalancingScheme: "INTERNAL",
}
if v, ok := d.GetOk("backend"); ok {
service.Backends = expandBackends(v.(*schema.Set).List())
}
if v, ok := d.GetOk("description"); ok {
service.Description = v.(string)
}
if v, ok := d.GetOk("protocol"); ok {
service.Protocol = v.(string)
}
if v, ok := d.GetOk("timeout_sec"); ok {
service.TimeoutSec = int64(v.(int))
}
project, err := getProject(d, config)
if err != nil {
return err
}
region, err := getRegion(d, config)
if err != nil {
return err
}
log.Printf("[DEBUG] Creating new Region Backend Service: %#v", service)
op, err := config.clientCompute.RegionBackendServices.Insert(
project, region, &service).Do()
if err != nil {
return fmt.Errorf("Error creating backend service: %s", err)
}
log.Printf("[DEBUG] Waiting for new backend service, operation: %#v", op)
d.SetId(service.Name)
err = computeOperationWaitRegion(config, op, project, region, "Creating Region Backend Service")
if err != nil {
return err
}
return resourceComputeRegionBackendServiceRead(d, meta)
}
func resourceComputeRegionBackendServiceRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
region, err := getRegion(d, config)
if err != nil {
return err
}
service, err := config.clientCompute.RegionBackendServices.Get(
project, region, d.Id()).Do()
if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 404 {
// The resource doesn't exist anymore
log.Printf("[WARN] Removing Backend Service %q because it's gone", d.Get("name").(string))
d.SetId("")
return nil
}
return fmt.Errorf("Error reading service: %s", err)
}
d.Set("description", service.Description)
d.Set("protocol", service.Protocol)
d.Set("timeout_sec", service.TimeoutSec)
d.Set("fingerprint", service.Fingerprint)
d.Set("self_link", service.SelfLink)
d.Set("backend", flattenBackends(service.Backends))
d.Set("health_checks", service.HealthChecks)
return nil
}
func resourceComputeRegionBackendServiceUpdate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
region, err := getRegion(d, config)
if err != nil {
return err
}
hc := d.Get("health_checks").(*schema.Set).List()
healthChecks := make([]string, 0, len(hc))
for _, v := range hc {
healthChecks = append(healthChecks, v.(string))
}
service := compute.BackendService{
Name: d.Get("name").(string),
Fingerprint: d.Get("fingerprint").(string),
HealthChecks: healthChecks,
LoadBalancingScheme: "INTERNAL",
}
// Optional things
if v, ok := d.GetOk("backend"); ok {
service.Backends = expandBackends(v.(*schema.Set).List())
}
if v, ok := d.GetOk("description"); ok {
service.Description = v.(string)
}
if v, ok := d.GetOk("protocol"); ok {
service.Protocol = v.(string)
}
if v, ok := d.GetOk("timeout_sec"); ok {
service.TimeoutSec = int64(v.(int))
}
log.Printf("[DEBUG] Updating existing Backend Service %q: %#v", d.Id(), service)
op, err := config.clientCompute.RegionBackendServices.Update(
project, region, d.Id(), &service).Do()
if err != nil {
return fmt.Errorf("Error updating backend service: %s", err)
}
d.SetId(service.Name)
err = computeOperationWaitRegion(config, op, project, region, "Updating Backend Service")
if err != nil {
return err
}
return resourceComputeRegionBackendServiceRead(d, meta)
}
func resourceComputeRegionBackendServiceDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
region, err := getRegion(d, config)
if err != nil {
return err
}
log.Printf("[DEBUG] Deleting backend service %s", d.Id())
op, err := config.clientCompute.RegionBackendServices.Delete(
project, region, d.Id()).Do()
if err != nil {
return fmt.Errorf("Error deleting backend service: %s", err)
}
err = computeOperationWaitRegion(config, op, project, region, "Deleting Backend Service")
if err != nil {
return err
}
d.SetId("")
return nil
}
func resourceGoogleComputeRegionBackendServiceBackendHash(v interface{}) int {
if v == nil {
return 0
}
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["group"].(string)))
if v, ok := m["description"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}
return hashcode.String(buf.String())
}

View File

@ -0,0 +1,262 @@
package google
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"google.golang.org/api/compute/v1"
)
func TestAccComputeRegionBackendService_basic(t *testing.T) {
serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
extraCheckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
var svc compute.BackendService
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeRegionBackendService_basic(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.foobar", &svc),
),
},
resource.TestStep{
Config: testAccComputeRegionBackendService_basicModified(
serviceName, checkName, extraCheckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.foobar", &svc),
),
},
},
})
}
func TestAccComputeRegionBackendService_withBackend(t *testing.T) {
serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
igName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
itName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
var svc compute.BackendService
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.lipsum", &svc),
),
},
},
})
if svc.TimeoutSec != 10 {
t.Errorf("Expected TimeoutSec == 10, got %d", svc.TimeoutSec)
}
if svc.Protocol != "TCP" {
t.Errorf("Expected Protocol to be TCP, got %q", svc.Protocol)
}
if len(svc.Backends) != 1 {
t.Errorf("Expected 1 backend, got %d", len(svc.Backends))
}
}
func TestAccComputeRegionBackendService_withBackendAndUpdate(t *testing.T) {
serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
igName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
itName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
checkName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
var svc compute.BackendService
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.lipsum", &svc),
),
},
resource.TestStep{
Config: testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName, 20),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.lipsum", &svc),
),
},
},
})
if svc.TimeoutSec != 20 {
t.Errorf("Expected TimeoutSec == 20, got %d", svc.TimeoutSec)
}
if svc.Protocol != "TCP" {
t.Errorf("Expected Protocol to be TCP, got %q", svc.Protocol)
}
if len(svc.Backends) != 1 {
t.Errorf("Expected 1 backend, got %d", len(svc.Backends))
}
}
func testAccCheckComputeRegionBackendServiceDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_region_backend_service" {
continue
}
_, err := config.clientCompute.RegionBackendServices.Get(
config.Project, config.Region, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Backend service still exists")
}
}
return nil
}
func testAccCheckComputeRegionBackendServiceExists(n string, svc *compute.BackendService) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.RegionBackendServices.Get(
config.Project, config.Region, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.Primary.ID {
return fmt.Errorf("Backend service not found")
}
*svc = *found
return nil
}
}
func testAccComputeRegionBackendService_basic(serviceName, checkName string) string {
return fmt.Sprintf(`
resource "google_compute_region_backend_service" "foobar" {
name = "%s"
health_checks = ["${google_compute_health_check.zero.self_link}"]
region = "us-central1"
}
resource "google_compute_health_check" "zero" {
name = "%s"
check_interval_sec = 1
timeout_sec = 1
tcp_health_check {
port = "80"
}
}
`, serviceName, checkName)
}
func testAccComputeRegionBackendService_basicModified(serviceName, checkOne, checkTwo string) string {
return fmt.Sprintf(`
resource "google_compute_region_backend_service" "foobar" {
name = "%s"
health_checks = ["${google_compute_health_check.one.self_link}"]
region = "us-central1"
}
resource "google_compute_health_check" "zero" {
name = "%s"
check_interval_sec = 1
timeout_sec = 1
tcp_health_check {
}
}
resource "google_compute_health_check" "one" {
name = "%s"
check_interval_sec = 30
timeout_sec = 30
tcp_health_check {
}
}
`, serviceName, checkOne, checkTwo)
}
func testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName string, timeout int64) string {
return fmt.Sprintf(`
resource "google_compute_region_backend_service" "lipsum" {
name = "%s"
description = "Hello World 1234"
protocol = "TCP"
region = "us-central1"
timeout_sec = %v
backend {
group = "${google_compute_instance_group_manager.foobar.instance_group}"
}
health_checks = ["${google_compute_health_check.default.self_link}"]
}
resource "google_compute_instance_group_manager" "foobar" {
name = "%s"
instance_template = "${google_compute_instance_template.foobar.self_link}"
base_instance_name = "foobar"
zone = "us-central1-f"
target_size = 1
}
resource "google_compute_instance_template" "foobar" {
name = "%s"
machine_type = "n1-standard-1"
network_interface {
network = "default"
}
disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
boot = true
}
}
resource "google_compute_health_check" "default" {
name = "%s"
check_interval_sec = 1
timeout_sec = 1
tcp_health_check {
}
}
`, serviceName, timeout, igName, itName, checkName)
}

View File

@ -150,15 +150,8 @@ func resourceStorageObjectAclRead(d *schema.ResourceData, meta interface{}) erro
}
for _, v := range res.Items {
role := ""
entity := ""
for key, val := range v.(map[string]interface{}) {
if key == "role" {
role = val.(string)
} else if key == "entity" {
entity = val.(string)
}
}
role := v.Role
entity := v.Entity
if _, in := re_local_map[entity]; in {
role_entity = append(role_entity, fmt.Sprintf("%s:%s", role, entity))
log.Printf("[DEBUG]: saving re %s-%s", role, entity)

View File

@ -1,11 +1,12 @@
{
"kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/8EOgQpr1bAhvZ8Ay5woGZcfT03Y\"",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/KWbv1ck4Hir_ldCgHUUAxKHck4c\"",
"discoveryVersion": "v1",
"id": "cloudresourcemanager:v1",
"name": "cloudresourcemanager",
"canonicalName": "Cloud Resource Manager",
"version": "v1",
"revision": "20160225",
"revision": "20160927",
"title": "Google Cloud Resource Manager API",
"description": "The Google Cloud Resource Manager API provides methods for creating, reading, and updating project metadata.",
"ownerDomain": "google.com",
@ -113,6 +114,235 @@
}
},
"schemas": {
"Operation": {
"id": "Operation",
"type": "object",
"description": "This resource represents a long-running operation that is the result of a network API call.",
"properties": {
"name": {
"type": "string",
"description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`."
},
"metadata": {
"type": "object",
"description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.",
"additionalProperties": {
"type": "any",
"description": "Properties of the object. Contains field @type with type URL."
}
},
"done": {
"type": "boolean",
"description": "If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available."
},
"error": {
"$ref": "Status",
"description": "The error result of the operation in case of failure."
},
"response": {
"type": "object",
"description": "The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.",
"additionalProperties": {
"type": "any",
"description": "Properties of the object. Contains field @type with type URL."
}
}
}
},
"Status": {
"id": "Status",
"type": "object",
"description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub-response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons.",
"properties": {
"code": {
"type": "integer",
"description": "The status code, which should be an enum value of google.rpc.Code.",
"format": "int32"
},
"message": {
"type": "string",
"description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client."
},
"details": {
"type": "array",
"description": "A list of messages that carry the error details. There will be a common set of message types for APIs to use.",
"items": {
"type": "object",
"additionalProperties": {
"type": "any",
"description": "Properties of the object. Contains field @type with type URL."
}
}
}
}
},
"SearchOrganizationsRequest": {
"id": "SearchOrganizationsRequest",
"type": "object",
"description": "The request sent to the `SearchOrganizations` method.",
"properties": {
"pageSize": {
"type": "integer",
"description": "The maximum number of Organizations to return in the response. This field is optional.",
"format": "int32"
},
"pageToken": {
"type": "string",
"description": "A pagination token returned from a previous call to `SearchOrganizations` that indicates from where listing should continue. This field is optional."
},
"filter": {
"type": "string",
"description": "An optional query string used to filter the Organizations to return in the response. Filter rules are case-insensitive. Organizations may be filtered by `owner.directoryCustomerId` or by `domain`, where the domain is a Google for Work domain, for example: |Filter|Description| |------|-----------| |owner.directorycustomerid:123456789|Organizations with `owner.directory_customer_id` equal to `123456789`.| |domain:google.com|Organizations corresponding to the domain `google.com`.| This field is optional."
}
}
},
"SearchOrganizationsResponse": {
"id": "SearchOrganizationsResponse",
"type": "object",
"description": "The response returned from the `SearchOrganizations` method.",
"properties": {
"organizations": {
"type": "array",
"description": "The list of Organizations that matched the search query, possibly paginated.",
"items": {
"$ref": "Organization"
}
},
"nextPageToken": {
"type": "string",
"description": "A pagination token to be used to retrieve the next page of results. If the result is too large to fit within the page size specified in the request, this field will be set with a token that can be used to fetch the next page of results. If this field is empty, it indicates that this response contains the last page of results."
}
}
},
"Organization": {
"id": "Organization",
"type": "object",
"description": "The root node in the resource hierarchy to which a particular entity's (e.g., company) resources belong.",
"properties": {
"name": {
"type": "string",
"description": "Output Only. The resource name of the organization. This is the organization's relative path in the API. Its format is \"organizations/[organization_id]\". For example, \"organizations/1234\"."
},
"displayName": {
"type": "string",
"description": "A friendly string to be used to refer to the Organization in the UI. Assigned by the server, set to the firm name of the Google For Work customer that owns this organization. @OutputOnly"
},
"owner": {
"$ref": "OrganizationOwner",
"description": "The owner of this Organization. The owner should be specified on creation. Once set, it cannot be changed. This field is required."
},
"creationTime": {
"type": "string",
"description": "Timestamp when the Organization was created. Assigned by the server. @OutputOnly"
},
"lifecycleState": {
"type": "string",
"description": "The organization's current lifecycle state. Assigned by the server. @OutputOnly",
"enum": [
"LIFECYCLE_STATE_UNSPECIFIED",
"ACTIVE",
"DELETE_REQUESTED"
]
}
}
},
"OrganizationOwner": {
"id": "OrganizationOwner",
"type": "object",
"description": "The entity that owns an Organization. The lifetime of the Organization and all of its descendants are bound to the `OrganizationOwner`. If the `OrganizationOwner` is deleted, the Organization and all its descendants will be deleted.",
"properties": {
"directoryCustomerId": {
"type": "string",
"description": "The Google for Work customer id used in the Directory API."
}
}
},
"SetIamPolicyRequest": {
"id": "SetIamPolicyRequest",
"type": "object",
"description": "Request message for `SetIamPolicy` method.",
"properties": {
"policy": {
"$ref": "Policy",
"description": "REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them."
}
}
},
"Policy": {
"id": "Policy",
"type": "object",
"description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).",
"properties": {
"version": {
"type": "integer",
"description": "Version of the `Policy`. The default version is 0.",
"format": "int32"
},
"bindings": {
"type": "array",
"description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.",
"items": {
"$ref": "Binding"
}
},
"etag": {
"type": "string",
"description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.",
"format": "byte"
}
}
},
"Binding": {
"id": "Binding",
"type": "object",
"description": "Associates `members` with a `role`.",
"properties": {
"role": {
"type": "string",
"description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required"
},
"members": {
"type": "array",
"description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.",
"items": {
"type": "string"
}
}
}
},
"GetIamPolicyRequest": {
"id": "GetIamPolicyRequest",
"type": "object",
"description": "Request message for `GetIamPolicy` method."
},
"TestIamPermissionsRequest": {
"id": "TestIamPermissionsRequest",
"type": "object",
"description": "Request message for `TestIamPermissions` method.",
"properties": {
"permissions": {
"type": "array",
"description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).",
"items": {
"type": "string"
}
}
}
},
"TestIamPermissionsResponse": {
"id": "TestIamPermissionsResponse",
"type": "object",
"description": "Response message for `TestIamPermissions` method.",
"properties": {
"permissions": {
"type": "array",
"description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.",
"items": {
"type": "string"
}
}
}
},
"Project": {
"id": "Project",
"type": "object",
@ -139,7 +369,7 @@
},
"name": {
"type": "string",
"description": "The user-assigned name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write."
"description": "The user-assigned display name of the Project. It must be 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. Example: My Project Read-write."
},
"createTime": {
"type": "string",
@ -201,94 +431,234 @@
"type": "object",
"description": "The request sent to the UndeleteProject method."
},
"GetIamPolicyRequest": {
"id": "GetIamPolicyRequest",
"ProjectCreationStatus": {
"id": "ProjectCreationStatus",
"type": "object",
"description": "Request message for `GetIamPolicy` method."
},
"Policy": {
"id": "Policy",
"type": "object",
"description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).",
"description": "A status object which is used as the `metadata` field for the Operation returned by CreateProject. It provides insight for when significant phases of Project creation have completed.",
"properties": {
"version": {
"type": "integer",
"description": "Version of the `Policy`. The default version is 0.",
"format": "int32"
},
"bindings": {
"type": "array",
"description": "Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.",
"items": {
"$ref": "Binding"
}
},
"etag": {
"createTime": {
"type": "string",
"description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.",
"format": "byte"
}
}
},
"Binding": {
"id": "Binding",
"type": "object",
"description": "Associates `members` with a `role`.",
"properties": {
"role": {
"type": "string",
"description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required"
"description": "Creation time of the project creation workflow."
},
"members": {
"type": "array",
"description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.",
"items": {
"type": "string"
}
"gettable": {
"type": "boolean",
"description": "True if the project can be retrieved using GetProject. No other operations on the project are guaranteed to work until the project creation is complete."
},
"ready": {
"type": "boolean",
"description": "True if the project creation process is complete."
}
}
},
"SetIamPolicyRequest": {
"id": "SetIamPolicyRequest",
"FolderOperation": {
"id": "FolderOperation",
"type": "object",
"description": "Request message for `SetIamPolicy` method.",
"description": "Metadata describing a long running folder operation",
"properties": {
"policy": {
"$ref": "Policy",
"description": "REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them."
"displayName": {
"type": "string",
"description": "The display name of the folder."
},
"operationType": {
"type": "string",
"description": "The type of this operation.",
"enum": [
"OPERATION_TYPE_UNSPECIFIED",
"CREATE",
"MOVE"
]
},
"sourceParent": {
"type": "string",
"description": "The resource name of the folder's parent. Only applicable when the operation_type is MOVE."
},
"destinationParent": {
"type": "string",
"description": "The resource name of the folder or organization we are either creating the folder under or moving the folder to."
}
}
},
"TestIamPermissionsRequest": {
"id": "TestIamPermissionsRequest",
"FolderOperationError": {
"id": "FolderOperationError",
"type": "object",
"description": "Request message for `TestIamPermissions` method.",
"description": "A classification of the Folder Operation error.",
"properties": {
"permissions": {
"type": "array",
"description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.",
"items": {
"type": "string"
}
}
}
},
"TestIamPermissionsResponse": {
"id": "TestIamPermissionsResponse",
"type": "object",
"description": "Response message for `TestIamPermissions` method.",
"properties": {
"permissions": {
"type": "array",
"description": "A subset of `TestPermissionsRequest.permissions` that the caller is allowed.",
"items": {
"type": "string"
}
"errorMessageId": {
"type": "string",
"description": "The type of operation error experienced.",
"enum": [
"ERROR_TYPE_UNSPECIFIED",
"FOLDER_HEIGHT_VIOLATION",
"MAX_CHILD_FOLDERS_VIOLATION",
"FOLDER_NAME_UNIQUENESS_VIOLATION",
"RESOURCE_DELETED",
"PARENT_DELETED",
"CYCLE_INTRODUCED_ERROR",
"FOLDER_ALREADY_BEING_MOVED",
"FOLDER_TO_DELETE_NON_EMPTY"
]
}
}
}
},
"resources": {
"operations": {
"methods": {
"get": {
"id": "cloudresourcemanager.operations.get",
"path": "v1/{+name}",
"httpMethod": "GET",
"description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.",
"parameters": {
"name": {
"type": "string",
"description": "The name of the operation resource.",
"required": true,
"pattern": "^operations/.*$",
"location": "path"
}
},
"parameterOrder": [
"name"
],
"response": {
"$ref": "Operation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only"
]
}
}
},
"organizations": {
"methods": {
"search": {
"id": "cloudresourcemanager.organizations.search",
"path": "v1/organizations:search",
"httpMethod": "POST",
"description": "Searches Organization resources that are visible to the user and satisfy the specified filter. This method returns Organizations in an unspecified order. New Organizations do not necessarily appear at the end of the results.",
"request": {
"$ref": "SearchOrganizationsRequest"
},
"response": {
"$ref": "SearchOrganizationsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only"
]
},
"get": {
"id": "cloudresourcemanager.organizations.get",
"path": "v1/{+name}",
"httpMethod": "GET",
"description": "Fetches an Organization resource identified by the specified resource name.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the Organization to fetch, e.g. \"organizations/1234\".",
"required": true,
"pattern": "^organizations/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"name"
],
"response": {
"$ref": "Organization"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only"
]
},
"setIamPolicy": {
"id": "cloudresourcemanager.organizations.setIamPolicy",
"path": "v1/{+resource}:setIamPolicy",
"httpMethod": "POST",
"description": "Sets the access control policy on an Organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, e.g. \"organizations/123\".",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^organizations/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"resource"
],
"request": {
"$ref": "SetIamPolicyRequest"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
},
"getIamPolicy": {
"id": "cloudresourcemanager.organizations.getIamPolicy",
"path": "v1/{+resource}:getIamPolicy",
"httpMethod": "POST",
"description": "Gets the access control policy for an Organization resource. May be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, e.g. \"organizations/123\".",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^organizations/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"resource"
],
"request": {
"$ref": "GetIamPolicyRequest"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only"
]
},
"testIamPermissions": {
"id": "cloudresourcemanager.organizations.testIamPermissions",
"path": "v1/{+resource}:testIamPermissions",
"httpMethod": "POST",
"description": "Returns permissions that a caller has on the specified Organization. The `resource` field should be the organization's resource name, e.g. \"organizations/123\".",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^organizations/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"resource"
],
"request": {
"$ref": "TestIamPermissionsRequest"
},
"response": {
"$ref": "TestIamPermissionsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only"
]
}
}
},
"projects": {
"methods": {
"get": {
@ -346,6 +716,21 @@
"https://www.googleapis.com/auth/cloud-platform.read-only"
]
},
"create": {
"id": "cloudresourcemanager.projects.create",
"path": "v1/projects",
"httpMethod": "POST",
"description": "Request that a new Project be created. The result is an Operation which can be used to track the creation process. It is automatically deleted after a few hours, so there is no need to call DeleteOperation. Our SLO permits Project creation to take up to 30 seconds at the 90th percentile. As of 2016-08-29, we are observing 6 seconds 50th percentile latency. 95th percentile latency is around 11 seconds. We recommend polling at the 5th second with an exponential backoff.",
"request": {
"$ref": "Project"
},
"response": {
"$ref": "Operation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
},
"update": {
"id": "cloudresourcemanager.projects.update",
"path": "v1/projects/{projectId}",
@ -376,7 +761,7 @@
"id": "cloudresourcemanager.projects.delete",
"path": "v1/projects/{projectId}",
"httpMethod": "DELETE",
"description": "Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the lifecycle state changes to DELETE_IN_PROGRESS. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project.",
"description": "Marks the Project identified by the specified `project_id` (for example, `my-project-123`) for deletion. This method will only affect the Project if the following criteria are met: + The Project does not have a billing account associated with it. + The Project has a lifecycle state of ACTIVE. This method changes the Project's lifecycle state from ACTIVE to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible. Until the deletion completes, you can check the lifecycle state checked by retrieving the Project with GetProject, and the Project remains visible to ListProjects. However, you cannot update the project. After the deletion completes, the Project is not retrievable by the GetProject and ListProjects methods. The caller must have modify permissions for this Project.",
"parameters": {
"projectId": {
"type": "string",
@ -399,7 +784,7 @@
"id": "cloudresourcemanager.projects.undelete",
"path": "v1/projects/{projectId}:undelete",
"httpMethod": "POST",
"description": "Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, as indicated by a lifecycle state of DELETE_IN_PROGRESS, the Project cannot be restored. The caller must have modify permissions for this Project.",
"description": "Restores the Project identified by the specified `project_id` (for example, `my-project-123`). You can only use this method for a Project that has a lifecycle state of DELETE_REQUESTED. After deletion starts, the Project cannot be restored. The caller must have modify permissions for this Project.",
"parameters": {
"projectId": {
"type": "string",
@ -429,7 +814,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"location": "path"
}
@ -452,11 +837,11 @@
"id": "cloudresourcemanager.projects.setIamPolicy",
"path": "v1/projects/{resource}:setIamPolicy",
"httpMethod": "POST",
"description": "Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project currently supports only `user:{emailid}` and `serviceAccount:{emailid}` members in a `Binding` of a `Policy`. + To be added as an `owner`, a user must be invited via Cloud Platform console and must accept the invitation. + Members cannot be added to more than one role in the same policy. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.",
"description": "Sets the IAM access control policy for the specified Project. Replaces any existing policy. The following constraints apply when using `setIamPolicy()`: + Project does not support `allUsers` and `allAuthenticatedUsers` as `members` in a `Binding` of a `Policy`. + The owner role can be granted only to `user` and `serviceAccount`. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an owner, a user must be invited via Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using `setIamPolicy()`. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using `setIamPolicy()`; they must be sent only using the Cloud Platform Console. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + There must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling `setIamPolicy()` to to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. + Calling this method requires enabling the App Engine Admin API. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"location": "path"
}
@ -482,7 +867,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"location": "path"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -154,12 +154,21 @@ type AddonsConfig struct {
// field is empty or not. This may be used to include empty fields in
// Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "HorizontalPodAutoscaling")
// to include in API requests with the JSON null value. By default,
// fields with empty values are omitted from API requests. However, any
// field with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *AddonsConfig) MarshalJSON() ([]byte, error) {
type noMethod AddonsConfig
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Cluster: A Google Container Engine cluster.
@ -322,12 +331,20 @@ type Cluster struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AddonsConfig") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Cluster) MarshalJSON() ([]byte, error) {
type noMethod Cluster
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ClusterUpdate: ClusterUpdate describes an update to the cluster.
@ -366,12 +383,21 @@ type ClusterUpdate struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DesiredAddonsConfig") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *ClusterUpdate) MarshalJSON() ([]byte, error) {
type noMethod ClusterUpdate
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CreateClusterRequest: CreateClusterRequest creates a cluster.
@ -387,12 +413,20 @@ type CreateClusterRequest struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Cluster") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CreateClusterRequest) MarshalJSON() ([]byte, error) {
type noMethod CreateClusterRequest
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CreateNodePoolRequest: CreateNodePoolRequest creates a node pool for
@ -408,12 +442,20 @@ type CreateNodePoolRequest struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "NodePool") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CreateNodePoolRequest) MarshalJSON() ([]byte, error) {
type noMethod CreateNodePoolRequest
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// HorizontalPodAutoscaling: Configuration options for the horizontal
@ -434,12 +476,20 @@ type HorizontalPodAutoscaling struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Disabled") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *HorizontalPodAutoscaling) MarshalJSON() ([]byte, error) {
type noMethod HorizontalPodAutoscaling
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// HttpLoadBalancing: Configuration options for the HTTP (L7) load
@ -458,12 +508,20 @@ type HttpLoadBalancing struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Disabled") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *HttpLoadBalancing) MarshalJSON() ([]byte, error) {
type noMethod HttpLoadBalancing
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListClustersResponse: ListClustersResponse is the result of
@ -488,12 +546,20 @@ type ListClustersResponse struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Clusters") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListClustersResponse) MarshalJSON() ([]byte, error) {
type noMethod ListClustersResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListNodePoolsResponse: ListNodePoolsResponse is the result of
@ -513,12 +579,20 @@ type ListNodePoolsResponse struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "NodePools") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListNodePoolsResponse) MarshalJSON() ([]byte, error) {
type noMethod ListNodePoolsResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListOperationsResponse: ListOperationsResponse is the result of
@ -543,12 +617,20 @@ type ListOperationsResponse struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "MissingZones") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
type noMethod ListOperationsResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// MasterAuth: The authentication information for accessing the master
@ -583,12 +665,21 @@ type MasterAuth struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ClientCertificate") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *MasterAuth) MarshalJSON() ([]byte, error) {
type noMethod MasterAuth
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// NodeConfig: Parameters that describe the nodes in a cluster.
@ -635,12 +726,20 @@ type NodeConfig struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DiskSizeGb") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *NodeConfig) MarshalJSON() ([]byte, error) {
type noMethod NodeConfig
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// NodePool: NodePool contains the name and configuration for a
@ -700,12 +799,20 @@ type NodePool struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Config") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *NodePool) MarshalJSON() ([]byte, error) {
type noMethod NodePool
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Operation: This operation resource represents operations that may
@ -767,12 +874,20 @@ type Operation struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Detail") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Operation) MarshalJSON() ([]byte, error) {
type noMethod Operation
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ServerConfig: Container Engine service configuration.
@ -802,12 +917,21 @@ type ServerConfig struct {
// field is empty or not. This may be used to include empty fields in
// Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "DefaultClusterVersion") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *ServerConfig) MarshalJSON() ([]byte, error) {
type noMethod ServerConfig
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// UpdateClusterRequest: UpdateClusterRequest updates the settings of a
@ -823,12 +947,20 @@ type UpdateClusterRequest struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Update") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *UpdateClusterRequest) MarshalJSON() ([]byte, error) {
type noMethod UpdateClusterRequest
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// method id "container.projects.zones.getServerconfig":
@ -840,6 +972,7 @@ type ProjectsZonesGetServerconfigCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// GetServerconfig: Returns configuration info about the Container
@ -877,8 +1010,20 @@ func (c *ProjectsZonesGetServerconfigCall) Context(ctx context.Context) *Project
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesGetServerconfigCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesGetServerconfigCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -975,6 +1120,7 @@ type ProjectsZonesClustersCreateCall struct {
createclusterrequest *CreateClusterRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a cluster, consisting of the specified number and
@ -1010,8 +1156,20 @@ func (c *ProjectsZonesClustersCreateCall) Context(ctx context.Context) *Projects
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.createclusterrequest)
@ -1113,6 +1271,7 @@ type ProjectsZonesClustersDeleteCall struct {
clusterId string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes the cluster, including the Kubernetes endpoint and
@ -1145,8 +1304,20 @@ func (c *ProjectsZonesClustersDeleteCall) Context(ctx context.Context) *Projects
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
@ -1249,6 +1420,7 @@ type ProjectsZonesClustersGetCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets the details of a specific cluster.
@ -1286,8 +1458,20 @@ func (c *ProjectsZonesClustersGetCall) Context(ctx context.Context) *ProjectsZon
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -1392,6 +1576,7 @@ type ProjectsZonesClustersListCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists all clusters owned by a project in either the specified
@ -1429,8 +1614,20 @@ func (c *ProjectsZonesClustersListCall) Context(ctx context.Context) *ProjectsZo
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -1528,6 +1725,7 @@ type ProjectsZonesClustersUpdateCall struct {
updateclusterrequest *UpdateClusterRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Update: Updates the settings of a specific cluster.
@ -1556,8 +1754,20 @@ func (c *ProjectsZonesClustersUpdateCall) Context(ctx context.Context) *Projects
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersUpdateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.updateclusterrequest)
@ -1668,6 +1878,7 @@ type ProjectsZonesClustersNodePoolsCreateCall struct {
createnodepoolrequest *CreateNodePoolRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Creates a node pool for a cluster.
@ -1696,8 +1907,20 @@ func (c *ProjectsZonesClustersNodePoolsCreateCall) Context(ctx context.Context)
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersNodePoolsCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersNodePoolsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.createnodepoolrequest)
@ -1808,6 +2031,7 @@ type ProjectsZonesClustersNodePoolsDeleteCall struct {
nodePoolId string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Deletes a node pool from a cluster.
@ -1836,8 +2060,20 @@ func (c *ProjectsZonesClustersNodePoolsDeleteCall) Context(ctx context.Context)
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersNodePoolsDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersNodePoolsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
@ -1949,6 +2185,7 @@ type ProjectsZonesClustersNodePoolsGetCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Retrieves the node pool requested.
@ -1987,8 +2224,20 @@ func (c *ProjectsZonesClustersNodePoolsGetCall) Context(ctx context.Context) *Pr
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersNodePoolsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersNodePoolsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -2102,6 +2351,7 @@ type ProjectsZonesClustersNodePoolsListCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists the node pools for a cluster.
@ -2139,8 +2389,20 @@ func (c *ProjectsZonesClustersNodePoolsListCall) Context(ctx context.Context) *P
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesClustersNodePoolsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesClustersNodePoolsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -2246,6 +2508,7 @@ type ProjectsZonesOperationsGetCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets the specified operation.
@ -2283,8 +2546,20 @@ func (c *ProjectsZonesOperationsGetCall) Context(ctx context.Context) *ProjectsZ
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesOperationsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesOperationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -2389,6 +2664,7 @@ type ProjectsZonesOperationsListCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Lists all operations in a project in a specific zone or all
@ -2426,8 +2702,20 @@ func (c *ProjectsZonesOperationsListCall) Context(ctx context.Context) *Projects
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsZonesOperationsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsZonesOperationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)

View File

@ -1,18 +1,18 @@
{
"kind": "discovery#restDescription",
"etag": "\"jQLIOHBVnDZie4rQHGH1WJF-INE/ctEt-71wWAltEdgLnIcGLfJZeFE\"",
"etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/RqBsQyB2YZT-ZAkK7pcLByI9SZs\"",
"discoveryVersion": "v1",
"id": "dns:v1",
"name": "dns",
"version": "v1",
"revision": "20160413",
"revision": "20161110",
"title": "Google Cloud DNS API",
"description": "Configures and serves authoritative DNS records.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {
"x16": "http://www.google.com/images/icons/product/search-16.gif",
"x32": "http://www.google.com/images/icons/product/search-32.gif"
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"
},
"documentationLink": "https://developers.google.com/cloud-dns",
"protocol": "rest",
@ -183,7 +183,7 @@
},
"name": {
"type": "string",
"description": "User assigned name for this resource. Must be unique within the project. The name must be 1-32 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes."
"description": "User assigned name for this resource. Must be unique within the project. The name must be 1-63 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes."
},
"nameServerSet": {
"type": "string",

View File

@ -168,12 +168,20 @@ type Change struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Additions") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Change) MarshalJSON() ([]byte, error) {
type noMethod Change
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ChangesListResponse: The response to a request to enumerate Changes
@ -209,12 +217,20 @@ type ChangesListResponse struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Changes") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ChangesListResponse) MarshalJSON() ([]byte, error) {
type noMethod ChangesListResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ManagedZone: A zone is a subtree of the DNS namespace under one
@ -243,7 +259,7 @@ type ManagedZone struct {
Kind string `json:"kind,omitempty"`
// Name: User assigned name for this resource. Must be unique within the
// project. The name must be 1-32 characters long, must begin with a
// project. The name must be 1-63 characters long, must begin with a
// letter, end with a letter or digit, and only contain lowercase
// letters, digits or dashes.
Name string `json:"name,omitempty"`
@ -268,12 +284,20 @@ type ManagedZone struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CreationTime") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ManagedZone) MarshalJSON() ([]byte, error) {
type noMethod ManagedZone
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type ManagedZonesListResponse struct {
@ -307,12 +331,20 @@ type ManagedZonesListResponse struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Kind") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ManagedZonesListResponse) MarshalJSON() ([]byte, error) {
type noMethod ManagedZonesListResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Project: A project resource. The project is a top level container for
@ -344,12 +376,20 @@ type Project struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Id") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Project) MarshalJSON() ([]byte, error) {
type noMethod Project
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Quota: Limits associated with a Project.
@ -388,12 +428,20 @@ type Quota struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Kind") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Quota) MarshalJSON() ([]byte, error) {
type noMethod Quota
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ResourceRecordSet: A unit of data that will be returned by the DNS
@ -425,12 +473,20 @@ type ResourceRecordSet struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Kind") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ResourceRecordSet) MarshalJSON() ([]byte, error) {
type noMethod ResourceRecordSet
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
type ResourceRecordSetsListResponse struct {
@ -464,12 +520,20 @@ type ResourceRecordSetsListResponse struct {
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Kind") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ResourceRecordSetsListResponse) MarshalJSON() ([]byte, error) {
type noMethod ResourceRecordSetsListResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// method id "dns.changes.create":
@ -481,6 +545,7 @@ type ChangesCreateCall struct {
change *Change
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Atomically update the ResourceRecordSet collection.
@ -508,8 +573,20 @@ func (c *ChangesCreateCall) Context(ctx context.Context) *ChangesCreateCall {
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ChangesCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ChangesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.change)
@ -613,6 +690,7 @@ type ChangesGetCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Fetch the representation of an existing Change.
@ -650,8 +728,20 @@ func (c *ChangesGetCall) Context(ctx context.Context) *ChangesGetCall {
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ChangesGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -759,6 +849,7 @@ type ChangesListCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Enumerate Changes to a ResourceRecordSet collection.
@ -828,8 +919,20 @@ func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ChangesListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -977,6 +1080,7 @@ type ManagedZonesCreateCall struct {
managedzone *ManagedZone
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Create: Create a new ManagedZone.
@ -1003,8 +1107,20 @@ func (c *ManagedZonesCreateCall) Context(ctx context.Context) *ManagedZonesCreat
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ManagedZonesCreateCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ManagedZonesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.managedzone)
@ -1098,6 +1214,7 @@ type ManagedZonesDeleteCall struct {
managedZone string
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Delete: Delete a previously created ManagedZone.
@ -1124,8 +1241,20 @@ func (c *ManagedZonesDeleteCall) Context(ctx context.Context) *ManagedZonesDelet
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ManagedZonesDeleteCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ManagedZonesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
@ -1192,6 +1321,7 @@ type ManagedZonesGetCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Fetch the representation of an existing ManagedZone.
@ -1228,8 +1358,20 @@ func (c *ManagedZonesGetCall) Context(ctx context.Context) *ManagedZonesGetCall
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ManagedZonesGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ManagedZonesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -1328,6 +1470,7 @@ type ManagedZonesListCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Enumerate ManagedZones that have been created but not yet
@ -1387,8 +1530,20 @@ func (c *ManagedZonesListCall) Context(ctx context.Context) *ManagedZonesListCal
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ManagedZonesListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ManagedZonesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -1516,6 +1671,7 @@ type ProjectsGetCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Fetch the representation of an existing Project.
@ -1551,8 +1707,20 @@ func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall {
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProjectsGetCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
@ -1644,6 +1812,7 @@ type ResourceRecordSetsListCall struct {
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// List: Enumerate ResourceRecordSets that have been created but not yet
@ -1712,8 +1881,20 @@ func (c *ResourceRecordSetsListCall) Context(ctx context.Context) *ResourceRecor
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ResourceRecordSetsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ResourceRecordSetsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)

View File

@ -12,13 +12,13 @@ import (
)
// MarshalJSON returns a JSON encoding of schema containing only selected fields.
// A field is selected if:
// * it has a non-empty value, or
// * its field name is present in forceSendFields, and
// * it is not a nil pointer or nil interface.
// A field is selected if any of the following is true:
// * it has a non-empty value
// * its field name is present in forceSendFields and it is not a nil pointer or nil interface
// * its field name is present in nullFields.
// The JSON key for each selected field is taken from the field's json: struct tag.
func MarshalJSON(schema interface{}, forceSendFields []string) ([]byte, error) {
if len(forceSendFields) == 0 {
func MarshalJSON(schema interface{}, forceSendFields, nullFields []string) ([]byte, error) {
if len(forceSendFields) == 0 && len(nullFields) == 0 {
return json.Marshal(schema)
}
@ -26,15 +26,19 @@ func MarshalJSON(schema interface{}, forceSendFields []string) ([]byte, error) {
for _, f := range forceSendFields {
mustInclude[f] = struct{}{}
}
useNull := make(map[string]struct{})
for _, f := range nullFields {
useNull[f] = struct{}{}
}
dataMap, err := schemaToMap(schema, mustInclude)
dataMap, err := schemaToMap(schema, mustInclude, useNull)
if err != nil {
return nil, err
}
return json.Marshal(dataMap)
}
func schemaToMap(schema interface{}, mustInclude map[string]struct{}) (map[string]interface{}, error) {
func schemaToMap(schema interface{}, mustInclude, useNull map[string]struct{}) (map[string]interface{}, error) {
m := make(map[string]interface{})
s := reflect.ValueOf(schema)
st := s.Type()
@ -54,6 +58,14 @@ func schemaToMap(schema interface{}, mustInclude map[string]struct{}) (map[strin
v := s.Field(i)
f := st.Field(i)
if _, ok := useNull[f.Name]; ok {
if !isEmptyValue(v) {
return nil, fmt.Errorf("field %q in NullFields has non-empty value", f.Name)
}
m[tag.apiName] = nil
continue
}
if !includeField(v, f, mustInclude) {
continue
}

View File

@ -5,6 +5,7 @@
package gensupport
import (
"errors"
"fmt"
"io"
"net/http"
@ -12,14 +13,9 @@ import (
"time"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
)
const (
// statusResumeIncomplete is the code returned by the Google uploader
// when the transfer is not yet complete.
statusResumeIncomplete = 308
// statusTooManyRequests is returned by the storage API if the
// per-project limits have been temporarily exceeded. The request
// should be retried.
@ -80,11 +76,23 @@ func (rx *ResumableUpload) doUploadRequest(ctx context.Context, data io.Reader,
req.Header.Set("Content-Range", contentRange)
req.Header.Set("Content-Type", rx.MediaType)
req.Header.Set("User-Agent", rx.UserAgent)
fn := Hook(ctx, req)
resp, err := ctxhttp.Do(ctx, rx.Client, req)
fn(resp)
return resp, err
// Google's upload endpoint uses status code 308 for a
// different purpose than the "308 Permanent Redirect"
// since-standardized in RFC 7238. Because of the conflict in
// semantics, Google added this new request header which
// causes it to not use "308" and instead reply with 200 OK
// and sets the upload-specific "X-HTTP-Status-Code-Override:
// 308" response header.
req.Header.Set("X-GUploader-No-308", "yes")
return SendRequest(ctx, rx.Client, req)
}
func statusResumeIncomplete(resp *http.Response) bool {
// This is how the server signals "status resume incomplete"
// when X-GUploader-No-308 is set to "yes":
return resp != nil && resp.Header.Get("X-Http-Status-Code-Override") == "308"
}
// reportProgress calls a user-supplied callback to report upload progress.
@ -115,11 +123,17 @@ func (rx *ResumableUpload) transferChunk(ctx context.Context) (*http.Response, e
return res, err
}
if res.StatusCode == statusResumeIncomplete || res.StatusCode == http.StatusOK {
// We sent "X-GUploader-No-308: yes" (see comment elsewhere in
// this file), so we don't expect to get a 308.
if res.StatusCode == 308 {
return nil, errors.New("unexpected 308 response status code")
}
if res.StatusCode == http.StatusOK {
rx.reportProgress(off, off+int64(size))
}
if res.StatusCode == statusResumeIncomplete {
if statusResumeIncomplete(res) {
rx.Media.Next()
}
return res, nil
@ -138,8 +152,8 @@ func contextDone(ctx context.Context) bool {
// It retries using the provided back off strategy until cancelled or the
// strategy indicates to stop retrying.
// It is called from the auto-generated API code and is not visible to the user.
// Before sending an HTTP request, Upload calls Hook to obtain a function which
// it subsequently calls with the HTTP response.
// Before sending an HTTP request, Upload calls any registered hook functions,
// and calls the returned functions after the request returns (see send.go).
// rx is private to the auto-generated API code.
// Exactly one of resp or err will be nil. If resp is non-nil, the caller must call resp.Body.Close.
func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err error) {
@ -181,7 +195,7 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
// If the chunk was uploaded successfully, but there's still
// more to go, upload the next chunk without any delay.
if status == statusResumeIncomplete {
if statusResumeIncomplete(resp) {
pause = 0
backoff.Reset()
resp.Body.Close()

View File

@ -55,23 +55,17 @@ func DefaultBackoffStrategy() BackoffStrategy {
// shouldRetry returns true if the HTTP response / error indicates that the
// request should be attempted again.
func shouldRetry(status int, err error) bool {
// Retry for 5xx response codes.
if 500 <= status && status < 600 {
if 500 <= status && status <= 599 {
return true
}
// Retry on statusTooManyRequests{
if status == statusTooManyRequests {
return true
}
// Retry on unexpected EOFs and temporary network errors.
if err == io.ErrUnexpectedEOF {
return true
}
if err, ok := err.(net.Error); ok {
return err.Temporary()
}
return false
}

View File

@ -11,25 +11,45 @@ import (
"golang.org/x/net/context/ctxhttp"
)
// Hook is a function that is called once before each HTTP request that is sent
// by a generated API. It returns a function that is called after the request
// returns.
// Hook is never called if the context is nil.
var Hook func(ctx context.Context, req *http.Request) func(resp *http.Response) = defaultHook
// Hook is the type of a function that is called once before each HTTP request
// that is sent by a generated API. It returns a function that is called after
// the request returns.
// Hooks are not called if the context is nil.
type Hook func(ctx context.Context, req *http.Request) func(resp *http.Response)
func defaultHook(ctx context.Context, req *http.Request) func(resp *http.Response) {
return func(resp *http.Response) {}
var hooks []Hook
// RegisterHook registers a Hook to be called before each HTTP request by a
// generated API. Hooks are called in the order they are registered. Each
// hook can return a function; if it is non-nil, it is called after the HTTP
// request returns. These functions are called in the reverse order.
// RegisterHook should not be called concurrently with itself or SendRequest.
func RegisterHook(h Hook) {
hooks = append(hooks, h)
}
// SendRequest sends a single HTTP request using the given client.
// If ctx is non-nil, uses ctxhttp.Do, and calls Hook beforehand. The function
// returned by Hook is called after the request returns.
// If ctx is non-nil, it calls all hooks, then sends the request with
// ctxhttp.Do, then calls any functions returned by the hooks in reverse order.
func SendRequest(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
if ctx != nil {
fn := Hook(ctx, req)
resp, err := ctxhttp.Do(ctx, client, req)
fn(resp)
return resp, err
if ctx == nil {
return client.Do(req)
}
return client.Do(req)
// Call hooks in order of registration, store returned funcs.
post := make([]func(resp *http.Response), len(hooks))
for i, h := range hooks {
fn := h(ctx, req)
post[i] = fn
}
// Send request.
resp, err := ctxhttp.Do(ctx, client, req)
// Call returned funcs in reverse order.
for i := len(post) - 1; i >= 0; i-- {
if fn := post[i]; fn != nil {
fn(resp)
}
}
return resp, err
}

View File

@ -1,12 +1,13 @@
{
"kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/KGIJuBPLol6TqL9arf5YOmp-wQ0\"",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/bQX0iw41CX8vYvVm7WSKLdyxMvI\"",
"discoveryVersion": "v1",
"id": "iam:v1",
"name": "iam",
"canonicalName": "iam",
"version": "v1",
"revision": "20160129",
"title": "Google Identity and Access Management API",
"revision": "20160915",
"title": "Google Identity and Access Management (IAM) API",
"description": "Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.",
"ownerDomain": "google.com",
"ownerName": "Google",
@ -125,18 +126,18 @@
},
"nextPageToken": {
"type": "string",
"description": "To retrieve the next page of results, set [ListServiceAccountsRequest.page_token] to this value."
"description": "To retrieve the next page of results, set ListServiceAccountsRequest.page_token to this value."
}
}
},
"ServiceAccount": {
"id": "ServiceAccount",
"type": "object",
"description": "A service account in the Identity and Access Management API. To create a service account, you specify the project_id and account_id for the account. The account_id is unique within the project, and used to generate the service account email address and a stable unique id. All other methods can identify accounts using the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "A service account in the Identity and Access Management API. To create a service account, specify the `project_id` and the `account_id` for the account. The `account_id` is unique within the project, and is used to generate the service account email address and a stable `unique_id`. If the account already exists, the account's resource name is returned in util::Status's ResourceInfo.resource_name in the format of projects/{project}/serviceAccounts/{email}. The caller can use the name in other methods to access the account. All other methods can identify the service account using the format `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"properties": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format \"projects/{project}/serviceAccounts/{email}\"."
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`."
},
"projectId": {
"type": "string",
@ -144,11 +145,11 @@
},
"uniqueId": {
"type": "string",
"description": "@OutputOnly unique and stable id of the service account."
"description": "@OutputOnly The unique and stable id of the service account."
},
"email": {
"type": "string",
"description": "@OutputOnly Email address of the service account."
"description": "@OutputOnly The email address of the service account."
},
"displayName": {
"type": "string",
@ -172,11 +173,11 @@
"properties": {
"accountId": {
"type": "string",
"description": "Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 1-63 characters long, and match the regular expression [a-z]([-a-z0-9]*[a-z0-9]) to comply with RFC1035."
"description": "Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 6-30 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035."
},
"serviceAccount": {
"$ref": "ServiceAccount",
"description": "The ServiceAccount resource to create. Currently, only the following values are user assignable: display_name ."
"description": "The ServiceAccount resource to create. Currently, only the following values are user assignable: `display_name` ."
}
}
},
@ -202,24 +203,38 @@
"ServiceAccountKey": {
"id": "ServiceAccountKey",
"type": "object",
"description": "Represents a service account key. A service account can have 0 or more key pairs. The private keys for these are not stored by Google. ServiceAccountKeys are immutable.",
"description": "Represents a service account key. A service account has two sets of key-pairs: user-managed, and system-managed. User-managed key-pairs can be created and deleted by users. Users are responsible for rotating these keys periodically to ensure security of their service accounts. Users retain the private key of these key-pairs, and Google retains ONLY the public key. System-managed key-pairs are managed automatically by Google, and rotated daily without user intervention. The private key never leaves Google's servers to maximize security. Public keys for all service accounts are also published at the OAuth2 Service Account API.",
"properties": {
"name": {
"type": "string",
"description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{email}/keys/{key}\"."
"description": "The resource name of the service account key in the following format `projects/{project}/serviceAccounts/{account}/keys/{key}`."
},
"privateKeyType": {
"type": "string",
"description": "The type of the private key.",
"description": "The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user-managed private keys.",
"enum": [
"TYPE_UNSPECIFIED",
"TYPE_PKCS12_FILE",
"TYPE_GOOGLE_CREDENTIALS_FILE"
]
},
"keyAlgorithm": {
"type": "string",
"description": "Specifies the algorithm (and possibly key size) for the key.",
"enum": [
"KEY_ALG_UNSPECIFIED",
"KEY_ALG_RSA_1024",
"KEY_ALG_RSA_2048"
]
},
"privateKeyData": {
"type": "string",
"description": "The key data.",
"description": "The private key data. Only provided in `CreateServiceAccountKey` responses.",
"format": "byte"
},
"publicKeyData": {
"type": "string",
"description": "The public key data. Only provided in `GetServiceAccountKey` responses.",
"format": "byte"
},
"validAfterTime": {
@ -239,12 +254,21 @@
"properties": {
"privateKeyType": {
"type": "string",
"description": "The type of the key requested. GOOGLE_CREDENTIALS is the default key type.",
"description": "The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the default output format.",
"enum": [
"TYPE_UNSPECIFIED",
"TYPE_PKCS12_FILE",
"TYPE_GOOGLE_CREDENTIALS_FILE"
]
},
"keyAlgorithm": {
"type": "string",
"description": "Which type of key and algorithm to use for the key. The default is currently a 4K RSA key. However this may change in the future.",
"enum": [
"KEY_ALG_UNSPECIFIED",
"KEY_ALG_RSA_1024",
"KEY_ALG_RSA_2048"
]
}
}
},
@ -255,7 +279,7 @@
"properties": {
"bytesToSign": {
"type": "string",
"description": "The bytes to sign",
"description": "The bytes to sign.",
"format": "byte"
}
}
@ -279,7 +303,7 @@
"Policy": {
"id": "Policy",
"type": "object",
"description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\"] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).",
"description": "Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { \"bindings\": [ { \"role\": \"roles/owner\", \"members\": [ \"user:mike@example.com\", \"group:admins@example.com\", \"domain:google.com\", \"serviceAccount:my-other-app@appspot.gserviceaccount.com\", ] }, { \"role\": \"roles/viewer\", \"members\": [\"user:sean@example.com\"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam).",
"properties": {
"version": {
"type": "integer",
@ -293,12 +317,6 @@
"$ref": "Binding"
}
},
"rules": {
"type": "array",
"items": {
"$ref": "Rule"
}
},
"etag": {
"type": "string",
"description": "`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.",
@ -324,162 +342,6 @@
}
}
},
"Rule": {
"id": "Rule",
"type": "object",
"description": "A rule to be applied in a Policy.",
"properties": {
"description": {
"type": "string",
"description": "Human-readable description of the rule."
},
"permissions": {
"type": "array",
"description": "A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.",
"items": {
"type": "string"
}
},
"action": {
"type": "string",
"description": "Required",
"enum": [
"NO_ACTION",
"ALLOW",
"ALLOW_WITH_LOG",
"DENY",
"DENY_WITH_LOG",
"LOG"
]
},
"in": {
"type": "array",
"description": "The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this set of entries.",
"items": {
"type": "string"
}
},
"notIn": {
"type": "array",
"description": "The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in this set of entries. The format for in and not_in entries is the same as for members in a Binding (see google/iam/v1/policy.proto).",
"items": {
"type": "string"
}
},
"conditions": {
"type": "array",
"description": "Additional restrictions that must be met",
"items": {
"$ref": "Condition"
}
},
"logConfig": {
"type": "array",
"description": "The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action.",
"items": {
"$ref": "LogConfig"
}
}
}
},
"Condition": {
"id": "Condition",
"type": "object",
"description": "A condition to be met.",
"properties": {
"iam": {
"type": "string",
"description": "Trusted attributes supplied by the IAM system.",
"enum": [
"NO_ATTR",
"AUTHORITY",
"ATTRIBUTION"
]
},
"sys": {
"type": "string",
"description": "Trusted attributes supplied by any service that owns resources and uses the IAM system for access control.",
"enum": [
"NO_ATTR",
"REGION",
"SERVICE",
"NAME",
"IP"
]
},
"svc": {
"type": "string",
"description": "Trusted attributes discharged by the service."
},
"op": {
"type": "string",
"description": "An operator to apply the subject with.",
"enum": [
"NO_OP",
"EQUALS",
"NOT_EQUALS",
"IN",
"NOT_IN",
"DISCHARGED"
]
},
"value": {
"type": "string",
"description": "The object of the condition. Exactly one of these must be set."
},
"values": {
"type": "array",
"description": "The objects of the condition. This is mutually exclusive with 'value'.",
"items": {
"type": "string"
}
}
}
},
"LogConfig": {
"id": "LogConfig",
"type": "object",
"description": "Specifies what kind of log the caller must write Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in \"_count\". Field names should not contain an initial slash. The actual exported metric names will have \"/iam/policy\" prepended. Field names correspond to IAM request parameters and field values are their respective values. At present only \"iam_principal\", corresponding to IAMContext.principal, is supported. Examples: counter { metric: \"/debug_access_count\" field: \"iam_principal\" } ==\u003e increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} At this time we do not support: * multiple field names (though this may be supported in the future) * decrementing the counter * incrementing it by anything other than 1",
"properties": {
"counter": {
"$ref": "CounterOptions",
"description": "Counter options."
},
"dataAccess": {
"$ref": "DataAccessOptions",
"description": "Data access options."
},
"cloudAudit": {
"$ref": "CloudAuditOptions",
"description": "Cloud audit options."
}
}
},
"CounterOptions": {
"id": "CounterOptions",
"type": "object",
"description": "Options for counters",
"properties": {
"metric": {
"type": "string",
"description": "The metric to update."
},
"field": {
"type": "string",
"description": "The field value to attribute."
}
}
},
"DataAccessOptions": {
"id": "DataAccessOptions",
"type": "object",
"description": "Write a Data Access (Gin) log"
},
"CloudAuditOptions": {
"id": "CloudAuditOptions",
"type": "object",
"description": "Write a Cloud Audit log"
},
"SetIamPolicyRequest": {
"id": "SetIamPolicyRequest",
"type": "object",
@ -498,7 +360,7 @@
"properties": {
"permissions": {
"type": "array",
"description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.",
"description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).",
"items": {
"type": "string"
}
@ -518,6 +380,99 @@
}
}
}
},
"QueryGrantableRolesRequest": {
"id": "QueryGrantableRolesRequest",
"type": "object",
"description": "The grantable role query request.",
"properties": {
"fullResourceName": {
"type": "string",
"description": "Required. The full resource name to query from the list of grantable roles. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`."
}
}
},
"QueryGrantableRolesResponse": {
"id": "QueryGrantableRolesResponse",
"type": "object",
"description": "The grantable role query response.",
"properties": {
"roles": {
"type": "array",
"description": "The list of matching roles.",
"items": {
"$ref": "Role"
}
}
}
},
"Role": {
"id": "Role",
"type": "object",
"description": "A role in the Identity and Access Management API.",
"properties": {
"name": {
"type": "string",
"description": "The name of the role. When Role is used in CreateRole, the role name must not be set. When Role is used in output and other input such as UpdateRole, the role name is the complete path, e.g., roles/logging.viewer for curated roles and organizations/{organization-id}/roles/logging.viewer for custom roles."
},
"title": {
"type": "string",
"description": "Optional. A human-readable title for the role. Typically this is limited to 100 UTF-8 bytes."
},
"description": {
"type": "string",
"description": "Optional. A human-readable description for the role."
}
}
},
"AuditData": {
"id": "AuditData",
"type": "object",
"description": "Audit log information specific to Cloud IAM. This message is serialized as an `Any` type in the `ServiceData` message of an `AuditLog` message.",
"properties": {
"policyDelta": {
"$ref": "PolicyDelta",
"description": "Policy delta between the original policy and the newly set policy."
}
}
},
"PolicyDelta": {
"id": "PolicyDelta",
"type": "object",
"description": "The difference delta between two policies.",
"properties": {
"bindingDeltas": {
"type": "array",
"description": "The delta for Bindings between two policies.",
"items": {
"$ref": "BindingDelta"
}
}
}
},
"BindingDelta": {
"id": "BindingDelta",
"type": "object",
"description": "One delta entry for Binding. Each individual change (only one member in each entry) to a binding will be a separate entry.",
"properties": {
"action": {
"type": "string",
"description": "The action that was performed on a Binding. Required",
"enum": [
"ACTION_UNSPECIFIED",
"ADD",
"REMOVE"
]
},
"role": {
"type": "string",
"description": "Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required"
},
"member": {
"type": "string",
"description": "A single identity requesting access for a Cloud Platform resource. Follows the same format of Binding.members. Required"
}
}
}
},
"resources": {
@ -529,24 +484,24 @@
"id": "iam.projects.serviceAccounts.list",
"path": "v1/{+name}/serviceAccounts",
"httpMethod": "GET",
"description": "Lists service accounts for a project.",
"description": "Lists ServiceAccounts for a project.",
"parameters": {
"name": {
"type": "string",
"description": "Required. The resource name of the project associated with the service accounts, such as \"projects/123\"",
"description": "Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.",
"required": true,
"pattern": "^projects/[^/]*$",
"location": "path"
},
"pageSize": {
"type": "integer",
"description": "Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the [ListServiceAccountsResponse.next_page_token] in a subsequent request.",
"description": "Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the ListServiceAccountsResponse.next_page_token in a subsequent request.",
"format": "int32",
"location": "query"
},
"pageToken": {
"type": "string",
"description": "Optional pagination token returned in an earlier [ListServiceAccountsResponse.next_page_token].",
"description": "Optional pagination token returned in an earlier ListServiceAccountsResponse.next_page_token.",
"location": "query"
}
},
@ -564,11 +519,11 @@
"id": "iam.projects.serviceAccounts.get",
"path": "v1/{+name}",
"httpMethod": "GET",
"description": "Gets a ServiceAccount",
"description": "Gets a ServiceAccount.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -588,11 +543,11 @@
"id": "iam.projects.serviceAccounts.create",
"path": "v1/{+name}/serviceAccounts",
"httpMethod": "POST",
"description": "Creates a service account and returns it.",
"description": "Creates a ServiceAccount and returns it.",
"parameters": {
"name": {
"type": "string",
"description": "Required. The resource name of the project associated with the service accounts, such as \"projects/123\"",
"description": "Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`.",
"required": true,
"pattern": "^projects/[^/]*$",
"location": "path"
@ -615,11 +570,11 @@
"id": "iam.projects.serviceAccounts.update",
"path": "v1/{+name}",
"httpMethod": "PUT",
"description": "Updates a service account. Currently, only the following fields are updatable: 'display_name' . The 'etag' is mandatory.",
"description": "Updates a ServiceAccount. Currently, only the following fields are updatable: `display_name` . The `etag` is mandatory.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". In requests using '-' as a wildcard for the project, will infer the project from the account and the account value can be the email address or the unique_id of the service account. In responses the resource name will always be in the format \"projects/{project}/serviceAccounts/{email}\".",
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -642,11 +597,11 @@
"id": "iam.projects.serviceAccounts.delete",
"path": "v1/{+name}",
"httpMethod": "DELETE",
"description": "Deletes a service acount.",
"description": "Deletes a ServiceAccount.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -666,11 +621,11 @@
"id": "iam.projects.serviceAccounts.signBlob",
"path": "v1/{+name}:signBlob",
"httpMethod": "POST",
"description": "Signs a blob using a service account.",
"description": "Signs a blob using a service account's system-managed private key.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -693,11 +648,11 @@
"id": "iam.projects.serviceAccounts.getIamPolicy",
"path": "v1/{+resource}:getIamPolicy",
"httpMethod": "POST",
"description": "Returns the IAM access control policy for specified IAM resource.",
"description": "Returns the IAM access control policy for a ServiceAccount.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -717,11 +672,11 @@
"id": "iam.projects.serviceAccounts.setIamPolicy",
"path": "v1/{+resource}:setIamPolicy",
"httpMethod": "POST",
"description": "Sets the IAM access control policy for the specified IAM resource.",
"description": "Sets the IAM access control policy for a ServiceAccount.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -744,11 +699,11 @@
"id": "iam.projects.serviceAccounts.testIamPermissions",
"path": "v1/{+resource}:testIamPermissions",
"httpMethod": "POST",
"description": "Tests the specified permissions against the IAM access control policy for the specified IAM resource.",
"description": "Tests the specified permissions against the IAM access control policy for a ServiceAccount.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -775,18 +730,18 @@
"id": "iam.projects.serviceAccounts.keys.list",
"path": "v1/{+name}/keys",
"httpMethod": "GET",
"description": "Lists service account keys",
"description": "Lists ServiceAccountKeys.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project, will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
},
"keyTypes": {
"type": "string",
"description": "The type of keys the user wants to list. If empty, all key types are included in the response. Duplicate key types are not allowed.",
"description": "Filters the types of keys the user wants to include in the list response. Duplicate key types are not allowed. If no key type is provided, all keys are returned.",
"enum": [
"KEY_TYPE_UNSPECIFIED",
"USER_MANAGED",
@ -814,10 +769,20 @@
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{account}/keys/{key}\". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*/keys/[^/]*$",
"location": "path"
},
"publicKeyType": {
"type": "string",
"description": "The output format of the public key requested. X509_PEM is the default output format.",
"enum": [
"TYPE_NONE",
"TYPE_X509_PEM_FILE",
"TYPE_RAW_PUBLIC_KEY"
],
"location": "query"
}
},
"parameterOrder": [
@ -834,11 +799,11 @@
"id": "iam.projects.serviceAccounts.keys.create",
"path": "v1/{+name}/keys",
"httpMethod": "POST",
"description": "Creates a service account key and returns it.",
"description": "Creates a ServiceAccountKey and returns it.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account in the format \"projects/{project}/serviceAccounts/{account}\". Using '-' as a wildcard for the project, will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*$",
"location": "path"
@ -861,11 +826,11 @@
"id": "iam.projects.serviceAccounts.keys.delete",
"path": "v1/{+name}",
"httpMethod": "DELETE",
"description": "Deletes a service account key.",
"description": "Deletes a ServiceAccountKey.",
"parameters": {
"name": {
"type": "string",
"description": "The resource name of the service account key in the format \"projects/{project}/serviceAccounts/{account}/keys/{key}\". Using '-' as a wildcard for the project will infer the project from the account. The account value can be the email address or the unique_id of the service account.",
"description": "The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.",
"required": true,
"pattern": "^projects/[^/]*/serviceAccounts/[^/]*/keys/[^/]*$",
"location": "path"
@ -886,6 +851,25 @@
}
}
}
},
"roles": {
"methods": {
"queryGrantableRoles": {
"id": "iam.roles.queryGrantableRoles",
"path": "v1/roles:queryGrantableRoles",
"httpMethod": "POST",
"description": "Queries roles that can be granted on a particular resource. A role is grantable if it can be used as the role in a binding for a policy for that resource.",
"request": {
"$ref": "QueryGrantableRolesRequest"
},
"response": {
"$ref": "QueryGrantableRolesResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
"etag": "\"jQLIOHBVnDZie4rQHGH1WJF-INE/liyzgLngirW3xU7Tt2Pd1AnSK1c\"",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/HIsdIvCDXEirzqtPtZbE0wV3MKA\"",
"discoveryVersion": "v1",
"id": "pubsub:v1",
"name": "pubsub",
"version": "v1",
"revision": "20160317",
"revision": "20161003",
"title": "Google Cloud Pub/Sub API",
"description": "Provides reliable, many-to-many, asynchronous messaging between applications.",
"ownerDomain": "google.com",
@ -173,7 +173,7 @@
"properties": {
"permissions": {
"type": "array",
"description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview.",
"description": "The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).",
"items": {
"type": "string"
}
@ -226,7 +226,7 @@
"properties": {
"data": {
"type": "string",
"description": "The message payload. For JSON requests, the value of this field must be base64-encoded.",
"description": "The message payload. For JSON requests, the value of this field must be [base64-encoded](https://tools.ietf.org/html/rfc4648).",
"format": "byte"
},
"attributes": {
@ -320,7 +320,7 @@
},
"ackDeadlineSeconds": {
"type": "integer",
"description": "This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using pull. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. If this parameter is not set, the default value of 10 seconds is used.",
"description": "This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call `ModifyAckDeadline` with the corresponding `ack_id` if using pull. The maximum custom deadline you can specify is 600 seconds (10 minutes). For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message. If this parameter is 0, a default value of 10 seconds is used.",
"format": "int32"
}
}
@ -464,7 +464,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/topics/[^/]*$",
"location": "path"
@ -488,11 +488,11 @@
"id": "pubsub.projects.topics.getIamPolicy",
"path": "v1/{+resource}:getIamPolicy",
"httpMethod": "GET",
"description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.",
"description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/topics/[^/]*$",
"location": "path"
@ -517,7 +517,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/topics/[^/]*$",
"location": "path"
@ -733,7 +733,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/subscriptions/[^/]*$",
"location": "path"
@ -757,11 +757,11 @@
"id": "pubsub.projects.subscriptions.getIamPolicy",
"path": "v1/{+resource}:getIamPolicy",
"httpMethod": "GET",
"description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.",
"description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation.",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/subscriptions/[^/]*$",
"location": "path"
@ -786,7 +786,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation.",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/subscriptions/[^/]*$",
"location": "path"
@ -810,7 +810,7 @@
"id": "pubsub.projects.subscriptions.create",
"path": "v1/{+name}",
"httpMethod": "PUT",
"description": "Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic.",
"description": "Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic. Note that for REST API requests, you must specify a name.",
"parameters": {
"name": {
"type": "string",
@ -899,7 +899,7 @@
"id": "pubsub.projects.subscriptions.delete",
"path": "v1/{+subscription}",
"httpMethod": "DELETE",
"description": "Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified.",
"description": "Deletes an existing subscription. All messages retained in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription or its topic unless the same topic is specified.",
"parameters": {
"subscription": {
"type": "string",
@ -924,7 +924,7 @@
"id": "pubsub.projects.subscriptions.modifyAckDeadline",
"path": "v1/{+subscription}:modifyAckDeadline",
"httpMethod": "POST",
"description": "Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted.",
"description": "Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.",
"parameters": {
"subscription": {
"type": "string",
@ -1033,6 +1033,91 @@
]
}
}
},
"snapshots": {
"methods": {
"setIamPolicy": {
"id": "pubsub.projects.snapshots.setIamPolicy",
"path": "v1/{+resource}:setIamPolicy",
"httpMethod": "POST",
"description": "Sets the access control policy on the specified resource. Replaces any existing policy.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/snapshots/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"resource"
],
"request": {
"$ref": "SetIamPolicyRequest"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/pubsub"
]
},
"getIamPolicy": {
"id": "pubsub.projects.snapshots.getIamPolicy",
"path": "v1/{+resource}:getIamPolicy",
"httpMethod": "GET",
"description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/snapshots/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"resource"
],
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/pubsub"
]
},
"testIamPermissions": {
"id": "pubsub.projects.snapshots.testIamPermissions",
"path": "v1/{+resource}:testIamPermissions",
"httpMethod": "POST",
"description": "Returns permissions that a caller has on the specified resource.",
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.",
"required": true,
"pattern": "^projects/[^/]*/snapshots/[^/]*$",
"location": "path"
}
},
"parameterOrder": [
"resource"
],
"request": {
"$ref": "TestIamPermissionsRequest"
},
"response": {
"$ref": "TestIamPermissionsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/pubsub"
]
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
{
"kind": "discovery#restDescription",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Bw6HlPfCUqTIhF647hFuWCHD0c8\"",
"etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/0q1bgr0rR6WxzzPOS6Rfltu7D84\"",
"discoveryVersion": "v1",
"id": "sqladmin:v1beta4",
"name": "sqladmin",
"canonicalName": "SQL Admin",
"version": "v1beta4",
"revision": "20160712",
"revision": "20161115",
"title": "Cloud SQL Administration API",
"description": "Creates and configures Cloud SQL instances, which provide fully-managed MySQL databases.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {
"x16": "http://www.google.com/images/icons/product/search-16.gif",
"x32": "http://www.google.com/images/icons/product/search-32.gif"
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"
},
"documentationLink": "https://cloud.google.com/sql/docs/reference/latest",
"protocol": "rest",
@ -333,6 +333,10 @@
"type": "string",
"description": "FIRST_GEN: Basic Cloud SQL instance that runs in a Google-managed container.\nSECOND_GEN: A newer Cloud SQL backend that runs in a Compute Engine VM.\nEXTERNAL: A MySQL server that is not managed by Google."
},
"connectionName": {
"type": "string",
"description": "Connection name of the Cloud SQL instance used in connection strings."
},
"currentDiskSize": {
"type": "string",
"description": "The current disk usage of the instance in bytes. This property has been deprecated. Users should use the \"cloudsql.googleapis.com/database/disk/bytes_used\" metric in Cloud Monitoring API instead. Please see https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ for details.",
@ -767,6 +771,10 @@
"type": "string",
"description": "The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. This field is only available when the IP is scheduled to be retired.",
"format": "date-time"
},
"type": {
"type": "string",
"description": "The type of this IP address. A PRIMARY address is an address that can accept incoming connections. An OUTGOING address is the source address of connections originating from the instance, if supported."
}
}
},
@ -1307,7 +1315,7 @@
},
"region": {
"type": "array",
"description": "The applicable regions for this tier. Can be us-east1, europe-west1 or asia-east1.",
"description": "The applicable regions for this tier.",
"items": {
"type": "string"
}
@ -1482,7 +1490,7 @@
"id": "sql.backupRuns.insert",
"path": "projects/{project}/instances/{instance}/backupRuns",
"httpMethod": "POST",
"description": "Creates a new backup run on demand.",
"description": "Creates a new backup run on demand. This method is applicable only to Second Generation instances.",
"parameters": {
"instance": {
"type": "string",
@ -1506,7 +1514,11 @@
},
"response": {
"$ref": "Operation"
}
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/sqlservice.admin"
]
},
"list": {
"id": "sql.backupRuns.list",

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/WoNfwvHOxLFHVTodCpDiAsVbMpQ\"",
"etag": "\"tbys6C40o18GZwyMen5GMkdK-3s/sMgjc4eoIFjgub4daTU-MGW0WMA\"",
"discoveryVersion": "v1",
"id": "storage:v1",
"name": "storage",
"version": "v1",
"revision": "20160714",
"revision": "20161109",
"title": "Cloud Storage JSON API",
"description": "Stores and retrieves potentially large, immutable data objects.",
"ownerDomain": "google.com",
@ -177,9 +177,13 @@
"type": "object",
"description": "The action to take.",
"properties": {
"storageClass": {
"type": "string",
"description": "Target storage class. Required iff the type of the action is SetStorageClass."
},
"type": {
"type": "string",
"description": "Type of the action. Currently, only Delete is supported."
"description": "Type of the action. Currently, only Delete and SetStorageClass are supported."
}
}
},
@ -201,6 +205,13 @@
"type": "boolean",
"description": "Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects."
},
"matchesStorageClass": {
"type": "array",
"description": "Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, and DURABLE_REDUCED_AVAILABILITY.",
"items": {
"type": "string"
}
},
"numNewerVersions": {
"type": "integer",
"description": "Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object.",
@ -270,7 +281,7 @@
},
"storageClass": {
"type": "string",
"description": "The bucket's storage class. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include STANDARD, NEARLINE and DURABLE_REDUCED_AVAILABILITY. Defaults to STANDARD. For more information, see storage classes."
"description": "The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes."
},
"timeCreated": {
"type": "string",
@ -674,6 +685,11 @@
"description": "The deletion time of the object in RFC 3339 format. Will be returned if and only if this version of the object has been deleted.",
"format": "date-time"
},
"timeStorageClassUpdated": {
"type": "string",
"description": "The time at which the object's storage class was last changed. When the object is initially created, it will be set to timeCreated.",
"format": "date-time"
},
"updated": {
"type": "string",
"description": "The modification time of the object metadata in RFC 3339 format.",
@ -700,7 +716,13 @@
},
"entity": {
"type": "string",
"description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com."
"description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.",
"annotations": {
"required": [
"storage.defaultObjectAccessControls.insert",
"storage.objectAccessControls.insert"
]
}
},
"entityId": {
"type": "string",
@ -712,7 +734,7 @@
},
"generation": {
"type": "string",
"description": "The content generation of the object.",
"description": "The content generation of the object, if applied to an object.",
"format": "int64"
},
"id": {
@ -726,7 +748,7 @@
},
"object": {
"type": "string",
"description": "The name of the object."
"description": "The name of the object, if applied to an object."
},
"projectTeam": {
"type": "object",
@ -744,7 +766,13 @@
},
"role": {
"type": "string",
"description": "The access permission for the entity."
"description": "The access permission for the entity.",
"annotations": {
"required": [
"storage.defaultObjectAccessControls.insert",
"storage.objectAccessControls.insert"
]
}
},
"selfLink": {
"type": "string",
@ -761,7 +789,7 @@
"type": "array",
"description": "The list of items.",
"items": {
"type": "any"
"$ref": "ObjectAccessControl"
}
},
"kind": {
@ -1249,7 +1277,7 @@
"id": "storage.buckets.patch",
"path": "b/{bucket}",
"httpMethod": "PATCH",
"description": "Updates a bucket. This method supports patch semantics.",
"description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics.",
"parameters": {
"bucket": {
"type": "string",
@ -1341,7 +1369,7 @@
"id": "storage.buckets.update",
"path": "b/{bucket}",
"httpMethod": "PUT",
"description": "Updates a bucket.",
"description": "Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.",
"parameters": {
"bucket": {
"type": "string",

File diff suppressed because it is too large Load Diff

54
vendor/vendor.json vendored
View File

@ -2380,34 +2380,34 @@
"revisionTime": "2016-11-10T11:58:56Z"
},
{
"checksumSHA1": "QDbbtubwRml+xdgIfNy/yC6Ff78=",
"checksumSHA1": "SIsWfZXQERRErpy9TD1ETop72uU=",
"path": "google.golang.org/api/cloudresourcemanager/v1",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4",
"revisionTime": "2016-03-24T17:48:31Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "K2ewXgyH/uLdvOdg2ad02Z6Jym0=",
"checksumSHA1": "wIomSQkpEQ6U71+hZStbt7+ttOQ=",
"path": "google.golang.org/api/compute/v1",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "vnUDudEduSBUqwC+jVs6xt1Sm0w=",
"checksumSHA1": "qt8Mg1hYm0ApdGODreQxBh30FDU=",
"path": "google.golang.org/api/container/v1",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "ij1heqr+F07H75D4og/yUqRFf3I=",
"checksumSHA1": "JYl35km48fLrIx7YUtzcgd4J7Rk=",
"path": "google.golang.org/api/dns/v1",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "SLzHstPylt3EcBt9yEBJV+JqGp4=",
"checksumSHA1": "I1JSeU5OMapl+4s2VrnBkMon3Bw=",
"path": "google.golang.org/api/gensupport",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "yQREK/OWrz9PLljbr127+xFk6J0=",
@ -2422,28 +2422,28 @@
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "NetCfFfklnz0sJXmRPIRJsPKV5Q=",
"checksumSHA1": "+u3FeHSXeRJZzw52OZsT3wUPb24=",
"path": "google.golang.org/api/iam/v1",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4",
"revisionTime": "2016-03-24T17:48:31Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "M7er6A8YuCmllh/cj/fZhHDEb3I=",
"checksumSHA1": "34BpqXixb+aV4iuOioQeSej255Y=",
"path": "google.golang.org/api/pubsub/v1",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "dpHo8BrIZVf88kAsFoWYuSpG8i4=",
"checksumSHA1": "moKPpECJZQR/mANGD26E7Pbxn4I=",
"path": "google.golang.org/api/sqladmin/v1beta4",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"checksumSHA1": "qi0hBhwhMRAYlSYFHeHCde+jzAQ=",
"checksumSHA1": "xygm9BwoCg7vc0PPgAPdxNKJ38c=",
"path": "google.golang.org/api/storage/v1",
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
"revision": "3cc2e591b550923a2c5f0ab5a803feda924d5823",
"revisionTime": "2016-11-27T23:54:21Z"
},
{
"path": "google.golang.org/appengine",

View File

@ -15,7 +15,7 @@ documentation](https://cloud.google.com/compute/docs/load-balancing/network/forw
## Example Usage
```js
```tf
resource "google_compute_forwarding_rule" "default" {
name = "test"
target = "${google_compute_target_pool.default.self_link}"
@ -30,20 +30,32 @@ The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE. Changing
this forces a new resource to be created.
* `target` - (Required) URL of target pool.
- - -
* `backend_service` - (Optional) BackendService resource to receive the
matched traffic. Only used for internal load balancing.
* `description` - (Optional) Textual description field.
* `ip_address` - (Optional) The static IP. (if not set, an ephemeral IP is
used).
* `ip_protocol` - (Optional) The IP protocol to route, one of "TCP" "UDP" "AH"
"ESP" or "SCTP". (default "TCP").
"ESP" or "SCTP" for external load balancing, "TCP" or "UDP" for internal
(default "TCP").
* `load_balancing_scheme` - (Optional) Type of load balancing to use. Can be
set to "INTERNAL" or "EXTERNAL" (default "EXTERNAL").
* `network` - (Optional) Network that the load balanced IP should belong to.
Only used for internal load balancing. If it is not provided, the default
network is used.
* `port_range` - (Optional) A range e.g. "1024-2048" or a single port "1024"
(defaults to all ports!).
(defaults to all ports!). Only used for external load balancing.
* `ports` - (Optional) A list of ports to use for internal load balancing
(defaults to all ports).
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
@ -51,6 +63,13 @@ The following arguments are supported:
* `region` - (Optional) The Region in which the created address should reside.
If it is not provided, the provider region is used.
* `subnetwork` - (Optional) Subnetwork that the load balanced IP should belong
to. Only used for internal load balancing. Must be specified if the network
is in custom subnet mode.
* `target` - (Optional) URL of target pool. Required for external load
balancing.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are

View File

@ -0,0 +1,124 @@
---
layout: "google"
page_title: "Google: google_compute_health_check"
sidebar_current: "docs-google-compute-health-check"
description: |-
Manages a Health Check within GCE.
---
# google\_compute\_health\_check
Manages a health check within GCE. This is used to monitor instances
behind load balancers. Timeouts or HTTP errors cause the instance to be
removed from the pool. For more information, see [the official
documentation](https://cloud.google.com/compute/docs/load-balancing/health-checks)
and
[API](https://cloud.google.com/compute/docs/reference/latest/healthChecks).
## Example Usage
```tf
resource "google_compute_health_check" "default" {
name = "test"
timeout_sec = 1
check_interval_sec = 1
tcp_health_check {
port = "80"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A unique name for the resource, required by GCE.
Changing this forces a new resource to be created.
- - -
* `check_interval_sec` - (Optional) The number of seconds between each poll of
the instance instance (default 5).
* `description` - (Optional) Textual description field.
* `healthy_threshold` - (Optional) Consecutive successes required (default 2).
* `http_health_check` - (Optional) An HTTP Health Check.
See *HTTP Health Check* below.
* `https_health_check` - (Optional) An HTTPS Health Check.
See *HTTPS Health Check* below.
* `ssl_health_check` - (Optional) An SSL Health Check.
See *SSL Health Check* below.
* `tcp_health_check` - (Optional) A TCP Health Check.
See *TCP Health Check* below.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `timeout_sec` - (Optional) The number of seconds to wait before declaring
failure (default 5).
* `unhealthy_threshold` - (Optional) Consecutive failures required (default 2).
**HTTP Health Check** supports the following attributes:
* `host` - (Optional) HTTP host header field (default instance's public ip).
* `port` - (Optional) TCP port to connect to (default 80).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request_path` - (Optional) URL path to query (default /).
**HTTPS Health Check** supports the following attributes:
* `host` - (Optional) HTTPS host header field (default instance's public ip).
* `port` - (Optional) TCP port to connect to (default 443).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request_path` - (Optional) URL path to query (default /).
**SSL Health Check** supports the following attributes:
* `port` - (Optional) TCP port to connect to (default 443).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request` - (Optional) Application data to send once the SSL connection has
been established (default "").
* `response` - (Optional) The response that indicates health (default "")
**TCP Health Check** supports the following attributes:
* `port` - (Optional) TCP port to connect to (default 80).
* `proxy_header` - (Optional) Type of proxy header to append before sending
data to the backend, either NONE or PROXY_V1 (default NONE).
* `request` - (Optional) Application data to send once the TCP connection has
been established (default "").
* `response` - (Optional) The response that indicates health (default "")
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `self_link` - The URI of the created resource.

View File

@ -0,0 +1,127 @@
---
layout: "google"
page_title: "Google: google_compute_region_backend_service"
sidebar_current: "docs-google-compute-region-backend-service"
description: |-
Creates a Region Backend Service resource for Google Compute Engine.
---
# google\_compute\_region\_backend\_service
A Region Backend Service defines a regionally-scoped group of virtual machines that will serve traffic for load balancing.
See [backendServices](https://cloud.google.com/compute/docs/reference/latest/backendServices) documentation for more on this resource type, and [Internal Load Balancing](https://cloud.google.com/compute/docs/load-balancing/internal/) documentation for more details on usage.
## Example Usage
```tf
resource "google_compute_region_backend_service" "foobar" {
name = "blablah"
description = "Hello World 1234"
protocol = "TCP"
timeout_sec = 10
backend {
group = "${google_compute_instance_group_manager.foo.instance_group}"
}
health_checks = ["${google_compute_health_check.default.self_link}"]
}
resource "google_compute_instance_group_manager" "foo" {
name = "terraform-test"
instance_template = "${google_compute_instance_template.foobar.self_link}"
base_instance_name = "foobar"
zone = "us-central1-f"
target_size = 1
}
resource "google_compute_instance_template" "foobar" {
name = "terraform-test"
machine_type = "n1-standard-1"
network_interface {
network = "default"
}
disk {
source_image = "debian-cloud/debian-8"
auto_delete = true
boot = true
}
}
resource "google_compute_health_check" "default" {
name = "test"
check_interval_sec = 1
timeout_sec = 1
type = "TCP"
tcp_health_check {
port = "80"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the backend service.
* `health_checks` - (Required) Specifies a list of health check objects
for checking the health of the backend service.
- - -
* `backend` - (Optional) The list of backends that serve this BackendService.
See *Backend* below.
* `description` - (Optional) The textual description for the backend service.
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `protocol` - (Optional) The protocol for incoming requests. Defaults to
`HTTP`.
* `region` - (Optional) The Region in which the created address should reside.
If it is not provided, the provider region is used.
* `timeout_sec` - (Optional) The number of secs to wait for a backend to respond
to a request before considering the request failed. Defaults to `30`.
**Backend** supports the following attributes:
* `group` - (Required) The name or URI of a Compute Engine instance group
(`google_compute_instance_group_manager.xyz.instance_group`) that can
receive traffic.
* `balancing_mode` - (Optional) Defines the strategy for balancing load.
Defaults to `UTILIZATION`
* `capacity_scaler` - (Optional) A float in the range [0, 1.0] that scales the
maximum parameters for the group (e.g., max rate). A value of 0.0 will cause
no requests to be sent to the group (i.e., it adds the group in a drained
state). The default is 1.0.
* `description` - (Optional) Textual description for the backend.
* `max_rate` - (Optional) Maximum requests per second (RPS) that the group can
handle.
* `max_rate_per_instance` - (Optional) The maximum per-instance requests per
second (RPS).
* `max_utilization` - (Optional) The target CPU utilization for the group as a
float in the range [0.0, 1.0]. This flag can only be provided when the
balancing mode is `UTILIZATION`. Defaults to `0.8`.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `fingerprint` - The fingerprint of the backend service.
* `self_link` - The URI of the created resource.