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",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/container/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/dns/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/gensupport",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/googleapi",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/googleapi/internal/uritemplates",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/pubsub/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/sqladmin/v1beta4",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"ImportPath": "google.golang.org/api/storage/v1",
"Rev": "f6ba98773d96b877b246f3a9266493dfc11e276b"
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3"
},
{
"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":
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":
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.
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.
// It replaces any existing values.
func (u URLParams) Set(key, value string) {

View File

@ -20,9 +20,10 @@ const (
statusResumeIncomplete = 308
)
// uploadPause determines the delay between failed upload attempts
// TODO(mcgreevy): improve this retry mechanism.
var uploadPause = 1 * time.Second
// DefaultBackoffStrategy returns a default strategy to use for retrying failed upload requests.
func DefaultBackoffStrategy() BackoffStrategy {
return &ExponentialBackoff{BasePause: time.Second}
}
// ResumableUpload is used by the generated APIs to provide resumable uploads.
// 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 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.
@ -50,68 +54,105 @@ func (rx *ResumableUpload) Progress() int64 {
return rx.progress
}
func (rx *ResumableUpload) transferChunks(ctx context.Context) (*http.Response, error) {
var res *http.Response
var err error
for {
select { // Check for cancellation
case <-ctx.Done():
return nil, ctx.Err()
default:
}
chunk, off, size, e := rx.Media.Chunk()
reqSize := int64(size)
done := e == io.EOF
if !done && e != nil {
return nil, e
}
req, _ := http.NewRequest("POST", rx.URI, chunk)
req.ContentLength = reqSize
var contentRange string
if done {
if reqSize == 0 {
contentRange = fmt.Sprintf("bytes */%v", off)
} else {
contentRange = fmt.Sprintf("bytes %v-%v/%v", off, off+reqSize-1, off+reqSize)
}
} else {
contentRange = fmt.Sprintf("bytes %v-%v/*", off, off+reqSize-1)
}
req.Header.Set("Content-Range", contentRange)
req.Header.Set("Content-Type", rx.MediaType)
req.Header.Set("User-Agent", rx.UserAgent)
res, err = ctxhttp.Do(ctx, rx.Client, req)
success := err == nil && res.StatusCode == statusResumeIncomplete || res.StatusCode == http.StatusOK
if success && reqSize > 0 {
rx.mu.Lock()
rx.progress = off + reqSize // number of bytes sent so far
rx.mu.Unlock()
if rx.Callback != nil {
rx.Callback(off + reqSize)
}
}
if err != nil || res.StatusCode != statusResumeIncomplete {
break
}
rx.Media.Next()
res.Body.Close()
// doUploadRequest performs a single HTTP request to upload data.
// off specifies the offset in rx.Media from which data is drawn.
// size is the number of bytes in data.
// final specifies whether data is the final chunk to be uploaded.
func (rx *ResumableUpload) doUploadRequest(ctx context.Context, data io.Reader, off, size int64, final bool) (*http.Response, error) {
req, err := http.NewRequest("POST", rx.URI, data)
if err != nil {
return nil, err
}
req.ContentLength = size
var contentRange string
if final {
if size == 0 {
contentRange = fmt.Sprintf("bytes */%v", off)
} else {
contentRange = fmt.Sprintf("bytes %v-%v/%v", off, off+size-1, off+size)
}
} else {
contentRange = fmt.Sprintf("bytes %v-%v/*", off, off+size-1)
}
req.Header.Set("Content-Range", contentRange)
req.Header.Set("Content-Type", rx.MediaType)
req.Header.Set("User-Agent", rx.UserAgent)
return ctxhttp.Do(ctx, rx.Client, req)
}
// reportProgress calls a user-supplied callback to report upload progress.
// If old==updated, the callback is not called.
func (rx *ResumableUpload) reportProgress(old, updated int64) {
if updated-old == 0 {
return
}
rx.mu.Lock()
rx.progress = updated
rx.mu.Unlock()
if rx.Callback != nil {
rx.Callback(updated)
}
}
// 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()
done := err == io.EOF
if !done && err != nil {
return nil, err
}
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.
// 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.
// rx is private to the auto-generated API code.
// Exactly one of resp or err will be nil. If resp is non-nil, the caller must call resp.Body.Close.
func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err error) {
var pause time.Duration
backoff := rx.Backoff
if backoff == nil {
backoff = DefaultBackoffStrategy()
}
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
// 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.
@ -125,10 +166,12 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
return resp, nil
}
resp.Body.Close()
select { // Check for cancellation
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(uploadPause):
if resp.StatusCode == statusResumeIncomplete {
pause = 0
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":
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":
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":
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":
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":
type SslCertsCreateEphemeralCall struct {

View File

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