providers/google: Add google_compute_image resource (#7960)

* providers/google: Add google_compute_image resource

This change introduces the google_compute_image resource, which allows
Terraform users to create a bootable VM image from a raw disk tarball
stored in Google Cloud Storage. The google_compute_image resource
may be referenced as a boot image for a google_compute_instance.

* providers/google: Support family property in google_compute_image

* provider/google: Idiomatic checking for presence of config val

* vendor: Update Google client libraries
This commit is contained in:
Evan Brown 2016-08-11 19:35:33 -07:00 committed by Paul Stack
parent 6ff3df8552
commit 93b2c71544
18 changed files with 3575 additions and 1815 deletions

View File

@ -67,6 +67,7 @@ func Provider() terraform.ResourceProvider {
"google_compute_global_forwarding_rule": resourceComputeGlobalForwardingRule(),
"google_compute_http_health_check": resourceComputeHttpHealthCheck(),
"google_compute_https_health_check": resourceComputeHttpsHealthCheck(),
"google_compute_image": resourceComputeImage(),
"google_compute_instance": resourceComputeInstance(),
"google_compute_instance_group": resourceComputeInstanceGroup(),
"google_compute_instance_group_manager": resourceComputeInstanceGroupManager(),

View File

@ -0,0 +1,176 @@
package google
import (
"fmt"
"log"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/compute/v1"
"google.golang.org/api/googleapi"
)
func resourceComputeImage() *schema.Resource {
return &schema.Resource{
Create: resourceComputeImageCreate,
Read: resourceComputeImageRead,
Delete: resourceComputeImageDelete,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"description": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"family": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"raw_disk": &schema.Schema{
Type: schema.TypeList,
Required: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"source": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"sha1": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"container_type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "TAR",
ForceNew: true,
},
},
},
},
"self_link": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
}
}
func resourceComputeImageCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
// Build the image
image := &compute.Image{
Name: d.Get("name").(string),
}
if v, ok := d.GetOk("description"); ok {
image.Description = v.(string)
}
if v, ok := d.GetOk("family"); ok {
image.Family = v.(string)
}
rawDiskEle := d.Get("raw_disk").([]interface{})[0].(map[string]interface{})
imageRawDisk := &compute.ImageRawDisk{
Source: rawDiskEle["source"].(string),
ContainerType: rawDiskEle["container_type"].(string),
}
if val, ok := rawDiskEle["sha1"]; ok {
imageRawDisk.Sha1Checksum = val.(string)
}
image.RawDisk = imageRawDisk
// Insert the image
op, err := config.clientCompute.Images.Insert(
project, image).Do()
if err != nil {
return fmt.Errorf("Error creating image: %s", err)
}
// Store the ID
d.SetId(image.Name)
err = computeOperationWaitGlobal(config, op, project, "Creating Image")
if err != nil {
return err
}
return resourceComputeImageRead(d, meta)
}
func resourceComputeImageRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
image, err := config.clientCompute.Images.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 Image %q because it's gone", d.Get("name").(string))
d.SetId("")
return nil
}
return fmt.Errorf("Error reading image: %s", err)
}
d.Set("self_link", image.SelfLink)
return nil
}
func resourceComputeImageDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
project, err := getProject(d, config)
if err != nil {
return err
}
// Delete the image
log.Printf("[DEBUG] image delete request")
op, err := config.clientCompute.Images.Delete(
project, d.Id()).Do()
if err != nil {
return fmt.Errorf("Error deleting image: %s", err)
}
err = computeOperationWaitGlobal(config, op, project, "Deleting image")
if err != nil {
return err
}
d.SetId("")
return nil
}

View File

