1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Update many modules (#620)

* Update many modules.

go get -u golang.org/x/net
go get -u github.com/aws/aws-sdk-go
go get -u golang.org/x/oauth2
go get -u google.golang.org/api
go get -u gopkg.in/yaml.v2
go mod tidy

* Update modules

go get -u github.com/tiramiseb/go-gandi
go get -u github.com/miekg/dns
go mod tidy
This commit is contained in:
Tom Limoncelli
2020-02-12 21:16:35 -05:00
committed by GitHub
parent 66a290067a
commit f708f19535
524 changed files with 80233 additions and 54896 deletions

View File

@ -8,3 +8,4 @@
# Please keep the list sorted.
Google Inc.
LightStep Inc.

View File

@ -45,6 +45,7 @@ Jason Hall <jasonhall@google.com>
Johan Euphrosine <proppy@google.com>
Kostik Shtoyk <kostik@google.com>
Kunpei Sakai <namusyaka@gmail.com>
Matthew Dolan <dolan@lightstep.com>
Matthew Whisenhunt <matt.whisenhunt@gmail.com>
Michael McGreevy <mcgreevy@golang.org>
Nick Craig-Wood <nickcw@gmail.com>

View File

@ -18,12 +18,12 @@
}
},
"basePath": "/dns/v1/projects/",
"baseUrl": "https://www.googleapis.com/dns/v1/projects/",
"baseUrl": "https://dns.googleapis.com/dns/v1/projects/",
"batchPath": "batch/dns/v1",
"description": "Configures and serves authoritative DNS records.",
"discoveryVersion": "v1",
"documentationLink": "https://developers.google.com/cloud-dns",
"etag": "\"VPK3KBfpaEgZ16pozGOoMYfKc0U/lpqiZRIZVeruudGbozkBqz2t94g\"",
"etag": "\"LYADMvHWYH2ul9D6m9UT9gT77YM/C0vgwgSkNuwxiJI-C0iMb3JKMEQ\"",
"icons": {
"x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
"x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"
@ -666,6 +666,228 @@
}
}
},
"policies": {
"methods": {
"create": {
"description": "Create a new Policy",
"httpMethod": "POST",
"id": "dns.policies.create",
"parameterOrder": [
"project"
],
"parameters": {
"clientOperationId": {
"description": "For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.",
"location": "query",
"type": "string"
},
"project": {
"description": "Identifies the project addressed by this request.",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "{project}/policies",
"request": {
"$ref": "Policy"
},
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
]
},
"delete": {
"description": "Delete a previously created Policy. Will fail if the policy is still being referenced by a network.",
"httpMethod": "DELETE",
"id": "dns.policies.delete",
"parameterOrder": [
"project",
"policy"
],
"parameters": {
"clientOperationId": {
"description": "For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.",
"location": "query",
"type": "string"
},
"policy": {
"description": "User given friendly name of the policy addressed by this request.",
"location": "path",
"required": true,
"type": "string"
},
"project": {
"description": "Identifies the project addressed by this request.",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "{project}/policies/{policy}",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
]
},
"get": {
"description": "Fetch the representation of an existing Policy.",
"httpMethod": "GET",
"id": "dns.policies.get",
"parameterOrder": [
"project",
"policy"
],
"parameters": {
"clientOperationId": {
"description": "For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.",
"location": "query",
"type": "string"
},
"policy": {
"description": "User given friendly name of the policy addressed by this request.",
"location": "path",
"required": true,
"type": "string"
},
"project": {
"description": "Identifies the project addressed by this request.",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "{project}/policies/{policy}",
"response": {
"$ref": "Policy"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/ndev.clouddns.readonly",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
]
},
"list": {
"description": "Enumerate all Policies associated with a project.",
"httpMethod": "GET",
"id": "dns.policies.list",
"parameterOrder": [
"project"
],
"parameters": {
"maxResults": {
"description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.",
"format": "int32",
"location": "query",
"type": "integer"
},
"pageToken": {
"description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.",
"location": "query",
"type": "string"
},
"project": {
"description": "Identifies the project addressed by this request.",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "{project}/policies",
"response": {
"$ref": "PoliciesListResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/ndev.clouddns.readonly",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
]
},
"patch": {
"description": "Apply a partial update to an existing Policy.",
"httpMethod": "PATCH",
"id": "dns.policies.patch",
"parameterOrder": [
"project",
"policy"
],
"parameters": {
"clientOperationId": {
"description": "For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.",
"location": "query",
"type": "string"
},
"policy": {
"description": "User given friendly name of the policy addressed by this request.",
"location": "path",
"required": true,
"type": "string"
},
"project": {
"description": "Identifies the project addressed by this request.",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "{project}/policies/{policy}",
"request": {
"$ref": "Policy"
},
"response": {
"$ref": "PoliciesPatchResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
]
},
"update": {
"description": "Update an existing Policy.",
"httpMethod": "PUT",
"id": "dns.policies.update",
"parameterOrder": [
"project",
"policy"
],
"parameters": {
"clientOperationId": {
"description": "For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.",
"location": "query",
"type": "string"
},
"policy": {
"description": "User given friendly name of the policy addressed by this request.",
"location": "path",
"required": true,
"type": "string"
},
"project": {
"description": "Identifies the project addressed by this request.",
"location": "path",
"required": true,
"type": "string"
}
},
"path": "{project}/policies/{policy}",
"request": {
"$ref": "Policy"
},
"response": {
"$ref": "PoliciesUpdateResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
]
}
}
},
"projects": {
"methods": {
"get": {
@ -760,8 +982,8 @@
}
}
},
"revision": "20190418",
"rootUrl": "https://www.googleapis.com/",
"revision": "20191205",
"rootUrl": "https://dns.googleapis.com/",
"schemas": {
"Change": {
"description": "A Change represents a set of ResourceRecordSet additions and deletions applied atomically to a ManagedZone. ResourceRecordSets within a ManagedZone are modified by creating a new Change element in the Changes collection. In turn the Changes collection also records the past modifications to the ResourceRecordSets in a ManagedZone. The current state of the ManagedZone is the sum effect of applying all Change elements in the Changes collection in sequence.",
@ -1035,6 +1257,10 @@
"$ref": "ManagedZoneDnsSecConfig",
"description": "DNSSEC configuration."
},
"forwardingConfig": {
"$ref": "ManagedZoneForwardingConfig",
"description": "The presence for this field indicates that outbound forwarding is enabled for this zone. The value of this field contains the set of destinations to forward to."
},
"id": {
"description": "Unique identifier for the resource; defined by the server (output only)",
"format": "uint64",
@ -1067,6 +1293,10 @@
},
"type": "array"
},
"peeringConfig": {
"$ref": "ManagedZonePeeringConfig",
"description": "The presence of this field indicates that DNS Peering is enabled for this zone. The value of this field contains the network to peer with."
},
"privateVisibilityConfig": {
"$ref": "ManagedZonePrivateVisibilityConfig",
"description": "For privately visible zones, the set of Virtual Private Cloud resources that the zone is visible from."
@ -1090,7 +1320,7 @@
"id": "ManagedZoneDnsSecConfig",
"properties": {
"defaultKeySpecs": {
"description": "Specifies parameters that will be used for generating initial DnsKeys for this ManagedZone. Output only while state is not OFF.",
"description": "Specifies parameters for generating initial DnsKeys for this ManagedZone. Can only be changed while the state is OFF.",
"items": {
"$ref": "DnsKeySpec"
},
@ -1102,7 +1332,7 @@
"type": "string"
},
"nonExistence": {
"description": "Specifies the mechanism used to provide authenticated denial-of-existence responses. Output only while state is not OFF.",
"description": "Specifies the mechanism for authenticated denial-of-existence responses. Can only be changed while the state is OFF.",
"enum": [
"nsec",
"nsec3"
@ -1130,6 +1360,39 @@
},
"type": "object"
},
"ManagedZoneForwardingConfig": {
"id": "ManagedZoneForwardingConfig",
"properties": {
"kind": {
"default": "dns#managedZoneForwardingConfig",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZoneForwardingConfig\".",
"type": "string"
},
"targetNameServers": {
"description": "List of target name servers to forward to. Cloud DNS will select the best available name server if more than one target is given.",
"items": {
"$ref": "ManagedZoneForwardingConfigNameServerTarget"
},
"type": "array"
}
},
"type": "object"
},
"ManagedZoneForwardingConfigNameServerTarget": {
"id": "ManagedZoneForwardingConfigNameServerTarget",
"properties": {
"ipv4Address": {
"description": "IPv4 address of a target name server.",
"type": "string"
},
"kind": {
"default": "dns#managedZoneForwardingConfigNameServerTarget",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZoneForwardingConfigNameServerTarget\".",
"type": "string"
}
},
"type": "object"
},
"ManagedZoneOperationsListResponse": {
"id": "ManagedZoneOperationsListResponse",
"properties": {
@ -1155,6 +1418,40 @@
},
"type": "object"
},
"ManagedZonePeeringConfig": {
"id": "ManagedZonePeeringConfig",
"properties": {
"kind": {
"default": "dns#managedZonePeeringConfig",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZonePeeringConfig\".",
"type": "string"
},
"targetNetwork": {
"$ref": "ManagedZonePeeringConfigTargetNetwork",
"description": "The network with which to peer."
}
},
"type": "object"
},
"ManagedZonePeeringConfigTargetNetwork": {
"id": "ManagedZonePeeringConfigTargetNetwork",
"properties": {
"deactivateTime": {
"description": "The time at which the zone was deactivated, in RFC 3339 date-time format. An empty string indicates that the peering connection is active. The producer network can deactivate a zone. The zone is automatically deactivated if the producer network that the zone targeted is deleted. Output only.",
"type": "string"
},
"kind": {
"default": "dns#managedZonePeeringConfigTargetNetwork",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZonePeeringConfigTargetNetwork\".",
"type": "string"
},
"networkUrl": {
"description": "The fully qualified URL of the VPC network to forward queries to. This should be formatted like https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}",
"type": "string"
}
},
"type": "object"
},
"ManagedZonePrivateVisibilityConfig": {
"id": "ManagedZonePrivateVisibilityConfig",
"properties": {
@ -1289,6 +1586,147 @@
},
"type": "object"
},
"PoliciesListResponse": {
"id": "PoliciesListResponse",
"properties": {
"header": {
"$ref": "ResponseHeader"
},
"kind": {
"default": "dns#policiesListResponse",
"description": "Type of resource.",
"type": "string"
},
"nextPageToken": {
"description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size.",
"type": "string"
},
"policies": {
"description": "The policy resources.",
"items": {
"$ref": "Policy"
},
"type": "array"
}
},
"type": "object"
},
"PoliciesPatchResponse": {
"id": "PoliciesPatchResponse",
"properties": {
"header": {
"$ref": "ResponseHeader"
},
"policy": {
"$ref": "Policy"
}
},
"type": "object"
},
"PoliciesUpdateResponse": {
"id": "PoliciesUpdateResponse",
"properties": {
"header": {
"$ref": "ResponseHeader"
},
"policy": {
"$ref": "Policy"
}
},
"type": "object"
},
"Policy": {
"description": "A policy is a collection of DNS rules applied to one or more Virtual Private Cloud resources.",
"id": "Policy",
"properties": {
"alternativeNameServerConfig": {
"$ref": "PolicyAlternativeNameServerConfig",
"description": "Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified."
},
"description": {
"description": "A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the policy's function.",
"type": "string"
},
"enableInboundForwarding": {
"description": "Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.",
"type": "boolean"
},
"enableLogging": {
"description": "Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.",
"type": "boolean"
},
"id": {
"description": "Unique identifier for the resource; defined by the server (output only).",
"format": "uint64",
"type": "string"
},
"kind": {
"default": "dns#policy",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#policy\".",
"type": "string"
},
"name": {
"description": "User assigned name for this policy.",
"type": "string"
},
"networks": {
"description": "List of network names specifying networks to which this policy is applied.",
"items": {
"$ref": "PolicyNetwork"
},
"type": "array"
}
},
"type": "object"
},
"PolicyAlternativeNameServerConfig": {
"id": "PolicyAlternativeNameServerConfig",
"properties": {
"kind": {
"default": "dns#policyAlternativeNameServerConfig",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#policyAlternativeNameServerConfig\".",
"type": "string"
},
"targetNameServers": {
"description": "Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified.",
"items": {
"$ref": "PolicyAlternativeNameServerConfigTargetNameServer"
},
"type": "array"
}
},
"type": "object"
},
"PolicyAlternativeNameServerConfigTargetNameServer": {
"id": "PolicyAlternativeNameServerConfigTargetNameServer",
"properties": {
"ipv4Address": {
"description": "IPv4 address to forward to.",
"type": "string"
},
"kind": {
"default": "dns#policyAlternativeNameServerConfigTargetNameServer",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#policyAlternativeNameServerConfigTargetNameServer\".",
"type": "string"
}
},
"type": "object"
},
"PolicyNetwork": {
"id": "PolicyNetwork",
"properties": {
"kind": {
"default": "dns#policyNetwork",
"description": "Identifies what kind of resource this is. Value: the fixed string \"dns#policyNetwork\".",
"type": "string"
},
"networkUrl": {
"description": "The fully qualified URL of the VPC network to bind to. This should be formatted like https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}",
"type": "string"
}
},
"type": "object"
},
"Project": {
"description": "A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console.",
"id": "Project",
@ -1343,6 +1781,16 @@
"format": "int32",
"type": "integer"
},
"networksPerPolicy": {
"description": "Maximum allowed number of networks per policy.",
"format": "int32",
"type": "integer"
},
"policies": {
"description": "Maximum allowed number of policies per project.",
"format": "int32",
"type": "integer"
},
"resourceRecordsPerRrset": {
"description": "Maximum allowed number of ResourceRecords per ResourceRecordSet.",
"format": "int32",
@ -1363,6 +1811,16 @@
"format": "int32",
"type": "integer"
},
"targetNameServersPerManagedZone": {
"description": "Maximum allowed number of target name servers per managed forwarding zone.",
"format": "int32",
"type": "integer"
},
"targetNameServersPerPolicy": {
"description": "Maximum allowed number of alternative target name servers per policy.",
"format": "int32",
"type": "integer"
},
"totalRrdataSizePerChange": {
"description": "Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes.",
"format": "int32",

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +0,0 @@
// 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 (
"math/rand"
"time"
)
// BackoffStrategy defines the set of functions that a backoff-er must
// implement.
type BackoffStrategy interface {
// Pause returns the duration of the next pause and true if the operation should be
// retried, or false if no further retries should be attempted.
Pause() (time.Duration, bool)
// Reset restores the strategy to its initial state.
Reset()
}
// ExponentialBackoff performs exponential backoff as per https://en.wikipedia.org/wiki/Exponential_backoff.
// The initial pause time is given by Base.
// Once the total pause time exceeds Max, Pause will indicate no further retries.
type ExponentialBackoff struct {
Base time.Duration
Max time.Duration
total time.Duration
n uint
}
// Pause returns the amount of time the caller should wait.
func (eb *ExponentialBackoff) Pause() (time.Duration, bool) {
if eb.total > eb.Max {
return 0, false
}
// The next pause is selected from randomly from [0, 2^n * Base).
d := time.Duration(rand.Int63n((1 << eb.n) * int64(eb.Base)))
eb.total += d
eb.n++
return d, true
}
// Reset resets the backoff strategy such that the next Pause call will begin
// counting from the start. It is not safe to call concurrently with Pause.
func (eb *ExponentialBackoff) Reset() {
eb.n = 0
eb.total = 0
}

View File

@ -1,22 +0,0 @@
// Copyright 2017 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 (
"fmt"
"runtime"
"strings"
)
// GoogleClientHeader returns the value to use for the x-goog-api-client
// header, which is used internally by Google.
func GoogleClientHeader(generatorVersion, clientElement string) string {
elts := []string{"gl-go/" + strings.Replace(runtime.Version(), " ", "_", -1)}
if clientElement != "" {
elts = append(elts, clientElement)
}
elts = append(elts, fmt.Sprintf("gdcl/%s", generatorVersion))
return strings.Join(elts, " ")
}

View File

@ -1,84 +0,0 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package gensupport
import (
"context"
"io"
"net"
"net/http"
"time"
)
// Retry invokes the given function, retrying it multiple times if the connection failed or
// the HTTP status response indicates the request should be attempted again. ctx may be nil.
func Retry(ctx context.Context, f func() (*http.Response, error), backoff BackoffStrategy) (*http.Response, error) {
for {
resp, err := f()
var status int
if resp != nil {
status = resp.StatusCode
}
// Return if we shouldn't retry.
pause, retry := backoff.Pause()
if !shouldRetry(status, err) || !retry {
return resp, err
}
// Ensure the response body is closed, if any.
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
// Pause, but still listen to ctx.Done if context is not nil.
var done <-chan struct{}
if ctx != nil {
done = ctx.Done()
}
select {
case <-done:
return nil, ctx.Err()
case <-time.After(pause):
}
}
}
// DefaultBackoffStrategy returns a default strategy to use for retrying failed upload requests.
func DefaultBackoffStrategy() BackoffStrategy {
return &ExponentialBackoff{
Base: 250 * time.Millisecond,
Max: 16 * time.Second,
}
}
// shouldRetry returns true if the HTTP response / error indicates that the
// request should be attempted again.
func shouldRetry(status int, err error) bool {
if 500 <= status && status <= 599 {
return true
}
if status == statusTooManyRequests {
return true
}
if err == io.ErrUnexpectedEOF {
return true
}
if err, ok := err.(net.Error); ok {
return err.Temporary()
}
return false
}

View File

@ -1,4 +1,4 @@
// Copyright 2011 Google Inc. All rights reserved.
// Copyright 2011 Google LLC. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
@ -16,7 +16,7 @@ import (
"net/url"
"strings"
"google.golang.org/api/googleapi/internal/uritemplates"
"google.golang.org/api/internal/third_party/uritemplates"
)
// ContentTyper is an interface for Readers which know (or would like
@ -54,7 +54,7 @@ const (
// DefaultUploadChunkSize is the default chunk size to use for resumable
// uploads if not specified by the user.
DefaultUploadChunkSize = 8 * 1024 * 1024
DefaultUploadChunkSize = 16 * 1024 * 1024
// MinUploadChunkSize is the minimum chunk size that can be used for
// resumable uploads. All user-specified chunk sizes must be multiple of
@ -256,14 +256,22 @@ func ProcessMediaOptions(opts []MediaOption) *MediaOptions {
// "http://www.golang.org/topics/myproject/mytopic". It strips all parent
// references (e.g. ../..) as well as anything after the host
// (e.g. /bar/gaz gets stripped out of foo.com/bar/gaz).
//
// ResolveRelative panics if either basestr or relstr is not able to be parsed.
func ResolveRelative(basestr, relstr string) string {
u, _ := url.Parse(basestr)
u, err := url.Parse(basestr)
if err != nil {
panic(fmt.Sprintf("failed to parse %q", basestr))
}
afterColonPath := ""
if i := strings.IndexRune(relstr, ':'); i > 0 {
afterColonPath = relstr[i+1:]
relstr = relstr[:i]
}
rel, _ := url.Parse(relstr)
rel, err := url.Parse(relstr)
if err != nil {
panic(fmt.Sprintf("failed to parse %q", relstr))
}
u = u.ResolveReference(rel)
us := u.String()
if afterColonPath != "" {
@ -331,7 +339,7 @@ func ConvertVariant(v map[string]interface{}, dst interface{}) bool {
}
// A Field names a field to be retrieved with a partial response.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance
//
// Partial responses can dramatically reduce the amount of data that must be sent to your application.
// In order to request partial responses, you can specify the full list of fields
@ -348,9 +356,6 @@ func ConvertVariant(v map[string]interface{}, dst interface{}) bool {
//
// svc.Events.List().Fields("nextPageToken", "items(id,updated)").Do()
//
// More information about field formatting can be found here:
// https://developers.google.com/+/api/#fields-syntax
//
// Another way to find field names is through the Google API explorer:
// https://developers.google.com/apis-explorer/#p/
type Field string

View File

@ -1,18 +0,0 @@
Copyright (c) 2013 Joshua Tacoma
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,9 +1,13 @@
// Copyright 2012 Google Inc. All rights reserved.
// Copyright 2012 Google LLC. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package transport contains HTTP transports used to make
// authenticated API requests.
//
// This package is DEPRECATED. Users should instead use,
//
// service, err := NewService(..., option.WithAPIKey(...))
package transport
import (
@ -13,6 +17,8 @@ import (
// APIKey is an HTTP Transport which wraps an underlying transport and
// appends an API Key "key" parameter to the URL of outgoing requests.
//
// Deprecated: please use NewService(..., option.WithAPIKey(...)) instead.
type APIKey struct {
// Key is the API Key to set on requests.
Key string

View File

@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All rights reserved.
// Copyright 2013 Google LLC. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

30
vendor/google.golang.org/api/internal/conn_pool.go generated vendored Normal file
View File

@ -0,0 +1,30 @@
// Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package internal
import (
"google.golang.org/grpc"
)
// ConnPool is a pool of grpc.ClientConns.
type ConnPool interface {
// Conn returns a ClientConn from the pool.
//
// Conns aren't returned to the pool.
Conn() *grpc.ClientConn
// Num returns the number of connections in the pool.
//
// It will always return the same value.
Num() int
// Close closes every ClientConn in the pool.
//
// The error returned by Close may be a single error or multiple errors.
Close() error
// ConnPool implements grpc.ClientConnInterface to enable it to be used directly with generated proto stubs.
grpc.ClientConnInterface
}

View File

@ -1,16 +1,6 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package internal
@ -100,3 +90,16 @@ func selfSignedJWTTokenSource(data []byte, endpoint string, audiences []string)
}
return google.JWTAccessTokenSourceFromJSON(data, audience)
}
// QuotaProjectFromCreds returns the quota project from the JSON blob in the provided credentials.
//
// NOTE(cbro): consider promoting this to a field on google.Credentials.
func QuotaProjectFromCreds(cred *google.Credentials) string {
var v struct {
QuotaProject string `json:"quota_project_id"`
}
if err := json.Unmarshal(cred.JSON, &v); err != nil {
return ""
}
return v.QuotaProject
}

View File

@ -1,16 +1,6 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2016 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gensupport

View File

@ -290,6 +290,9 @@ func (mi *MediaInfo) UploadRequest(reqHeaders http.Header, body io.Reader) (newB
fb := readerFunc(body)
fm := readerFunc(media)
combined, ctype := CombineBodyMedia(body, "application/json", media, mi.mType)
toCleanup := []io.Closer{
combined,
}
if fb != nil && fm != nil {
getBody = func() (io.ReadCloser, error) {
rb := ioutil.NopCloser(fb())
@ -299,10 +302,16 @@ func (mi *MediaInfo) UploadRequest(reqHeaders http.Header, body io.Reader) (newB
mimeBoundary = params["boundary"]
}
r, _ := combineBodyMedia(rb, "application/json", rm, mi.mType, mimeBoundary)
toCleanup = append(toCleanup, r)
return r, nil
}
}
cleanup = func() { combined.Close() }
cleanup = func() {
for _, closer := range toCleanup {
_ = closer.Close()
}
}
reqHeaders.Set("Content-Type", ctype)
body = combined
}

View File

@ -12,6 +12,22 @@ import (
"net/http"
"sync"
"time"
gax "github.com/googleapis/gax-go/v2"
)
// Backoff is an interface around gax.Backoff's Pause method, allowing tests to provide their
// own implementation.
type Backoff interface {
Pause() time.Duration
}
// These are declared as global variables so that tests can overwrite them.
var (
retryDeadline = 32 * time.Second
backoff = func() Backoff {
return &gax.Backoff{Initial: 100 * time.Millisecond}
}
)
const (
@ -39,9 +55,6 @@ 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.
@ -138,15 +151,6 @@ func (rx *ResumableUpload) transferChunk(ctx context.Context) (*http.Response, e
return res, nil
}
func contextDone(ctx context.Context) bool {
select {
case <-ctx.Done():
return true
default:
return false
}
}
// Upload starts the process of a resumable upload with a cancellable context.
// It retries using the provided back off strategy until cancelled or the
// strategy indicates to stop retrying.
@ -156,61 +160,82 @@ func contextDone(ctx context.Context) bool {
// 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()
var shouldRetry = func(status int, err error) bool {
if 500 <= status && status <= 599 {
return true
}
if status == statusTooManyRequests {
return true
}
if err == io.ErrUnexpectedEOF {
return true
}
if err, ok := err.(interface{ Temporary() bool }); ok {
return err.Temporary()
}
return false
}
for {
// 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)
var status int
if resp != nil {
status = resp.StatusCode
}
// Check if we should retry the request.
if shouldRetry(status, err) {
var retry bool
pause, retry = backoff.Pause()
if retry {
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
continue
}
}
// If the chunk was uploaded successfully, but there's still
// more to go, upload the next chunk without any delay.
if statusResumeIncomplete(resp) {
pause = 0
backoff.Reset()
resp.Body.Close()
continue
}
// 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.
// There are a couple of cases where it's possible for err and resp to both
// be non-nil. However, 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.
var prepareReturn = func(resp *http.Response, err error) (*http.Response, error) {
if err != nil {
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
return nil, err
}
return resp, nil
}
// Send all chunks.
for {
var pause time.Duration
// Each chunk gets its own initialized-at-zero retry.
bo := backoff()
quitAfter := time.After(retryDeadline)
// Retry loop for a single chunk.
for {
select {
case <-ctx.Done():
if err == nil {
err = ctx.Err()
}
return prepareReturn(resp, err)
case <-time.After(pause):
case <-quitAfter:
return prepareReturn(resp, err)
}
resp, err = rx.transferChunk(ctx)
var status int
if resp != nil {
status = resp.StatusCode
}
// Check if we should retry the request.
if !shouldRetry(status, err) {
break
}
pause = bo.Pause()
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
}
// If the chunk was uploaded successfully, but there's still
// more to go, upload the next chunk without any delay.
if statusResumeIncomplete(resp) {
resp.Body.Close()
continue
}
return prepareReturn(resp, err)
}
}

View File

@ -1,16 +1,6 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2016 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package internal
@ -20,6 +10,8 @@ import (
"google.golang.org/grpc/naming"
)
// TODO: move to transport/grpc package
// PoolResolver provides a fixed list of addresses to load balance between
// and does not provide further updates.
type PoolResolver struct {

View File

@ -1,16 +1,6 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package internal supports the options and transport packages.
package internal
@ -27,19 +17,22 @@ import (
// DialSettings holds information needed to establish a connection with a
// Google API service.
type DialSettings struct {
Endpoint string
Scopes []string
TokenSource oauth2.TokenSource
Credentials *google.Credentials
CredentialsFile string // if set, Token Source is ignored.
CredentialsJSON []byte
UserAgent string
APIKey string
Audiences []string
HTTPClient *http.Client
GRPCDialOpts []grpc.DialOption
GRPCConn *grpc.ClientConn
NoAuth bool
Endpoint string
Scopes []string
TokenSource oauth2.TokenSource
Credentials *google.Credentials
CredentialsFile string // if set, Token Source is ignored.
CredentialsJSON []byte
UserAgent string
APIKey string
Audiences []string
HTTPClient *http.Client
GRPCDialOpts []grpc.DialOption
GRPCConn *grpc.ClientConn
GRPCConnPool ConnPool
GRPCConnPoolSize int
NoAuth bool
TelemetryDisabled bool
// Google API system parameters. For more information please read:
// https://cloud.google.com/apis/docs/system-parameters
@ -79,6 +72,12 @@ func (ds *DialSettings) Validate() error {
if nCreds > 1 && !(nCreds == 2 && ds.TokenSource != nil && ds.CredentialsFile != "") {
return errors.New("multiple credential options provided")
}
if ds.GRPCConn != nil && ds.GRPCConnPool != nil {
return errors.New("WithGRPCConn is incompatible with WithConnPool")
}
if ds.HTTPClient != nil && ds.GRPCConnPool != nil {
return errors.New("WithHTTPClient is incompatible with WithConnPool")
}
if ds.HTTPClient != nil && ds.GRPCConn != nil {
return errors.New("WithHTTPClient is incompatible with WithGRPCConn")
}

View File

@ -0,0 +1,27 @@
Copyright (c) 2013 Joshua Tacoma. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,14 @@
name: "uritemplates"
description:
"Package uritemplates is a level 4 implementation of RFC 6570 (URI "
"Template, http://tools.ietf.org/html/rfc6570)."
third_party {
url {
type: GIT
value: "https://github.com/jtacoma/uritemplates"
}
version: "0.1"
last_upgrade_date { year: 2014 month: 8 day: 18 }
license_type: NOTICE
}

View File

@ -191,7 +191,7 @@ func parseTerm(term string) (result templateTerm, err error) {
err = errors.New("not a valid name: " + result.name)
}
if result.explode && result.truncate > 0 {
err = errors.New("both explode and prefix modifers on same term")
err = errors.New("both explode and prefix modifiers on same term")
}
return result, err
}

View File

@ -1,16 +1,6 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.9

View File

@ -1,16 +1,6 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.9

View File

@ -1,16 +1,6 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package option contains options for Google API clients.
package option
@ -124,7 +114,7 @@ func (w withHTTPClient) Apply(o *internal.DialSettings) {
}
// WithGRPCConn returns a ClientOption that specifies the gRPC client
// connection to use as the basis of communications. This option many only be
// connection to use as the basis of communications. This option may only be
// used with services that support gRPC as their communication transport. When
// used, the WithGRPCConn option takes precedent over all other supplied
// options.
@ -160,8 +150,7 @@ func WithGRPCConnectionPool(size int) ClientOption {
type withGRPCConnectionPool int
func (w withGRPCConnectionPool) Apply(o *internal.DialSettings) {
balancer := grpc.RoundRobin(internal.NewPoolResolver(int(w), o))
o.GRPCDialOpts = append(o.GRPCDialOpts, grpc.WithBalancer(balancer))
o.GRPCConnPoolSize = int(w)
}
// WithAPIKey returns a ClientOption that specifies an API key to be used
@ -233,3 +222,16 @@ type withRequestReason string
func (w withRequestReason) Apply(o *internal.DialSettings) {
o.RequestReason = string(w)
}
// WithTelemetryDisabled returns a ClientOption that disables default telemetry (OpenCensus)
// settings on gRPC and HTTP clients.
// An example reason would be to bind custom telemetry that overrides the defaults.
func WithTelemetryDisabled() ClientOption {
return withTelemetryDisabledOption{}
}
type withTelemetryDisabledOption struct{}
func (w withTelemetryDisabledOption) Apply(o *internal.DialSettings) {
o.TelemetryDisabled = true
}

View File

@ -1,16 +1,6 @@
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2015 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package http supports network connections to HTTP servers.
// This package is not intended for use by end developers. Use the
@ -63,14 +53,14 @@ func NewTransport(ctx context.Context, base http.RoundTripper, opts ...option.Cl
}
func newTransport(ctx context.Context, base http.RoundTripper, settings *internal.DialSettings) (http.RoundTripper, error) {
trans := base
trans = parameterTransport{
base: trans,
paramTransport := &parameterTransport{
base: base,
userAgent: settings.UserAgent,
quotaProject: settings.QuotaProject,
requestReason: settings.RequestReason,
}
trans = addOCTransport(trans)
var trans http.RoundTripper = paramTransport
trans = addOCTransport(trans, settings)
switch {
case settings.NoAuth:
// Do nothing.
@ -84,6 +74,9 @@ func newTransport(ctx context.Context, base http.RoundTripper, settings *interna
if err != nil {
return nil, err
}
if paramTransport.quotaProject == "" {
paramTransport.quotaProject = internal.QuotaProjectFromCreds(creds)
}
trans = &oauth2.Transport{
Base: trans,
Source: creds.TokenSource,
@ -114,21 +107,20 @@ type parameterTransport struct {
base http.RoundTripper
}
func (t parameterTransport) RoundTrip(req *http.Request) (*http.Response, error) {
func (t *parameterTransport) RoundTrip(req *http.Request) (*http.Response, error) {
rt := t.base
if rt == nil {
return nil, errors.New("transport: no Transport specified")
}
if t.userAgent == "" {
return rt.RoundTrip(req)
}
newReq := *req
newReq.Header = make(http.Header)
for k, vv := range req.Header {
newReq.Header[k] = vv
}
// TODO(cbro): append to existing User-Agent header?
newReq.Header.Set("User-Agent", t.userAgent)
if t.userAgent != "" {
// TODO(cbro): append to existing User-Agent header?
newReq.Header.Set("User-Agent", t.userAgent)
}
// Attach system parameters into the header
if t.quotaProject != "" {
@ -153,7 +145,10 @@ func defaultBaseTransport(ctx context.Context) http.RoundTripper {
return http.DefaultTransport
}
func addOCTransport(trans http.RoundTripper) http.RoundTripper {
func addOCTransport(trans http.RoundTripper, settings *internal.DialSettings) http.RoundTripper {
if settings.TelemetryDisabled {
return trans
}
return &ochttp.Transport{
Base: trans,
Propagation: &propagation.HTTPFormat{},

View File

@ -1,16 +1,6 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2016 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build appengine

View File

@ -1,16 +1,6 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.8