Update google.golang.org/api/...

This release contains the Subnetwork stuff
This commit is contained in:
Edward Muller 2016-02-22 10:56:32 -08:00
parent 9f376e13ef
commit c7376e5b39
11 changed files with 3477 additions and 317 deletions

18
Godeps/Godeps.json generated
View File

@ -1171,39 +1171,39 @@
}, },
{ {
"ImportPath": "google.golang.org/api/compute/v1", "ImportPath": "google.golang.org/api/compute/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/container/v1", "ImportPath": "google.golang.org/api/container/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/dns/v1", "ImportPath": "google.golang.org/api/dns/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/gensupport", "ImportPath": "google.golang.org/api/gensupport",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/googleapi", "ImportPath": "google.golang.org/api/googleapi",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/googleapi/internal/uritemplates", "ImportPath": "google.golang.org/api/googleapi/internal/uritemplates",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/pubsub/v1", "ImportPath": "google.golang.org/api/pubsub/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/sqladmin/v1beta4", "ImportPath": "google.golang.org/api/sqladmin/v1beta4",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/api/storage/v1", "ImportPath": "google.golang.org/api/storage/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b" "Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
}, },
{ {
"ImportPath": "google.golang.org/appengine", "ImportPath": "google.golang.org/appengine",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -949,6 +949,27 @@ func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangesListResponse
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ChangesListCall) Pages(ctx context.Context, f func(*ChangesListResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "dns.managedZones.create": // method id "dns.managedZones.create":
type ManagedZonesCreateCall struct { type ManagedZonesCreateCall struct {
@ -1469,6 +1490,27 @@ func (c *ManagedZonesListCall) Do(opts ...googleapi.CallOption) (*ManagedZonesLi
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ManagedZonesListCall) Pages(ctx context.Context, f func(*ManagedZonesListResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "dns.projects.get": // method id "dns.projects.get":
type ProjectsGetCall struct { type ProjectsGetCall struct {
@ -1785,3 +1827,24 @@ func (c *ResourceRecordSetsListCall) Do(opts ...googleapi.CallOption) (*Resource
// } // }
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ResourceRecordSetsListCall) Pages(ctx context.Context, f func(*ResourceRecordSetsListResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}

34
vendor/google.golang.org/api/gensupport/backoff.go generated vendored Normal file
View File

@ -0,0 +1,34 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gensupport
import "time"
type BackoffStrategy interface {
// Pause returns the duration of the next pause before a retry should be attempted.
Pause() time.Duration
// Reset restores the strategy to its initial state.
Reset()
}
type ExponentialBackoff struct {
BasePause time.Duration
nextPause time.Duration
}
func (eb *ExponentialBackoff) Pause() time.Duration {
if eb.nextPause == 0 {
eb.Reset()
}
d := eb.nextPause
eb.nextPause *= 2
return d
}
func (eb *ExponentialBackoff) Reset() {
eb.nextPause = eb.BasePause
}

View File

@ -14,6 +14,15 @@ import (
// that safely builds up URL parameters for encoding. // that safely builds up URL parameters for encoding.
type URLParams map[string][]string type URLParams map[string][]string
// Get returns the first value for the given key, or "".
func (u URLParams) Get(key string) string {
vs := u[key]
if len(vs) == 0 {
return ""
}
return vs[0]
}
// Set sets the key to value. // Set sets the key to value.
// It replaces any existing values. // It replaces any existing values.
func (u URLParams) Set(key, value string) { func (u URLParams) Set(key, value string) {

View File

@ -20,9 +20,10 @@ const (
statusResumeIncomplete = 308 statusResumeIncomplete = 308
) )
// uploadPause determines the delay between failed upload attempts // DefaultBackoffStrategy returns a default strategy to use for retrying failed upload requests.
// TODO(mcgreevy): improve this retry mechanism. func DefaultBackoffStrategy() BackoffStrategy {
var uploadPause = 1 * time.Second return &ExponentialBackoff{BasePause: time.Second}
}
// ResumableUpload is used by the generated APIs to provide resumable uploads. // ResumableUpload is used by the generated APIs to provide resumable uploads.
// It is not used by developers directly. // It is not used by developers directly.
@ -41,6 +42,9 @@ type ResumableUpload struct {
// Callback is an optional function that will be periodically called with the cumulative number of bytes uploaded. // Callback is an optional function that will be periodically called with the cumulative number of bytes uploaded.
Callback func(int64) Callback func(int64)
// If not specified, a default exponential backoff strategy will be used.
Backoff BackoffStrategy
} }
// Progress returns the number of bytes uploaded at this point. // Progress returns the number of bytes uploaded at this point.
@ -50,68 +54,105 @@ func (rx *ResumableUpload) Progress() int64 {
return rx.progress return rx.progress
} }
func (rx *ResumableUpload) transferChunks(ctx context.Context) (*http.Response, error) { // doUploadRequest performs a single HTTP request to upload data.
var res *http.Response // off specifies the offset in rx.Media from which data is drawn.
var err error // size is the number of bytes in data.
// final specifies whether data is the final chunk to be uploaded.
for { func (rx *ResumableUpload) doUploadRequest(ctx context.Context, data io.Reader, off, size int64, final bool) (*http.Response, error) {
select { // Check for cancellation req, err := http.NewRequest("POST", rx.URI, data)
case <-ctx.Done(): if err != nil {
return nil, ctx.Err() return nil, err
default: }
}
req.ContentLength = size
chunk, off, size, e := rx.Media.Chunk() var contentRange string
reqSize := int64(size) if final {
done := e == io.EOF if size == 0 {
contentRange = fmt.Sprintf("bytes */%v", off)
if !done && e != nil { } else {
return nil, e contentRange = fmt.Sprintf("bytes %v-%v/%v", off, off+size-1, off+size)
} }
} else {
req, _ := http.NewRequest("POST", rx.URI, chunk) contentRange = fmt.Sprintf("bytes %v-%v/*", off, off+size-1)
req.ContentLength = reqSize }
var contentRange string req.Header.Set("Content-Range", contentRange)
if done { req.Header.Set("Content-Type", rx.MediaType)
if reqSize == 0 { req.Header.Set("User-Agent", rx.UserAgent)
contentRange = fmt.Sprintf("bytes */%v", off) return ctxhttp.Do(ctx, rx.Client, req)
} else {
contentRange = fmt.Sprintf("bytes %v-%v/%v", off, off+reqSize-1, off+reqSize) }
}
} else { // reportProgress calls a user-supplied callback to report upload progress.
contentRange = fmt.Sprintf("bytes %v-%v/*", off, off+reqSize-1) // If old==updated, the callback is not called.
} func (rx *ResumableUpload) reportProgress(old, updated int64) {
req.Header.Set("Content-Range", contentRange) if updated-old == 0 {
req.Header.Set("Content-Type", rx.MediaType) return
req.Header.Set("User-Agent", rx.UserAgent) }
res, err = ctxhttp.Do(ctx, rx.Client, req) rx.mu.Lock()
rx.progress = updated
success := err == nil && res.StatusCode == statusResumeIncomplete || res.StatusCode == http.StatusOK rx.mu.Unlock()
if success && reqSize > 0 { if rx.Callback != nil {
rx.mu.Lock() rx.Callback(updated)
rx.progress = off + reqSize // number of bytes sent so far }
rx.mu.Unlock() }
if rx.Callback != nil {
rx.Callback(off + reqSize) // transferChunk performs a single HTTP request to upload a single chunk from rx.Media.
} func (rx *ResumableUpload) transferChunk(ctx context.Context) (*http.Response, error) {
} chunk, off, size, err := rx.Media.Chunk()
if err != nil || res.StatusCode != statusResumeIncomplete {
break done := err == io.EOF
} if !done && err != nil {
rx.Media.Next() return nil, err
res.Body.Close() }
res, err := rx.doUploadRequest(ctx, chunk, off, int64(size), done)
if err != nil {
return res, err
}
if res.StatusCode == statusResumeIncomplete || res.StatusCode == http.StatusOK {
rx.reportProgress(off, off+int64(size))
}
if res.StatusCode == statusResumeIncomplete {
rx.Media.Next()
}
return res, nil
}
func contextDone(ctx context.Context) bool {
select {
case <-ctx.Done():
return true
default:
return false
} }
return res, err
} }
// Upload starts the process of a resumable upload with a cancellable context. // Upload starts the process of a resumable upload with a cancellable context.
// It retries indefinitely (with a pause of uploadPause between attempts) until cancelled. // It retries indefinitely (using exponential backoff) until cancelled.
// It is called from the auto-generated API code and is not visible to the user. // It is called from the auto-generated API code and is not visible to the user.
// rx is private to the auto-generated API code. // rx is private to the auto-generated API code.
// Exactly one of resp or err will be nil. If resp is non-nil, the caller must call resp.Body.Close. // Exactly one of resp or err will be nil. If resp is non-nil, the caller must call resp.Body.Close.
func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err error) { func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err error) {
var pause time.Duration
backoff := rx.Backoff
if backoff == nil {
backoff = DefaultBackoffStrategy()
}
for { for {
resp, err = rx.transferChunks(ctx) // Ensure that we return in the case of cancelled context, even if pause is 0.
if contextDone(ctx) {
return nil, ctx.Err()
}
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(pause):
}
resp, err = rx.transferChunk(ctx)
// It's possible for err and resp to both be non-nil here, but we expose a simpler // It's possible for err and resp to both be non-nil here, but we expose a simpler
// contract to our callers: exactly one of resp and err will be non-nil. This means // contract to our callers: exactly one of resp and err will be non-nil. This means
// that any response body must be closed here before returning a non-nil error. // that any response body must be closed here before returning a non-nil error.
@ -125,10 +166,12 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
return resp, nil return resp, nil
} }
resp.Body.Close() resp.Body.Close()
select { // Check for cancellation
case <-ctx.Done(): if resp.StatusCode == statusResumeIncomplete {
return nil, ctx.Err() pause = 0
case <-time.After(uploadPause): backoff.Reset()
} else {
pause = backoff.Pause()
} }
} }
} }

View File

@ -1514,6 +1514,27 @@ func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListS
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "pubsub.projects.subscriptions.modifyAckDeadline": // method id "pubsub.projects.subscriptions.modifyAckDeadline":
type ProjectsSubscriptionsModifyAckDeadlineCall struct { type ProjectsSubscriptionsModifyAckDeadlineCall struct {
@ -2788,6 +2809,27 @@ func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsRe
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "pubsub.projects.topics.publish": // method id "pubsub.projects.topics.publish":
type ProjectsTopicsPublishCall struct { type ProjectsTopicsPublishCall struct {
@ -3314,3 +3356,24 @@ func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (
// } // }
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}

View File

@ -2282,6 +2282,27 @@ func (c *BackupRunsListCall) Do(opts ...googleapi.CallOption) (*BackupRunsListRe
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *BackupRunsListCall) Pages(ctx context.Context, f func(*BackupRunsListResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "sql.databases.delete": // method id "sql.databases.delete":
type DatabasesDeleteCall struct { type DatabasesDeleteCall struct {
@ -4285,6 +4306,27 @@ func (c *InstancesListCall) Do(opts ...googleapi.CallOption) (*InstancesListResp
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *InstancesListCall) Pages(ctx context.Context, f func(*InstancesListResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "sql.instances.patch": // method id "sql.instances.patch":
type InstancesPatchCall struct { type InstancesPatchCall struct {
@ -5594,6 +5636,27 @@ func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*OperationsListRe
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *OperationsListCall) Pages(ctx context.Context, f func(*OperationsListResponse) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "sql.sslCerts.createEphemeral": // method id "sql.sslCerts.createEphemeral":
type SslCertsCreateEphemeralCall struct { type SslCertsCreateEphemeralCall struct {

View File

@ -1,11 +1,11 @@
{ {
"kind": "discovery#restDescription", "kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/iW6lW-fzl_pGlxeRN7h4J2G0OTQ\"", "etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/obxe7w0FjJgGPQFNs6hMClVbJfI\"",
"discoveryVersion": "v1", "discoveryVersion": "v1",
"id": "storage:v1", "id": "storage:v1",
"name": "storage", "name": "storage",
"version": "v1", "version": "v1",
"revision": "20151229", "revision": "20160121",
"title": "Cloud Storage JSON API", "title": "Cloud Storage JSON API",
"description": "Lets you store and retrieve potentially-large, immutable data objects.", "description": "Lets you store and retrieve potentially-large, immutable data objects.",
"ownerDomain": "google.com", "ownerDomain": "google.com",
@ -574,13 +574,7 @@
}, },
"contentType": { "contentType": {
"type": "string", "type": "string",
"description": "Content-Type of the object data.", "description": "Content-Type of the object data."
"annotations": {
"required": [
"storage.objects.insert",
"storage.objects.update"
]
}
}, },
"crc32c": { "crc32c": {
"type": "string", "type": "string",

View File

@ -2596,6 +2596,27 @@ func (c *BucketsListCall) Do(opts ...googleapi.CallOption) (*Buckets, error) {
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *BucketsListCall) Pages(ctx context.Context, f func(*Buckets) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "storage.buckets.patch": // method id "storage.buckets.patch":
type BucketsPatchCall struct { type BucketsPatchCall struct {
@ -6464,6 +6485,27 @@ func (c *ObjectsListCall) Do(opts ...googleapi.CallOption) (*Objects, error) {
} }
// Pages invokes f for each page of results.
// A non-nil error returned from f will halt the iteration.
// The provided context supersedes any context provided to the Context method.
func (c *ObjectsListCall) Pages(ctx context.Context, f func(*Objects) error) error {
c.ctx_ = ctx
defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
for {
x, err := c.Do()
if err != nil {
return err
}
if err := f(x); err != nil {
return err
}
if x.NextPageToken == "" {
return nil
}
c.PageToken(x.NextPageToken)
}
}
// method id "storage.objects.patch": // method id "storage.objects.patch":
type ObjectsPatchCall struct { type ObjectsPatchCall struct {