@ -0,0 +1,85 @@
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 TestAccComputeImage_basic(t *testing.T) {
var image compute.Image
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeImageDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccComputeImage_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeImageExists(
"google_compute_image.foobar", &image),
),
},
},
})
}
func testAccCheckComputeImageDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_image" {
continue
}
_, err := config.clientCompute.Images.Get(
config.Project, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Image still exists")
}
}
return nil
}
func testAccCheckComputeImageExists(n string, image *compute.Image) 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.Images.Get(
config.Project, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.Primary.ID {
return fmt.Errorf("Image not found")
}
*image = *found
return nil
}
}
var testAccComputeImage_basic = fmt.Sprintf(`
resource "google_compute_image" "foobar" {
name = "image-test-%s"
raw_disk {
source = "https://storage.googleapis.com/bosh-cpi-artifacts/bosh-stemcell-3262.4-google-kvm-ubuntu-trusty-go_agent-raw.tar.gz"
}
}`, acctest.RandString(10))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/OU95LyfeHZcrBJDajlkYXi0P4Wo\"",
"etag": "\"jQLIOHBVnDZie4rQHGH1WJF-INE/cpP4K9eaLrLwMGtsdl5oXjxb8rw\"",
"discoveryVersion": "v1",
"id": "container:v1",
"name": "container",
"version": "v1",
"revision": "20160321",
"revision": "20160421",
"title": "Google Container Engine API",
"description": "Builds and manages clusters that run container-based applications, powered by open source Kubernetes technology.",
"ownerDomain": "google.com",
@ -181,6 +181,20 @@
"type": "string",
"description": "The name of the Google Compute Engine [subnetwork](/compute/docs/subnetworks) to which the cluster is connected."
},
"nodePools": {
"type": "array",
"description": "The node pools associated with this cluster. When creating a new cluster, only a single node pool should be specified. This field should not be set if \"node_config\" or \"initial_node_count\" are specified.",
"items": {
"$ref": "NodePool"
}
},
"locations": {
"type": "array",
"description": "The list of Google Compute Engine [locations](/compute/docs/zones#available) in which the cluster's nodes should be located.",
"items": {
"type": "string"
}
},
"selfLink": {
"type": "string",
"description": "[Output only] Server-defined URL for the resource."
@ -342,6 +356,58 @@
}
}
},
"NodePool": {
"id": "NodePool",
"type": "object",
"description": "NodePool contains the name and configuration for a cluster's node pool. Node pools are a set of nodes (i.e. VM's), with a common configuration and specification, under the control of the cluster master. They may have a set of Kubernetes labels applied to them, which may be used to reference them during pod scheduling. They may also be resized up or down, to accommodate the workload.",
"properties": {
"name": {
"type": "string",
"description": "The name of the node pool."
},
"config": {
"$ref": "NodeConfig",
"description": "The node configuration of the pool."
},
"initialNodeCount": {
"type": "integer",
"description": "The initial node count for the pool. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also have available firewall and routes quota.",
"format": "int32"
},
"selfLink": {
"type": "string",
"description": "Server-defined URL for the resource."
},
"version": {
"type": "string",
"description": "The version of the Kubernetes of this node."
},
"instanceGroupUrls": {
"type": "array",
"description": "[Output only] The resource URLs of [instance groups](/compute/docs/instance-groups/) associated with this node pool.",
"items": {
"type": "string"
}
},
"status": {
"type": "string",
"description": "The status of the nodes in this pool instance.",
"enum": [
"STATUS_UNSPECIFIED",
"PROVISIONING",
"RUNNING",
"RUNNING_WITH_ERROR",
"RECONCILING",
"STOPPING",
"ERROR"
]
},
"statusMessage": {
"type": "string",
"description": "[Output only] Additional information about the current status of this node pool instance, if available."
}
}
},
"CreateClusterRequest": {
"id": "CreateClusterRequest",
"type": "object",
@ -437,6 +503,10 @@
"$ref": "AddonsConfig",
"description": "Configurations for the various addons available to run in the cluster."
},
"desiredNodePoolId": {
"type": "string",
"description": "The node pool to be upgraded. This field is mandatory if the \"desired_node_version\" or \"desired_image_family\" is specified and there is more than one node pool on the cluster."
},
"desiredMasterVersion": {
"type": "string",
"description": "The Kubernetes version to change the master to. The only valid value is the latest supported version. Use \"-\" to have the server automatically select the latest version."
@ -479,6 +549,42 @@
"items": {
"type": "string"
}
},
"defaultImageFamily": {
"type": "string",
"description": "Default image family."
},
"validImageFamilies": {
"type": "array",
"description": "List of valid image families.",
"items": {
"type": "string"
}
}
}
},
"ListNodePoolsResponse": {
"id": "ListNodePoolsResponse",
"type": "object",
"description": "ListNodePoolsResponse is the result of ListNodePoolsRequest.",
"properties": {
"nodePools": {
"type": "array",
"description": "A list of node pools for a cluster.",
"items": {
"$ref": "NodePool"
}
}
}
},
"CreateNodePoolRequest": {
"id": "CreateNodePoolRequest",
"type": "object",
"description": "CreateNodePoolRequest creates a node pool for a cluster.",
"properties": {
"nodePool": {
"$ref": "NodePool",
"description": "The node pool to create."
}
}
}
@ -699,6 +805,177 @@
"https://www.googleapis.com/auth/cloud-platform"
]
}
},
"resources": {
"nodePools": {
"methods": {
"list": {
"id": "container.projects.zones.clusters.nodePools.list",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools",
"httpMethod": "GET",
"description": "Lists the node pools for a cluster.",
"parameters": {
"projectId": {
"type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).",
"required": true,
"location": "path"
},
"zone": {
"type": "string",
"description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides.",
"required": true,
"location": "path"
},
"clusterId": {
"type": "string",
"description": "The name of the cluster.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"projectId",
"zone",
"clusterId"
],
"response": {
"$ref": "ListNodePoolsResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
},
"get": {
"id": "container.projects.zones.clusters.nodePools.get",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}",
"httpMethod": "GET",
"description": "Retrieves the node pool requested.",
"parameters": {
"projectId": {
"type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).",
"required": true,
"location": "path"
},
"zone": {
"type": "string",
"description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides.",
"required": true,
"location": "path"
},
"clusterId": {
"type": "string",
"description": "The name of the cluster.",
"required": true,
"location": "path"
},
"nodePoolId": {
"type": "string",
"description": "The name of the node pool.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"projectId",
"zone",
"clusterId",
"nodePoolId"
],
"response": {
"$ref": "NodePool"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
},
"create": {
"id": "container.projects.zones.clusters.nodePools.create",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools",
"httpMethod": "POST",
"description": "Creates a node pool for a cluster.",
"parameters": {
"projectId": {
"type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).",
"required": true,
"location": "path"
},
"zone": {
"type": "string",
"description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides.",
"required": true,
"location": "path"
},
"clusterId": {
"type": "string",
"description": "The name of the cluster.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"projectId",
"zone",
"clusterId"
],
"request": {
"$ref": "CreateNodePoolRequest"
},
"response": {
"$ref": "Operation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
},
"delete": {
"id": "container.projects.zones.clusters.nodePools.delete",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}",
"httpMethod": "DELETE",
"description": "Deletes a node pool from a cluster.",
"parameters": {
"projectId": {
"type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).",
"required": true,
"location": "path"
},
"zone": {
"type": "string",
"description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides.",
"required": true,
"location": "path"
},
"clusterId": {
"type": "string",
"description": "The name of the cluster.",
"required": true,
"location": "path"
},
"nodePoolId": {
"type": "string",
"description": "The name of the node pool to delete.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"projectId",
"zone",
"clusterId",
"nodePoolId"
],
"response": {
"$ref": "Operation"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
}
}
},
"operations": {

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{
"kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/YvTvEjSR_sXxd8XvUihYx8e9Xjo\"",
"etag": "\"jQLIOHBVnDZie4rQHGH1WJF-INE/ctEt-71wWAltEdgLnIcGLfJZeFE\"",
"discoveryVersion": "v1",
"id": "dns:v1",
"name": "dns",
"version": "v1",
"revision": "20160209",
"revision": "20160413",
"title": "Google Cloud DNS API",
"description": "The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.",
"description": "Configures and serves authoritative DNS records.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {

View File

@ -7,7 +7,7 @@
// import "google.golang.org/api/dns/v1"
// ...
// dnsService, err := dns.New(oauthHttpClient)
package dns
package dns // import "google.golang.org/api/dns/v1"
import (
"bytes"
@ -509,26 +509,24 @@ func (c *ChangesCreateCall) Context(ctx context.Context) *ChangesCreateCall {
}
func (c *ChangesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.change)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}/changes")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.changes.create" call.
@ -563,7 +561,8 @@ func (c *ChangesCreateCall) Do(opts ...googleapi.CallOption) (*Change, error) {
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -652,24 +651,23 @@ func (c *ChangesGetCall) Context(ctx context.Context) *ChangesGetCall {
}
func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}/changes/{changeId}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
"changeId": c.changeId,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.changes.get" call.
@ -704,7 +702,8 @@ func (c *ChangesGetCall) Do(opts ...googleapi.CallOption) (*Change, error) {
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -830,23 +829,22 @@ func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
}
func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}/changes")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.changes.list" call.
@ -881,7 +879,8 @@ func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangesListResponse
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1005,25 +1004,23 @@ func (c *ManagedZonesCreateCall) Context(ctx context.Context) *ManagedZonesCreat
}
func (c *ManagedZonesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.managedzone)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.managedZones.create" call.
@ -1058,7 +1055,8 @@ func (c *ManagedZonesCreateCall) Do(opts ...googleapi.CallOption) (*ManagedZone,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1127,20 +1125,19 @@ func (c *ManagedZonesDeleteCall) Context(ctx context.Context) *ManagedZonesDelet
}
func (c *ManagedZonesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.managedZones.delete" call.
@ -1232,23 +1229,22 @@ func (c *ManagedZonesGetCall) Context(ctx context.Context) *ManagedZonesGetCall
}
func (c *ManagedZonesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.managedZones.get" call.
@ -1283,7 +1279,8 @@ func (c *ManagedZonesGetCall) Do(opts ...googleapi.CallOption) (*ManagedZone, er
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1391,22 +1388,21 @@ func (c *ManagedZonesListCall) Context(ctx context.Context) *ManagedZonesListCal
}
func (c *ManagedZonesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.managedZones.list" call.
@ -1441,7 +1437,8 @@ func (c *ManagedZonesListCall) Do(opts ...googleapi.CallOption) (*ManagedZonesLi
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1555,22 +1552,21 @@ func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall {
}
func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.projects.get" call.
@ -1605,7 +1601,8 @@ func (c *ProjectsGetCall) Do(opts ...googleapi.CallOption) (*Project, error) {
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1716,23 +1713,22 @@ func (c *ResourceRecordSetsListCall) Context(ctx context.Context) *ResourceRecor
}
func (c *ResourceRecordSetsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/managedZones/{managedZone}/rrsets")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"managedZone": c.managedZone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "dns.resourceRecordSets.list" call.
@ -1767,7 +1763,8 @@ func (c *ResourceRecordSetsListCall) Do(opts ...googleapi.CallOption) (*Resource
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil

View File

@ -4,7 +4,7 @@
// Package googleapi contains the common code shared by all Google API
// libraries.
package googleapi
package googleapi // import "google.golang.org/api/googleapi"
import (
"bytes"
@ -421,4 +421,12 @@ type userIP string
func (i userIP) Get() (string, string) { return "userIp", string(i) }
// Trace returns a CallOption that enables diagnostic tracing for a call.
// traceToken is an ID supplied by Google support.
func Trace(traceToken string) CallOption { return traceTok(traceToken) }
type traceTok string
func (t traceTok) Get() (string, string) { return "trace", "token:" + string(t) }
// TODO: Fields too

View File

@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/hbQtG3uMFD1QEGQS0K7qrH-ar90\"",
"etag": "\"jQLIOHBVnDZie4rQHGH1WJF-INE/liyzgLngirW3xU7Tt2Pd1AnSK1c\"",
"discoveryVersion": "v1",
"id": "pubsub:v1",
"name": "pubsub",
"version": "v1",
"revision": "20151103",
"revision": "20160317",
"title": "Google Cloud Pub/Sub API",
"description": "Provides reliable, many-to-many, asynchronous messaging between applications.",
"ownerDomain": "google.com",
@ -127,7 +127,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",
@ -143,7 +143,7 @@
},
"etag": {
"type": "string",
"description": "Can be used to perform a read-modify-write.",
"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"
}
}
@ -159,7 +159,7 @@
},
"members": {
"type": "array",
"description": "Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following formats: * `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`.",
"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"
}
@ -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.",
"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"
}
@ -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 delivery 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`. 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. 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.",
"format": "int32"
}
}
@ -464,7 +464,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which 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 documentation for the respective SetIamPolicy rpc.",
"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.",
"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`. Is empty if the policy or the resource does not exist.",
"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 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 documentation for the respective GetIamPolicy rpc.",
"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.",
"required": true,
"pattern": "^projects/[^/]*/topics/[^/]*$",
"location": "path"
@ -517,7 +517,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which 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 documentation for the respective TestIamPermissions rpc.",
"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.",
"required": true,
"pattern": "^projects/[^/]*/topics/[^/]*$",
"location": "path"
@ -733,7 +733,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which 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 documentation for the respective SetIamPolicy rpc.",
"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.",
"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`. Is empty if the policy or the resource does not exist.",
"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 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 documentation for the respective GetIamPolicy rpc.",
"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.",
"required": true,
"pattern": "^projects/[^/]*/subscriptions/[^/]*$",
"location": "path"
@ -786,7 +786,7 @@
"parameters": {
"resource": {
"type": "string",
"description": "REQUIRED: The resource for which 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 documentation for the respective TestIamPermissions rpc.",
"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.",
"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 for a given subscriber. 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.",
"parameters": {
"name": {
"type": "string",

View File

@ -7,7 +7,7 @@
// import "google.golang.org/api/pubsub/v1"
// ...
// pubsubService, err := pubsub.New(oauthHttpClient)
package pubsub
package pubsub // import "google.golang.org/api/pubsub/v1"
import (
"bytes"
@ -148,7 +148,7 @@ func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
// Binding: Associates `members` with a `role`.
type Binding struct {
// Members: Specifies the identities requesting access for a Cloud
// Platform resource. `members` can have the following formats: *
// 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
@ -343,7 +343,7 @@ func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
// 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"] }, {
// "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).
@ -353,7 +353,16 @@ type Policy struct {
// no members will result in an error.
Bindings []*Binding `json:"bindings,omitempty"`
// Etag: Can be used to perform a read-modify-write.
// Etag: `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.
Etag string `json:"etag,omitempty"`
// Version: Version of the `Policy`. The default version is 0.
@ -611,13 +620,14 @@ type Subscription struct {
// 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 delivery 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`. 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.
// 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.
AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
// Name: The name of the subscription. It must have the format
@ -662,7 +672,7 @@ func (s *Subscription) MarshalJSON() ([]byte, error) {
type TestIamPermissionsRequest struct {
// Permissions: The set of permissions to check for the `resource`.
// Permissions with wildcards (such as '*' or 'storage.*') are not
// allowed.
// allowed. For more information see IAM Overview.
Permissions []string `json:"permissions,omitempty"`
// ForceSendFields is a list of field names (e.g. "Permissions") to
@ -775,25 +785,23 @@ func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *Pro
}
func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:acknowledge")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"subscription": c.subscription,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.acknowledge" call.
@ -828,7 +836,8 @@ func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption)
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -873,12 +882,11 @@ type ProjectsSubscriptionsCreateCall struct {
ctx_ context.Context
}
// Create: Creates a subscription to a given topic for a given
// subscriber. 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.
// Create: 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.
func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall {
c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
@ -903,25 +911,23 @@ func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *Projects
}
func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("PUT", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.create" call.
@ -956,12 +962,13 @@ func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Sub
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a subscription to a given topic for a given subscriber. 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.",
// "httpMethod": "PUT",
// "id": "pubsub.projects.subscriptions.create",
// "parameterOrder": [
@ -1029,19 +1036,18 @@ func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *Projects
}
func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"subscription": c.subscription,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.delete" call.
@ -1076,7 +1082,8 @@ func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Emp
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1152,22 +1159,21 @@ func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSub
}
func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"subscription": c.subscription,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.get" call.
@ -1202,7 +1208,8 @@ func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscr
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1244,8 +1251,9 @@ type ProjectsSubscriptionsGetIamPolicyCall struct {
ctx_ context.Context
}
// GetIamPolicy: Gets the access control policy for a `resource`. Is
// empty if the policy or the resource does not exist.
// GetIamPolicy: Gets the access control policy for a `resource`.
// Returns an empty policy if the resource exists and does not have a
// policy set.
func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall {
c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.resource = resource
@ -1279,22 +1287,21 @@ func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *Pr
}
func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.getIamPolicy" call.
@ -1329,12 +1336,13 @@ func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption)
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the access control policy for a `resource`. Is empty if the policy or the resource does not exist.",
// "description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.",
// "httpMethod": "GET",
// "id": "pubsub.projects.subscriptions.getIamPolicy",
// "parameterOrder": [
@ -1342,7 +1350,7 @@ func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption)
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which 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 documentation for the respective GetIamPolicy rpc.",
// "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.",
// "location": "path",
// "pattern": "^projects/[^/]*/subscriptions/[^/]*$",
// "required": true,
@ -1421,22 +1429,21 @@ func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSu
}
func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/subscriptions")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.list" call.
@ -1471,7 +1478,8 @@ func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListS
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1573,25 +1581,23 @@ func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context
}
func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:modifyAckDeadline")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"subscription": c.subscription,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.modifyAckDeadline" call.
@ -1626,7 +1632,8 @@ func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOp
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1701,25 +1708,23 @@ func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context)
}
func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:modifyPushConfig")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"subscription": c.subscription,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.modifyPushConfig" call.
@ -1754,7 +1759,8 @@ func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOpt
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1827,25 +1833,23 @@ func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSu
}
func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:pull")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"subscription": c.subscription,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.pull" call.
@ -1880,7 +1884,8 @@ func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullR
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -1951,25 +1956,23 @@ func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *Pr
}
func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.setIamPolicy" call.
@ -2004,7 +2007,8 @@ func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption)
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2017,7 +2021,7 @@ func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption)
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which 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 documentation for the respective SetIamPolicy rpc.",
// "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.",
// "location": "path",
// "pattern": "^projects/[^/]*/subscriptions/[^/]*$",
// "required": true,
@ -2075,25 +2079,23 @@ func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Contex
}
func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.subscriptions.testIamPermissions" call.
@ -2128,7 +2130,8 @@ func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallO
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2141,7 +2144,7 @@ func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallO
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which 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 documentation for the respective TestIamPermissions rpc.",
// "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.",
// "location": "path",
// "pattern": "^projects/[^/]*/subscriptions/[^/]*$",
// "required": true,
@ -2198,25 +2201,23 @@ func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsC
}
func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("PUT", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.create" call.
@ -2251,7 +2252,8 @@ func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, err
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2324,19 +2326,18 @@ func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsD
}
func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"topic": c.topic,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.delete" call.
@ -2371,7 +2372,8 @@ func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, err
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2447,22 +2449,21 @@ func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetC
}
func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"topic": c.topic,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.get" call.
@ -2497,7 +2498,8 @@ func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error)
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2539,8 +2541,9 @@ type ProjectsTopicsGetIamPolicyCall struct {
ctx_ context.Context
}
// GetIamPolicy: Gets the access control policy for a `resource`. Is
// empty if the policy or the resource does not exist.
// GetIamPolicy: Gets the access control policy for a `resource`.
// Returns an empty policy if the resource exists and does not have a
// policy set.
func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall {
c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.resource = resource
@ -2574,22 +2577,21 @@ func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsT
}
func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.getIamPolicy" call.
@ -2624,12 +2626,13 @@ func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Poli
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the access control policy for a `resource`. Is empty if the policy or the resource does not exist.",
// "description": "Gets the access control policy for a `resource`. Returns an empty policy if the resource exists and does not have a policy set.",
// "httpMethod": "GET",
// "id": "pubsub.projects.topics.getIamPolicy",
// "parameterOrder": [
@ -2637,7 +2640,7 @@ func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Poli
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which 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 documentation for the respective GetIamPolicy rpc.",
// "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.",
// "location": "path",
// "pattern": "^projects/[^/]*/topics/[^/]*$",
// "required": true,
@ -2716,22 +2719,21 @@ func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsLis
}
func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/topics")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.list" call.
@ -2766,7 +2768,8 @@ func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsRe
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2868,25 +2871,23 @@ func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopics
}
func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}:publish")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"topic": c.topic,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.publish" call.
@ -2921,7 +2922,8 @@ func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishRe
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -2992,25 +2994,23 @@ func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsT
}
func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.setIamPolicy" call.
@ -3045,7 +3045,8 @@ func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Poli
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -3058,7 +3059,7 @@ func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Poli
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which 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 documentation for the respective SetIamPolicy rpc.",
// "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.",
// "location": "path",
// "pattern": "^projects/[^/]*/topics/[^/]*$",
// "required": true,
@ -3116,25 +3117,23 @@ func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *Pro
}
func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"resource": c.resource,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.testIamPermissions" call.
@ -3169,7 +3168,8 @@ func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption)
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil
@ -3182,7 +3182,7 @@ func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption)
// ],
// "parameters": {
// "resource": {
// "description": "REQUIRED: The resource for which 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 documentation for the respective TestIamPermissions rpc.",
// "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.",
// "location": "path",
// "pattern": "^projects/[^/]*/topics/[^/]*$",
// "required": true,
@ -3264,22 +3264,21 @@ func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *Proj
}
func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}/subscriptions")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"topic": c.topic,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "pubsub.projects.topics.subscriptions.list" call.
@ -3314,7 +3313,8 @@ func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
target := &ret
if err := json.NewDecoder(res.Body).Decode(target); err != nil {
return nil, err
}
return ret, nil

View File

@ -1,14 +1,14 @@
{
"kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/OLx7eYKI1NQCi-ys96oQ7ZJUHE8\"",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/Bw6HlPfCUqTIhF647hFuWCHD0c8\"",
"discoveryVersion": "v1",
"id": "sqladmin:v1beta4",
"name": "sqladmin",
"canonicalName": "SQL Admin",
"version": "v1beta4",
"revision": "20160222",
"revision": "20160712",
"title": "Cloud SQL Administration API",
"description": "API for Cloud SQL database instance management.",
"description": "Creates and configures Cloud SQL instances, which provide fully-managed MySQL databases.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {
@ -134,6 +134,10 @@
"type": "object",
"description": "A database instance backup run resource.",
"properties": {
"description": {
"type": "string",
"description": "The description of this run, only applicable to on-demand backups."
},
"endTime": {
"type": "string",
"description": "The time the backup operation completed in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.",
@ -175,6 +179,10 @@
"type": "string",
"description": "The status of this run."
},
"type": {
"type": "string",
"description": "The type of this run; can be either \"AUTOMATED\" or \"ON_DEMAND\"."
},
"windowStartTime": {
"type": "string",
"description": "The start time of the backup window during which this the backup was attempted in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.",
@ -332,7 +340,7 @@
},
"databaseVersion": {
"type": "string",
"description": "The database engine type and version. Can be MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_6. The databaseVersion can not be changed after instance creation."
"description": "The database engine type and version. The databaseVersion can not be changed after instance creation. Can be MYSQL_5_5, MYSQL_5_6 or MYSQL_5_7. Defaults to MYSQL_5_6. MYSQL_5_7 is applicable only to Second Generation instances."
},
"etag": {
"type": "string",
@ -348,7 +356,7 @@
},
"name": {
"type": "string",
"description": "The name of the failover replica."
"description": "The name of the failover replica. If specified at instance creation, a failover replica is created for the instance. The name doesn't include the project ID. This property is applicable only to Second Generation instances."
}
}
},
@ -552,7 +560,7 @@
},
"appliesTo": {
"type": "array",
"description": "The database version this flag applies to. Can be MYSQL_5_5, MYSQL_5_6, or both.",
"description": "The database version this flag applies to. Can be MYSQL_5_5, MYSQL_5_6, or MYSQL_5_7. MYSQL_5_7 is applicable only to Second Generation instances.",
"items": {
"type": "string"
}
@ -1063,7 +1071,7 @@
"properties": {
"activationPolicy": {
"type": "string",
"description": "The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.\nALWAYS: The instance should always be active.\nNEVER: The instance should never be activated.\nON_DEMAND: The instance is activated upon receiving requests; only applicable to First Generation instances."
"description": "The activation policy specifies when the instance is activated; it is applicable only when the instance state is RUNNABLE. The activation policy cannot be updated together with other settings for Second Generation instances. Valid values:\nALWAYS: The instance is on; it is not deactivated by inactivity.\nNEVER: The instance is off; it is not activated, even if a connection request arrives.\nON_DEMAND: The instance responds to incoming requests, and turns itself off when not in use. Instances with PER_USE pricing turn off after 15 minutes of inactivity. Instances with PER_PACKAGE pricing turn off after 12 hours of inactivity."
},
"authorizedGaeApplications": {
"type": "array",
@ -1082,12 +1090,12 @@
},
"dataDiskSizeGb": {
"type": "string",
"description": "The size of data disk, in GB. The data disk size minimum is 10GB. This property is only applicable to Second Generation instances.",
"description": "The size of data disk, in GB. The data disk size minimum is 10GB. Applies only to Second Generation instances.",
"format": "int64"
},
"dataDiskType": {
"type": "string",
"description": "The type of data disk. Only supported for Second Generation instances. The default type is PD_SSD. This property is only applicable to Second Generation instances."
"description": "The type of data disk. Only supported for Second Generation instances. The default type is PD_SSD. Applies only to Second Generation instances."
},
"databaseFlags": {
"type": "array",
@ -1115,7 +1123,7 @@
},
"maintenanceWindow": {
"$ref": "MaintenanceWindow",
"description": "The maintenance window for this instance. This specifies when the instance may be restarted for maintenance purposes. This property is only applicable to Second Generation instances."
"description": "The maintenance window for this instance. This specifies when the instance may be restarted for maintenance purposes. Applies only to Second Generation instances."
},
"pricingPlan": {
"type": "string",
@ -1135,6 +1143,10 @@
]
}
},
"storageAutoResize": {
"type": "boolean",
"description": "Configuration to increase storage size automatically. The default value is false. Applies only to Second Generation instances."
},
"tier": {
"type": "string",
"description": "The tier of service for this instance, for example D1, D2. For more information, see pricing.",
@ -1237,13 +1249,17 @@
"properties": {
"clientCert": {
"$ref": "SslCertDetail",
"description": "The new client certificate and private key. The new certificate will not work until the instance is restarted."
"description": "The new client certificate and private key. The new certificate will not work until the instance is restarted for First Generation instances."
},
"kind": {
"type": "string",
"description": "This is always sql#sslCertsInsert.",
"default": "sql#sslCertsInsert"
},
"operation": {
"$ref": "Operation",
"description": "The operation to track the ssl certs insert request."
},
"serverCaCert": {
"$ref": "SslCert",
"description": "The server Certificate Authority's certificate. If this is missing you can force a new one to be generated by calling resetSslConfig method on instances resource."
@ -1462,6 +1478,36 @@
"https://www.googleapis.com/auth/sqlservice.admin"
]
},
"insert": {
"id": "sql.backupRuns.insert",
"path": "projects/{project}/instances/{instance}/backupRuns",
"httpMethod": "POST",
"description": "Creates a new backup run on demand.",
"parameters": {
"instance": {
"type": "string",
"description": "Cloud SQL instance ID. This does not include the project ID.",
"required": true,
"location": "path"
},
"project": {
"type": "string",
"description": "Project ID of the project that contains the instance.",
"required": true,
"location": "path"
}
},
"parameterOrder": [
"project",
"instance"
],
"request": {
"$ref": "BackupRun"
},
"response": {
"$ref": "Operation"
}
},
"list": {
"id": "sql.backupRuns.list",
"path": "projects/{project}/instances/{instance}/backupRuns",

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
{
"kind": "discovery#restDescription",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/cPnwg2U9hg8m8Y6wHWcvqIF8qSM\"",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/WoNfwvHOxLFHVTodCpDiAsVbMpQ\"",
"discoveryVersion": "v1",
"id": "storage:v1",
"name": "storage",
"version": "v1",
"revision": "20160609",
"revision": "20160714",
"title": "Cloud Storage JSON API",
"description": "Stores and retrieves potentially large, immutable data objects.",
"ownerDomain": "google.com",
@ -361,13 +361,13 @@
},
"team": {
"type": "string",
"description": "The team. Can be owners, editors, or viewers."
"description": "The team."
}
}
},
"role": {
"type": "string",
"description": "The access permission for the entity. Can be READER, WRITER, or OWNER.",
"description": "The access permission for the entity.",
"annotations": {
"required": [
"storage.bucketAccessControls.insert"
@ -553,7 +553,7 @@
},
"cacheControl": {
"type": "string",
"description": "Cache-Control directive for the object data."
"description": "Cache-Control directive for the object data. If omitted, and the object is accessible to all anonymous users, the default will be public, max-age=3600."
},
"componentCount": {
"type": "integer",
@ -738,13 +738,13 @@
},
"team": {
"type": "string",
"description": "The team. Can be owners, editors, or viewers."
"description": "The team."
}
}
},
"role": {
"type": "string",
"description": "The access permission for the entity. Can be READER or OWNER."
"description": "The access permission for the entity."
},
"selfLink": {
"type": "string",

View File

@ -531,8 +531,7 @@ type BucketAccessControl struct {
// ProjectTeam: The project team associated with the entity, if any.
ProjectTeam *BucketAccessControlProjectTeam `json:"projectTeam,omitempty"`
// Role: The access permission for the entity. Can be READER, WRITER, or
// OWNER.
// Role: The access permission for the entity.
Role string `json:"role,omitempty"`
// SelfLink: The link to this access-control entry.
@ -563,7 +562,7 @@ type BucketAccessControlProjectTeam struct {
// ProjectNumber: The project number.
ProjectNumber string `json:"projectNumber,omitempty"`
// Team: The team. Can be owners, editors, or viewers.
// Team: The team.
Team string `json:"team,omitempty"`
// ForceSendFields is a list of field names (e.g. "ProjectNumber") to
@ -786,7 +785,9 @@ type Object struct {
// Bucket: The name of the bucket containing this object.
Bucket string `json:"bucket,omitempty"`
// CacheControl: Cache-Control directive for the object data.
// CacheControl: Cache-Control directive for the object data. If
// omitted, and the object is accessible to all anonymous users, the
// default will be public, max-age=3600.
CacheControl string `json:"cacheControl,omitempty"`
// ComponentCount: Number of underlying components that make up this
@ -994,7 +995,7 @@ type ObjectAccessControl struct {
// ProjectTeam: The project team associated with the entity, if any.
ProjectTeam *ObjectAccessControlProjectTeam `json:"projectTeam,omitempty"`
// Role: The access permission for the entity. Can be READER or OWNER.
// Role: The access permission for the entity.
Role string `json:"role,omitempty"`
// SelfLink: The link to this access-control entry.
@ -1025,7 +1026,7 @@ type ObjectAccessControlProjectTeam struct {
// ProjectNumber: The project number.
ProjectNumber string `json:"projectNumber,omitempty"`
// Team: The team. Can be owners, editors, or viewers.
// Team: The team.
Team string `json:"team,omitempty"`
// ForceSendFields is a list of field names (e.g. "ProjectNumber") to
@ -5989,6 +5990,9 @@ func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
// supplied.
// At most one of Media and ResumableMedia may be set.
func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
if ct := c.object.ContentType; ct != "" {
options = append([]googleapi.MediaOption{googleapi.ContentType(ct)}, options...)
}
opts := googleapi.ProcessMediaOptions(options)
chunkSize := opts.ChunkSize
if !opts.ForceEmptyContentType {

40
vendor/vendor.json vendored
View File

@ -1748,46 +1748,58 @@
"revision": "5eaf0df67e70d6997a9fe0ed24383fa1b01638d3"
},
{
"checksumSHA1": "SjcL6w27LsP7xLQe9V068FO3qWI=",
"checksumSHA1": "K2ewXgyH/uLdvOdg2ad02Z6Jym0=",
"path": "google.golang.org/api/compute/v1",
"revision": "fa0566afd4c8fdae644725fdf9b57b5851a20742",
"revisionTime": "2016-07-18T05:58:24Z"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "vnUDudEduSBUqwC+jVs6xt1Sm0w=",
"path": "google.golang.org/api/container/v1",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "ij1heqr+F07H75D4og/yUqRFf3I=",
"path": "google.golang.org/api/dns/v1",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "SLzHstPylt3EcBt9yEBJV+JqGp4=",
"path": "google.golang.org/api/gensupport",
"revision": "fa0566afd4c8fdae644725fdf9b57b5851a20742",
"revisionTime": "2016-07-18T05:58:24Z"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "yQREK/OWrz9PLljbr127+xFk6J0=",
"path": "google.golang.org/api/googleapi",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "ii4ET3JHk3vkMUEcg+9t/1RZSUU=",
"path": "google.golang.org/api/googleapi/internal/uritemplates",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "M7er6A8YuCmllh/cj/fZhHDEb3I=",
"path": "google.golang.org/api/pubsub/v1",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "dpHo8BrIZVf88kAsFoWYuSpG8i4=",
"path": "google.golang.org/api/sqladmin/v1beta4",
"revision": "43c645d4bcf9251ced36c823a93b6d198764aae4"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"checksumSHA1": "xIEDa8ZDicVplvLtQUHc9eVZays=",
"checksumSHA1": "qi0hBhwhMRAYlSYFHeHCde+jzAQ=",
"path": "google.golang.org/api/storage/v1",
"revision": "fa0566afd4c8fdae644725fdf9b57b5851a20742",
"revisionTime": "2016-07-18T05:58:24Z"
"revision": "3f131f305a2ae45080e71fdb780128cc92e8745e",
"revisionTime": "2016-08-05T04:28:55Z"
},
{
"path": "google.golang.org/appengine",

View File

@ -0,0 +1,77 @@
---
layout: "google"
page_title: "Google: google_compute_image"
sidebar_current: "docs-google-compute-image"
description: |-
Creates a bootable VM image for Google Compute Engine from an existing tarball.
---
# google\_compute\_image
Creates a bootable VM image resource for Google Compute Engine from an existing
tarball. For more information see [the official documentation](https://cloud.google.com/compute/docs/images) and
[API](https://cloud.google.com/compute/docs/reference/latest/images).
## Example Usage
```js
resource "google_compute_image" "bootable-image" {
name = "my-custom-image"
raw_disk {
source = "https://storage.googleapis.com/my-bucket/my-disk-image-tarball.tar.gz"
}
}
resource "google_compute_instance" "vm" {
name = "vm-from-custom-image"
machine_type = "n1-standard-1"
zone = "us-east1-c"
disk {
image = "${google_compute_image.bootable-image.self_link}"
}
network_interface {
network = "default"
}
}
```
## 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.
* `raw_disk` - (Required) The raw disk that will be used as the source of
the image. Changing this forces a new resource to be created.
Structure is documented below.
The `raw_disk` block supports:
* `source` - (Required) The full Google Cloud Storage URL where the disk
image is stored.
* `sha1` - (Optional) SHA1 checksum of the source tarball that will be used
to verify the source before creating the image.
* `container_type` - (Optional) The format used to encode and transmit the
block device. TAR is the only supported type and is the default.
- - -
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
* `description` - (Optional) The description of the image to be created
* `family` - (Optional) The name of the image family to which this image belongs.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `self_link` - The URI of the created resource.