mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #88392 from skmatti/global-access-ga
Promote GlobalAccess for GCE Internal Loadbalancers to GA
This commit is contained in:
commit
0024c837ba
31
LICENSES/vendor/github.com/googleapis/gax-go/v2/LICENSE
generated
vendored
Normal file
31
LICENSES/vendor/github.com/googleapis/gax-go/v2/LICENSE
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
= vendor/github.com/googleapis/gax-go/v2 licensed under: =
|
||||
|
||||
Copyright 2016, Google Inc.
|
||||
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.
|
||||
|
||||
= vendor/github.com/googleapis/gax-go/v2/LICENSE 0dd48ae8103725bd7b401261520cdfbb
|
6
go.mod
6
go.mod
@ -110,7 +110,7 @@ require (
|
||||
golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72
|
||||
gonum.org/v1/gonum v0.6.2
|
||||
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861
|
||||
google.golang.org/api v0.15.1
|
||||
google.golang.org/grpc v1.26.0
|
||||
gopkg.in/gcfg.v1 v1.2.0
|
||||
gopkg.in/square/go-jose.v2 v2.2.2
|
||||
@ -269,7 +269,7 @@ replace (
|
||||
github.com/google/martian => github.com/google/martian v2.1.0+incompatible
|
||||
github.com/google/pprof => github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
|
||||
github.com/google/uuid => github.com/google/uuid v1.1.1
|
||||
github.com/googleapis/gax-go/v2 => github.com/googleapis/gax-go/v2 v2.0.4
|
||||
github.com/googleapis/gax-go/v2 => github.com/googleapis/gax-go/v2 v2.0.5
|
||||
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1
|
||||
github.com/gophercloud/gophercloud => github.com/gophercloud/gophercloud v0.1.0
|
||||
github.com/gopherjs/gopherjs => github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
|
||||
@ -418,7 +418,7 @@ replace (
|
||||
gonum.org/v1/gonum => gonum.org/v1/gonum v0.6.2
|
||||
gonum.org/v1/netlib => gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e
|
||||
gonum.org/v1/plot => gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b
|
||||
google.golang.org/api => google.golang.org/api v0.6.1-0.20190607001116-5213b8090861
|
||||
google.golang.org/api => google.golang.org/api v0.15.1
|
||||
google.golang.org/appengine => google.golang.org/appengine v1.5.0
|
||||
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb
|
||||
google.golang.org/grpc => google.golang.org/grpc v1.26.0
|
||||
|
8
go.sum
8
go.sum
@ -215,7 +215,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I=
|
||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||
github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o=
|
||||
@ -481,8 +482,8 @@ gonum.org/v1/gonum v0.6.2/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=
|
||||
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGBeSJM2fuyh9Yjrnd8kF2Ts=
|
||||
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
|
||||
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861 h1:ppLucX0K/60T3t6LPZQzTOkt5PytkEbQLIaSteq+TpE=
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4=
|
||||
google.golang.org/api v0.15.1 h1:5mMS6mYvK5LVB8+ujVBC33Y8gltBo/kT6HBm6kU80G4=
|
||||
google.golang.org/api v0.15.1/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb h1:ADPHZzpzM4tk4V4S5cnCrr5SwzvlrPRmqqCuJDB8UTs=
|
||||
@ -515,6 +516,7 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a h1:LJwr7TCTghdatWv40WobzlKXc9c4s8oGa7QKJUtHhWA=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/gengo v0.0.0-20200205140755-e0e292d8aa12 h1:pZzawYyz6VRNPVYpqGv61LWCimQv1BihyeqFrp50/G4=
|
||||
k8s.io/gengo v0.0.0-20200205140755-e0e292d8aa12/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
|
@ -28,7 +28,6 @@ import (
|
||||
|
||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
|
||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
|
||||
computebeta "google.golang.org/api/compute/v0.beta"
|
||||
compute "google.golang.org/api/compute/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -169,24 +168,28 @@ func (g *Cloud) ensureInternalLoadBalancer(clusterName, clusterID string, svc *v
|
||||
return nil, err
|
||||
}
|
||||
|
||||
newFRC := &forwardingRuleComposite{
|
||||
name: loadBalancerName,
|
||||
description: &forwardingRuleDescription{ServiceName: nm.String()},
|
||||
ipAddress: ipToUse,
|
||||
backendService: backendServiceLink,
|
||||
ports: ports,
|
||||
ipProtocol: string(protocol),
|
||||
lbScheme: string(scheme),
|
||||
fwdRuleDescription := &forwardingRuleDescription{ServiceName: nm.String()}
|
||||
fwdRuleDescriptionString, err := fwdRuleDescription.marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
newFwdRule := &compute.ForwardingRule{
|
||||
Name: loadBalancerName,
|
||||
Description: fwdRuleDescriptionString,
|
||||
IPAddress: ipToUse,
|
||||
BackendService: backendServiceLink,
|
||||
Ports: ports,
|
||||
IPProtocol: string(protocol),
|
||||
LoadBalancingScheme: string(scheme),
|
||||
// Given that CreateGCECloud will attempt to determine the subnet based off the network,
|
||||
// the subnetwork should rarely be unknown.
|
||||
subnetwork: subnetworkURL,
|
||||
network: g.networkURL,
|
||||
Subnetwork: subnetworkURL,
|
||||
Network: g.networkURL,
|
||||
}
|
||||
if options.AllowGlobalAccess {
|
||||
newFRC.allowGlobalAccess = options.AllowGlobalAccess
|
||||
newFRC.description.APIVersion = meta.VersionBeta
|
||||
newFwdRule.AllowGlobalAccess = options.AllowGlobalAccess
|
||||
}
|
||||
if err := g.ensureInternalForwardingRule(existingFwdRule, newFRC); err != nil {
|
||||
if err := g.ensureInternalForwardingRule(existingFwdRule, newFwdRule); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -878,116 +881,6 @@ func getILBOptions(svc *v1.Service) ILBOptions {
|
||||
}
|
||||
}
|
||||
|
||||
// forwardingRuleComposite is a composite type encapsulating both the GA and Beta ForwardingRules.
|
||||
// It exposes methods to compute the ForwardingRule object based on the given parameters and to compare 2 composite types
|
||||
// based on the version string.
|
||||
type forwardingRuleComposite struct {
|
||||
allowGlobalAccess bool
|
||||
name string
|
||||
description *forwardingRuleDescription
|
||||
ipAddress string
|
||||
backendService string
|
||||
ports []string
|
||||
ipProtocol string
|
||||
lbScheme string
|
||||
subnetwork string
|
||||
network string
|
||||
}
|
||||
|
||||
func (f *forwardingRuleComposite) Version() meta.Version {
|
||||
return f.description.APIVersion
|
||||
}
|
||||
|
||||
func (f *forwardingRuleComposite) Equal(other *forwardingRuleComposite) bool {
|
||||
return (f.ipAddress == "" || other.ipAddress == "" || f.ipAddress == other.ipAddress) &&
|
||||
f.ipProtocol == other.ipProtocol &&
|
||||
f.lbScheme == other.lbScheme &&
|
||||
equalStringSets(f.ports, other.ports) &&
|
||||
f.backendService == other.backendService &&
|
||||
f.allowGlobalAccess == other.allowGlobalAccess &&
|
||||
f.subnetwork == other.subnetwork
|
||||
}
|
||||
|
||||
// toForwardingRuleComposite converts a compute beta or GA ForwardingRule into the composite type
|
||||
func toForwardingRuleComposite(rule interface{}) (frc *forwardingRuleComposite, err error) {
|
||||
switch fr := rule.(type) {
|
||||
case *compute.ForwardingRule:
|
||||
frc = &forwardingRuleComposite{
|
||||
name: fr.Name,
|
||||
ipAddress: fr.IPAddress,
|
||||
description: &forwardingRuleDescription{APIVersion: meta.VersionGA},
|
||||
backendService: fr.BackendService,
|
||||
ports: fr.Ports,
|
||||
ipProtocol: fr.IPProtocol,
|
||||
lbScheme: fr.LoadBalancingScheme,
|
||||
subnetwork: fr.Subnetwork,
|
||||
network: fr.Network,
|
||||
}
|
||||
if fr.Description != "" {
|
||||
err = frc.description.unmarshal(fr.Description)
|
||||
}
|
||||
return frc, err
|
||||
case *computebeta.ForwardingRule:
|
||||
frc = &forwardingRuleComposite{
|
||||
name: fr.Name,
|
||||
ipAddress: fr.IPAddress,
|
||||
description: &forwardingRuleDescription{APIVersion: meta.VersionBeta},
|
||||
backendService: fr.BackendService,
|
||||
ports: fr.Ports,
|
||||
ipProtocol: fr.IPProtocol,
|
||||
lbScheme: fr.LoadBalancingScheme,
|
||||
subnetwork: fr.Subnetwork,
|
||||
network: fr.Network,
|
||||
allowGlobalAccess: fr.AllowGlobalAccess,
|
||||
}
|
||||
if fr.Description != "" {
|
||||
err = frc.description.unmarshal(fr.Description)
|
||||
}
|
||||
return frc, err
|
||||
default:
|
||||
return nil, fmt.Errorf("Invalid object type %T to compute ForwardingRuleComposite from", fr)
|
||||
}
|
||||
}
|
||||
|
||||
// ToBeta returns a Beta ForwardingRule from the composite type.
|
||||
func (f *forwardingRuleComposite) ToBeta() (*computebeta.ForwardingRule, error) {
|
||||
descStr, err := f.description.marshal()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to compute description for beta forwarding rule %s, err: %v", f.name, err)
|
||||
}
|
||||
return &computebeta.ForwardingRule{
|
||||
Name: f.name,
|
||||
Description: descStr,
|
||||
IPAddress: f.ipAddress,
|
||||
BackendService: f.backendService,
|
||||
Ports: f.ports,
|
||||
IPProtocol: f.ipProtocol,
|
||||
LoadBalancingScheme: f.lbScheme,
|
||||
Subnetwork: f.subnetwork,
|
||||
Network: f.network,
|
||||
AllowGlobalAccess: f.allowGlobalAccess,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ToGA returns a GA ForwardingRule from the composite type.
|
||||
func (f *forwardingRuleComposite) ToGA() (*compute.ForwardingRule, error) {
|
||||
descStr, err := f.description.marshal()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to compute description for GA forwarding rule %s, err: %v", f.name, err)
|
||||
}
|
||||
return &compute.ForwardingRule{
|
||||
Name: f.name,
|
||||
Description: descStr,
|
||||
IPAddress: f.ipAddress,
|
||||
BackendService: f.backendService,
|
||||
Ports: f.ports,
|
||||
IPProtocol: f.ipProtocol,
|
||||
LoadBalancingScheme: f.lbScheme,
|
||||
Subnetwork: f.subnetwork,
|
||||
Network: f.network,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type forwardingRuleDescription struct {
|
||||
ServiceName string `json:"kubernetes.io/service-name"`
|
||||
APIVersion meta.Version `json:"kubernetes.io/api-version,omitempty"`
|
||||
@ -1021,32 +914,10 @@ func getFwdRuleAPIVersion(rule *compute.ForwardingRule) (meta.Version, error) {
|
||||
return d.APIVersion, nil
|
||||
}
|
||||
|
||||
func (g *Cloud) ensureInternalForwardingRule(existingFwdRule *compute.ForwardingRule, newFRC *forwardingRuleComposite) (err error) {
|
||||
func (g *Cloud) ensureInternalForwardingRule(existingFwdRule, newFwdRule *compute.ForwardingRule) (err error) {
|
||||
if existingFwdRule != nil {
|
||||
version, err := getFwdRuleAPIVersion(existingFwdRule)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var oldFRC *forwardingRuleComposite
|
||||
switch version {
|
||||
case meta.VersionBeta:
|
||||
var betaRule *computebeta.ForwardingRule
|
||||
betaRule, err = g.GetBetaRegionForwardingRule(existingFwdRule.Name, g.region)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
oldFRC, err = toForwardingRuleComposite(betaRule)
|
||||
case meta.VersionGA:
|
||||
oldFRC, err = toForwardingRuleComposite(existingFwdRule)
|
||||
default:
|
||||
klog.Errorf("invalid version string for %s, assuming GA", existingFwdRule.Name)
|
||||
oldFRC, err = toForwardingRuleComposite(existingFwdRule)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if oldFRC.Equal(newFRC) {
|
||||
klog.V(4).Infof("oldFRC == newFRC, no updates needed (oldFRC == %+v)", oldFRC)
|
||||
if forwardingRulesEqual(existingFwdRule, newFwdRule) {
|
||||
klog.V(4).Infof("existingFwdRule == newFwdRule, no updates needed (existingFwdRule == %+v)", existingFwdRule)
|
||||
return nil
|
||||
}
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): deleting existing forwarding rule with IP address %v", existingFwdRule.Name, existingFwdRule.IPAddress)
|
||||
@ -1056,23 +927,20 @@ func (g *Cloud) ensureInternalForwardingRule(existingFwdRule *compute.Forwarding
|
||||
}
|
||||
// At this point, the existing rule has been deleted if required.
|
||||
// Create the rule based on the api version determined
|
||||
if newFRC.Version() == meta.VersionBeta {
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): creating beta forwarding rule", newFRC.name)
|
||||
var betaRule *computebeta.ForwardingRule
|
||||
betaRule, err = newFRC.ToBeta()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = g.CreateBetaRegionForwardingRule(betaRule, g.region)
|
||||
} else {
|
||||
var gaRule *compute.ForwardingRule
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): creating ga forwarding rule", newFRC.name)
|
||||
gaRule, err = newFRC.ToGA()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = g.CreateRegionForwardingRule(gaRule, g.region)
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): creating forwarding rule", newFwdRule.Name)
|
||||
if err = g.CreateRegionForwardingRule(newFwdRule, g.region); err != nil {
|
||||
return err
|
||||
}
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): created forwarding rule, err : %s", newFRC.name, err)
|
||||
return err
|
||||
klog.V(2).Infof("ensureInternalLoadBalancer(%v): created forwarding rule", newFwdRule.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
func forwardingRulesEqual(old, new *compute.ForwardingRule) bool {
|
||||
return (old.IPAddress == "" || new.IPAddress == "" || old.IPAddress == new.IPAddress) &&
|
||||
old.IPProtocol == new.IPProtocol &&
|
||||
old.LoadBalancingScheme == new.LoadBalancingScheme &&
|
||||
equalStringSets(old.Ports, new.Ports) &&
|
||||
old.BackendService == new.BackendService &&
|
||||
old.AllowGlobalAccess == new.AllowGlobalAccess &&
|
||||
old.Subnetwork == new.Subnetwork
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import (
|
||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
|
||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta"
|
||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/mock"
|
||||
computebeta "google.golang.org/api/compute/v0.beta"
|
||||
"google.golang.org/api/compute/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -1135,17 +1134,13 @@ func TestEnsureInternalLoadBalancerGlobalAccess(t *testing.T) {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
assert.NotEmpty(t, status.Ingress)
|
||||
betaRuleDescString := fmt.Sprintf(`{"kubernetes.io/service-name":"%s","kubernetes.io/api-version":"beta"}`, types.NamespacedName{Name: svc.Name, Namespace: svc.Namespace}.String())
|
||||
fwdRule, err := gce.GetBetaRegionForwardingRule(lbName, gce.region)
|
||||
fwdRule, err := gce.GetRegionForwardingRule(lbName, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("gce.GetRegionForwardingRule(%q, %q) = %v, want nil", lbName, gce.region, err)
|
||||
}
|
||||
if !fwdRule.AllowGlobalAccess {
|
||||
t.Errorf("Unexpected false value for AllowGlobalAccess")
|
||||
}
|
||||
if fwdRule.Description != betaRuleDescString {
|
||||
t.Errorf("Expected description %s, Got %s", betaRuleDescString, fwdRule.Description)
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
// remove the annotation
|
||||
delete(svc.Annotations, ServiceAnnotationILBAllowGlobalAccess)
|
||||
status, err = gce.EnsureLoadBalancer(context.Background(), vals.ClusterName, svc, nodes)
|
||||
@ -1153,17 +1148,13 @@ func TestEnsureInternalLoadBalancerGlobalAccess(t *testing.T) {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
assert.NotEmpty(t, status.Ingress)
|
||||
gaRuleDescString := fmt.Sprintf(`{"kubernetes.io/service-name":"%s"}`, types.NamespacedName{Name: svc.Name, Namespace: svc.Namespace}.String())
|
||||
fwdRule, err = gce.GetBetaRegionForwardingRule(lbName, gce.region)
|
||||
fwdRule, err = gce.GetRegionForwardingRule(lbName, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
t.Errorf("gce.GetRegionForwardingRule(%q, %q) = %v, want nil", lbName, gce.region, err)
|
||||
}
|
||||
if fwdRule.AllowGlobalAccess {
|
||||
t.Errorf("Unexpected true value for AllowGlobalAccess")
|
||||
}
|
||||
if fwdRule.Description != gaRuleDescString {
|
||||
t.Errorf("Expected description %s, Got %s", gaRuleDescString, fwdRule.Description)
|
||||
}
|
||||
// Delete the service
|
||||
err = gce.EnsureLoadBalancerDeleted(context.Background(), vals.ClusterName, svc)
|
||||
if err != nil {
|
||||
@ -1192,9 +1183,9 @@ func TestEnsureInternalLoadBalancerDisableGlobalAccess(t *testing.T) {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
assert.NotEmpty(t, status.Ingress)
|
||||
fwdRule, err := gce.GetBetaRegionForwardingRule(lbName, gce.region)
|
||||
fwdRule, err := gce.GetRegionForwardingRule(lbName, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
t.Errorf("gce.GetRegionForwardingRule(%q, %q) = %v, want nil", lbName, gce.region, err)
|
||||
}
|
||||
if !fwdRule.AllowGlobalAccess {
|
||||
t.Errorf("Unexpected false value for AllowGlobalAccess")
|
||||
@ -1207,9 +1198,9 @@ func TestEnsureInternalLoadBalancerDisableGlobalAccess(t *testing.T) {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
assert.NotEmpty(t, status.Ingress)
|
||||
fwdRule, err = gce.GetBetaRegionForwardingRule(lbName, gce.region)
|
||||
fwdRule, err = gce.GetRegionForwardingRule(lbName, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
t.Errorf("gce.GetRegionForwardingRule(%q, %q) = %v, want nil", lbName, gce.region, err)
|
||||
}
|
||||
if fwdRule.AllowGlobalAccess {
|
||||
t.Errorf("Unexpected true value for AllowGlobalAccess")
|
||||
@ -1249,9 +1240,9 @@ func TestGlobalAccessChangeScheme(t *testing.T) {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
assert.NotEmpty(t, status.Ingress)
|
||||
fwdRule, err := gce.GetBetaRegionForwardingRule(lbName, gce.region)
|
||||
fwdRule, err := gce.GetRegionForwardingRule(lbName, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
t.Errorf("gce.GetRegionForwardingRule(%q, %q) = %v, want nil", lbName, gce.region, err)
|
||||
}
|
||||
if !fwdRule.AllowGlobalAccess {
|
||||
t.Errorf("Unexpected false value for AllowGlobalAccess")
|
||||
@ -1265,9 +1256,9 @@ func TestGlobalAccessChangeScheme(t *testing.T) {
|
||||
assert.NotEmpty(t, status.Ingress)
|
||||
// Firewall is deleted when the service is deleted
|
||||
assertInternalLbResourcesDeleted(t, gce, svc, vals, false)
|
||||
fwdRule, err = gce.GetBetaRegionForwardingRule(lbName, gce.region)
|
||||
fwdRule, err = gce.GetRegionForwardingRule(lbName, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
t.Errorf("gce.GetRegionForwardingRule(%q, %q) = %v, want nil", lbName, gce.region, err)
|
||||
}
|
||||
if fwdRule.AllowGlobalAccess {
|
||||
t.Errorf("Unexpected true value for AllowGlobalAccess")
|
||||
@ -1309,77 +1300,78 @@ func TestUnmarshalEmptyAPIVersion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestForwardingRuleCompositeEqual(t *testing.T) {
|
||||
func TestForwardingRulesEqual(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
vals := DefaultTestClusterValues()
|
||||
gce, err := fakeGCECloud(vals)
|
||||
require.NoError(t, err)
|
||||
fwdRules := []*compute.ForwardingRule{
|
||||
{
|
||||
Name: "empty-ip-address-fwd-rule",
|
||||
IPAddress: "",
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "TCP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
},
|
||||
{
|
||||
Name: "tcp-fwd-rule",
|
||||
IPAddress: "10.0.0.0",
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "TCP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
},
|
||||
{
|
||||
Name: "udp-fwd-rule",
|
||||
IPAddress: "10.0.0.0",
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "UDP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
},
|
||||
{
|
||||
Name: "global-access-fwd-rule",
|
||||
IPAddress: "10.0.0.0",
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "TCP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
AllowGlobalAccess: true,
|
||||
},
|
||||
}
|
||||
|
||||
svc := fakeLoadbalancerService(string(LBTypeInternal))
|
||||
lbName := gce.GetLoadBalancerName(context.TODO(), "", svc)
|
||||
gaRule := &compute.ForwardingRule{
|
||||
Name: lbName,
|
||||
IPAddress: "",
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "TCP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
}
|
||||
betaRule := &computebeta.ForwardingRule{
|
||||
Name: lbName + "-beta",
|
||||
IPAddress: "",
|
||||
Description: fmt.Sprintf(`{"kubernetes.io/service-name":"%s","apiVersion":"beta"}`, svc.Name),
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "TCP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
AllowGlobalAccess: false,
|
||||
}
|
||||
betaRuleGlobalAccess := &computebeta.ForwardingRule{
|
||||
Name: lbName + "-globalaccess",
|
||||
IPAddress: "",
|
||||
Description: fmt.Sprintf(`{"kubernetes.io/service-name":"%s","apiVersion":"beta"}`, svc.Name),
|
||||
Ports: []string{"123"},
|
||||
IPProtocol: "TCP",
|
||||
LoadBalancingScheme: string(cloud.SchemeInternal),
|
||||
AllowGlobalAccess: true,
|
||||
}
|
||||
err = gce.CreateRegionForwardingRule(gaRule, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
err = gce.CreateBetaRegionForwardingRule(betaRule, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
err = gce.CreateBetaRegionForwardingRule(betaRuleGlobalAccess, gce.region)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
frcGA, err := toForwardingRuleComposite(gaRule)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
frcBeta, err := toForwardingRuleComposite(betaRule)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
frcBetaGlobalAccess, err := toForwardingRuleComposite(betaRuleGlobalAccess)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %v", err)
|
||||
}
|
||||
if !frcGA.Equal(frcBeta) {
|
||||
t.Errorf("Expected frcGA and frcBeta rules to be equal, got false")
|
||||
}
|
||||
if frcBeta.Equal(frcBetaGlobalAccess) {
|
||||
t.Errorf("Expected FrcBeta and FrcBetaGlobalAccess rules to be unequal, got true")
|
||||
}
|
||||
if frcGA.Equal(frcBetaGlobalAccess) {
|
||||
t.Errorf("Expected frcGA and frcBetaGlobalAccess rules to be unequal, got true")
|
||||
}
|
||||
// Enabling globalAccess in FrcBeta to make equality fail with FrcGA
|
||||
frcBeta.allowGlobalAccess = true
|
||||
if frcGA.Equal(frcBeta) {
|
||||
t.Errorf("Expected frcGA and frcBeta rules to be unequal, got true")
|
||||
for _, tc := range []struct {
|
||||
desc string
|
||||
oldFwdRule *compute.ForwardingRule
|
||||
newFwdRule *compute.ForwardingRule
|
||||
expect bool
|
||||
}{
|
||||
{
|
||||
desc: "empty ip address matches any ip",
|
||||
oldFwdRule: fwdRules[0],
|
||||
newFwdRule: fwdRules[1],
|
||||
expect: true,
|
||||
},
|
||||
{
|
||||
desc: "global access enabled",
|
||||
oldFwdRule: fwdRules[1],
|
||||
newFwdRule: fwdRules[3],
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
desc: "IP protocol changed",
|
||||
oldFwdRule: fwdRules[1],
|
||||
newFwdRule: fwdRules[2],
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
desc: "same forwarding rule",
|
||||
oldFwdRule: fwdRules[3],
|
||||
newFwdRule: fwdRules[3],
|
||||
expect: true,
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
got := forwardingRulesEqual(tc.oldFwdRule, tc.newFwdRule)
|
||||
if got != tc.expect {
|
||||
t.Errorf("forwardingRulesEqual(_, _) = %t, want %t", got, tc.expect)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ require (
|
||||
github.com/vmware/govmomi v0.20.3
|
||||
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861
|
||||
google.golang.org/api v0.15.1
|
||||
gopkg.in/gcfg.v1 v1.2.0
|
||||
gopkg.in/warnings.v0 v0.1.1 // indirect
|
||||
k8s.io/api v0.0.0
|
||||
|
7
staging/src/k8s.io/legacy-cloud-providers/go.sum
generated
7
staging/src/k8s.io/legacy-cloud-providers/go.sum
generated
@ -132,7 +132,10 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I=
|
||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||
github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/391+sT5o=
|
||||
@ -319,8 +322,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861 h1:ppLucX0K/60T3t6LPZQzTOkt5PytkEbQLIaSteq+TpE=
|
||||
google.golang.org/api v0.6.1-0.20190607001116-5213b8090861/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4=
|
||||
google.golang.org/api v0.15.1 h1:5mMS6mYvK5LVB8+ujVBC33Y8gltBo/kT6HBm6kU80G4=
|
||||
google.golang.org/api v0.15.1/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c=
|
||||
|
2
vendor/BUILD
vendored
2
vendor/BUILD
vendored
@ -177,6 +177,7 @@ filegroup(
|
||||
"//vendor/github.com/google/go-cmp/cmp:all-srcs",
|
||||
"//vendor/github.com/google/gofuzz:all-srcs",
|
||||
"//vendor/github.com/google/uuid:all-srcs",
|
||||
"//vendor/github.com/googleapis/gax-go/v2:all-srcs",
|
||||
"//vendor/github.com/googleapis/gnostic/compiler:all-srcs",
|
||||
"//vendor/github.com/googleapis/gnostic/extensions:all-srcs",
|
||||
"//vendor/github.com/googleapis/gnostic/openapiv2:all-srcs",
|
||||
@ -390,7 +391,6 @@ filegroup(
|
||||
"//vendor/google.golang.org/api/compute/v0.beta:all-srcs",
|
||||
"//vendor/google.golang.org/api/compute/v1:all-srcs",
|
||||
"//vendor/google.golang.org/api/container/v1:all-srcs",
|
||||
"//vendor/google.golang.org/api/gensupport:all-srcs",
|
||||
"//vendor/google.golang.org/api/googleapi:all-srcs",
|
||||
"//vendor/google.golang.org/api/internal:all-srcs",
|
||||
"//vendor/google.golang.org/api/logging/v2beta1:all-srcs",
|
||||
|
33
vendor/github.com/googleapis/gax-go/v2/BUILD
generated
vendored
Normal file
33
vendor/github.com/googleapis/gax-go/v2/BUILD
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"call_option.go",
|
||||
"gax.go",
|
||||
"header.go",
|
||||
"invoke.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/googleapis/gax-go/v2",
|
||||
importpath = "github.com/googleapis/gax-go/v2",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/grpc:go_default_library",
|
||||
"//vendor/google.golang.org/grpc/codes:go_default_library",
|
||||
"//vendor/google.golang.org/grpc/status:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
27
vendor/github.com/googleapis/gax-go/v2/LICENSE
generated
vendored
Normal file
27
vendor/github.com/googleapis/gax-go/v2/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright 2016, Google Inc.
|
||||
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.
|
161
vendor/github.com/googleapis/gax-go/v2/call_option.go
generated
vendored
Normal file
161
vendor/github.com/googleapis/gax-go/v2/call_option.go
generated
vendored
Normal file
@ -0,0 +1,161 @@
|
||||
// Copyright 2016, Google Inc.
|
||||
// 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.
|
||||
|
||||
package gax
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// CallOption is an option used by Invoke to control behaviors of RPC calls.
|
||||
// CallOption works by modifying relevant fields of CallSettings.
|
||||
type CallOption interface {
|
||||
// Resolve applies the option by modifying cs.
|
||||
Resolve(cs *CallSettings)
|
||||
}
|
||||
|
||||
// Retryer is used by Invoke to determine retry behavior.
|
||||
type Retryer interface {
|
||||
// Retry reports whether a request should be retriedand how long to pause before retrying
|
||||
// if the previous attempt returned with err. Invoke never calls Retry with nil error.
|
||||
Retry(err error) (pause time.Duration, shouldRetry bool)
|
||||
}
|
||||
|
||||
type retryerOption func() Retryer
|
||||
|
||||
func (o retryerOption) Resolve(s *CallSettings) {
|
||||
s.Retry = o
|
||||
}
|
||||
|
||||
// WithRetry sets CallSettings.Retry to fn.
|
||||
func WithRetry(fn func() Retryer) CallOption {
|
||||
return retryerOption(fn)
|
||||
}
|
||||
|
||||
// OnCodes returns a Retryer that retries if and only if
|
||||
// the previous attempt returns a GRPC error whose error code is stored in cc.
|
||||
// Pause times between retries are specified by bo.
|
||||
//
|
||||
// bo is only used for its parameters; each Retryer has its own copy.
|
||||
func OnCodes(cc []codes.Code, bo Backoff) Retryer {
|
||||
return &boRetryer{
|
||||
backoff: bo,
|
||||
codes: append([]codes.Code(nil), cc...),
|
||||
}
|
||||
}
|
||||
|
||||
type boRetryer struct {
|
||||
backoff Backoff
|
||||
codes []codes.Code
|
||||
}
|
||||
|
||||
func (r *boRetryer) Retry(err error) (time.Duration, bool) {
|
||||
st, ok := status.FromError(err)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
c := st.Code()
|
||||
for _, rc := range r.codes {
|
||||
if c == rc {
|
||||
return r.backoff.Pause(), true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// Backoff implements exponential backoff.
|
||||
// The wait time between retries is a random value between 0 and the "retry envelope".
|
||||
// The envelope starts at Initial and increases by the factor of Multiplier every retry,
|
||||
// but is capped at Max.
|
||||
type Backoff struct {
|
||||
// Initial is the initial value of the retry envelope, defaults to 1 second.
|
||||
Initial time.Duration
|
||||
|
||||
// Max is the maximum value of the retry envelope, defaults to 30 seconds.
|
||||
Max time.Duration
|
||||
|
||||
// Multiplier is the factor by which the retry envelope increases.
|
||||
// It should be greater than 1 and defaults to 2.
|
||||
Multiplier float64
|
||||
|
||||
// cur is the current retry envelope
|
||||
cur time.Duration
|
||||
}
|
||||
|
||||
// Pause returns the next time.Duration that the caller should use to backoff.
|
||||
func (bo *Backoff) Pause() time.Duration {
|
||||
if bo.Initial == 0 {
|
||||
bo.Initial = time.Second
|
||||
}
|
||||
if bo.cur == 0 {
|
||||
bo.cur = bo.Initial
|
||||
}
|
||||
if bo.Max == 0 {
|
||||
bo.Max = 30 * time.Second
|
||||
}
|
||||
if bo.Multiplier < 1 {
|
||||
bo.Multiplier = 2
|
||||
}
|
||||
// Select a duration between 1ns and the current max. It might seem
|
||||
// counterintuitive to have so much jitter, but
|
||||
// https://www.awsarchitectureblog.com/2015/03/backoff.html argues that
|
||||
// that is the best strategy.
|
||||
d := time.Duration(1 + rand.Int63n(int64(bo.cur)))
|
||||
bo.cur = time.Duration(float64(bo.cur) * bo.Multiplier)
|
||||
if bo.cur > bo.Max {
|
||||
bo.cur = bo.Max
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
type grpcOpt []grpc.CallOption
|
||||
|
||||
func (o grpcOpt) Resolve(s *CallSettings) {
|
||||
s.GRPC = o
|
||||
}
|
||||
|
||||
// WithGRPCOptions allows passing gRPC call options during client creation.
|
||||
func WithGRPCOptions(opt ...grpc.CallOption) CallOption {
|
||||
return grpcOpt(append([]grpc.CallOption(nil), opt...))
|
||||
}
|
||||
|
||||
// CallSettings allow fine-grained control over how calls are made.
|
||||
type CallSettings struct {
|
||||
// Retry returns a Retryer to be used to control retry logic of a method call.
|
||||
// If Retry is nil or the returned Retryer is nil, the call will not be retried.
|
||||
Retry func() Retryer
|
||||
|
||||
// CallOptions to be forwarded to GRPC.
|
||||
GRPC []grpc.CallOption
|
||||
}
|
39
vendor/github.com/googleapis/gax-go/v2/gax.go
generated
vendored
Normal file
39
vendor/github.com/googleapis/gax-go/v2/gax.go
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright 2016, Google Inc.
|
||||
// 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.
|
||||
|
||||
// Package gax contains a set of modules which aid the development of APIs
|
||||
// for clients and servers based on gRPC and Google API conventions.
|
||||
//
|
||||
// Application code will rarely need to use this library directly.
|
||||
// However, code generated automatically from API definition files can use it
|
||||
// to simplify code generation and to provide more convenient and idiomatic API surfaces.
|
||||
package gax
|
||||
|
||||
// Version specifies the gax-go version being used.
|
||||
const Version = "2.0.4"
|
3
vendor/github.com/googleapis/gax-go/v2/go.mod
generated
vendored
Normal file
3
vendor/github.com/googleapis/gax-go/v2/go.mod
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/googleapis/gax-go/v2
|
||||
|
||||
require google.golang.org/grpc v1.19.0
|
25
vendor/github.com/googleapis/gax-go/v2/go.sum
generated
vendored
Normal file
25
vendor/github.com/googleapis/gax-go/v2/go.sum
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
53
vendor/github.com/googleapis/gax-go/v2/header.go
generated
vendored
Normal file
53
vendor/github.com/googleapis/gax-go/v2/header.go
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright 2018, Google Inc.
|
||||
// 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.
|
||||
|
||||
package gax
|
||||
|
||||
import "bytes"
|
||||
|
||||
// XGoogHeader is for use by the Google Cloud Libraries only.
|
||||
//
|
||||
// XGoogHeader formats key-value pairs.
|
||||
// The resulting string is suitable for x-goog-api-client header.
|
||||
func XGoogHeader(keyval ...string) string {
|
||||
if len(keyval) == 0 {
|
||||
return ""
|
||||
}
|
||||
if len(keyval)%2 != 0 {
|
||||
panic("gax.Header: odd argument count")
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
for i := 0; i < len(keyval); i += 2 {
|
||||
buf.WriteByte(' ')
|
||||
buf.WriteString(keyval[i])
|
||||
buf.WriteByte('/')
|
||||
buf.WriteString(keyval[i+1])
|
||||
}
|
||||
return buf.String()[1:]
|
||||
}
|
99
vendor/github.com/googleapis/gax-go/v2/invoke.go
generated
vendored
Normal file
99
vendor/github.com/googleapis/gax-go/v2/invoke.go
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
// Copyright 2016, Google Inc.
|
||||
// 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.
|
||||
|
||||
package gax
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// APICall is a user defined call stub.
|
||||
type APICall func(context.Context, CallSettings) error
|
||||
|
||||
// Invoke calls the given APICall,
|
||||
// performing retries as specified by opts, if any.
|
||||
func Invoke(ctx context.Context, call APICall, opts ...CallOption) error {
|
||||
var settings CallSettings
|
||||
for _, opt := range opts {
|
||||
opt.Resolve(&settings)
|
||||
}
|
||||
return invoke(ctx, call, settings, Sleep)
|
||||
}
|
||||
|
||||
// Sleep is similar to time.Sleep, but it can be interrupted by ctx.Done() closing.
|
||||
// If interrupted, Sleep returns ctx.Err().
|
||||
func Sleep(ctx context.Context, d time.Duration) error {
|
||||
t := time.NewTimer(d)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
t.Stop()
|
||||
return ctx.Err()
|
||||
case <-t.C:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
type sleeper func(ctx context.Context, d time.Duration) error
|
||||
|
||||
// invoke implements Invoke, taking an additional sleeper argument for testing.
|
||||
func invoke(ctx context.Context, call APICall, settings CallSettings, sp sleeper) error {
|
||||
var retryer Retryer
|
||||
for {
|
||||
err := call(ctx, settings)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if settings.Retry == nil {
|
||||
return err
|
||||
}
|
||||
// Never retry permanent certificate errors. (e.x. if ca-certificates
|
||||
// are not installed). We should only make very few, targeted
|
||||
// exceptions: many (other) status=Unavailable should be retried, such
|
||||
// as if there's a network hiccup, or the internet goes out for a
|
||||
// minute. This is also why here we are doing string parsing instead of
|
||||
// simply making Unavailable a non-retried code elsewhere.
|
||||
if strings.Contains(err.Error(), "x509: certificate signed by unknown authority") {
|
||||
return err
|
||||
}
|
||||
if retryer == nil {
|
||||
if r := settings.Retry(); r != nil {
|
||||
retryer = r
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if d, ok := retryer.Retry(err); !ok {
|
||||
return err
|
||||
} else if err = sp(ctx, d); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
1
vendor/google.golang.org/api/AUTHORS
generated
vendored
1
vendor/google.golang.org/api/AUTHORS
generated
vendored
@ -8,3 +8,4 @@
|
||||
|
||||
# Please keep the list sorted.
|
||||
Google Inc.
|
||||
LightStep Inc.
|
||||
|
1
vendor/google.golang.org/api/CONTRIBUTORS
generated
vendored
1
vendor/google.golang.org/api/CONTRIBUTORS
generated
vendored
@ -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>
|
||||
|
2
vendor/google.golang.org/api/compute/v0.alpha/BUILD
generated
vendored
2
vendor/google.golang.org/api/compute/v0.alpha/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/compute/v0.alpha",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
5484
vendor/google.golang.org/api/compute/v0.alpha/compute-api.json
generated
vendored
5484
vendor/google.golang.org/api/compute/v0.alpha/compute-api.json
generated
vendored
File diff suppressed because it is too large
Load Diff
14470
vendor/google.golang.org/api/compute/v0.alpha/compute-gen.go
generated
vendored
14470
vendor/google.golang.org/api/compute/v0.alpha/compute-gen.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/google.golang.org/api/compute/v0.beta/BUILD
generated
vendored
2
vendor/google.golang.org/api/compute/v0.beta/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/compute/v0.beta",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
3983
vendor/google.golang.org/api/compute/v0.beta/compute-api.json
generated
vendored
3983
vendor/google.golang.org/api/compute/v0.beta/compute-api.json
generated
vendored
File diff suppressed because it is too large
Load Diff
10317
vendor/google.golang.org/api/compute/v0.beta/compute-gen.go
generated
vendored
10317
vendor/google.golang.org/api/compute/v0.beta/compute-gen.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/google.golang.org/api/compute/v1/BUILD
generated
vendored
2
vendor/google.golang.org/api/compute/v1/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/compute/v1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
8440
vendor/google.golang.org/api/compute/v1/compute-api.json
generated
vendored
8440
vendor/google.golang.org/api/compute/v1/compute-api.json
generated
vendored
File diff suppressed because it is too large
Load Diff
23881
vendor/google.golang.org/api/compute/v1/compute-gen.go
generated
vendored
23881
vendor/google.golang.org/api/compute/v1/compute-gen.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/google.golang.org/api/container/v1/BUILD
generated
vendored
2
vendor/google.golang.org/api/container/v1/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/container/v1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
785
vendor/google.golang.org/api/container/v1/container-api.json
generated
vendored
785
vendor/google.golang.org/api/container/v1/container-api.json
generated
vendored
File diff suppressed because it is too large
Load Diff
1494
vendor/google.golang.org/api/container/v1/container-gen.go
generated
vendored
1494
vendor/google.golang.org/api/container/v1/container-gen.go
generated
vendored
File diff suppressed because it is too large
Load Diff
51
vendor/google.golang.org/api/gensupport/backoff.go
generated
vendored
51
vendor/google.golang.org/api/gensupport/backoff.go
generated
vendored
@ -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
|
||||
}
|
22
vendor/google.golang.org/api/gensupport/header.go
generated
vendored
22
vendor/google.golang.org/api/gensupport/header.go
generated
vendored
@ -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, " ")
|
||||
}
|
84
vendor/google.golang.org/api/gensupport/retry.go
generated
vendored
84
vendor/google.golang.org/api/gensupport/retry.go
generated
vendored
@ -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
|
||||
}
|
3
vendor/google.golang.org/api/googleapi/BUILD
generated
vendored
3
vendor/google.golang.org/api/googleapi/BUILD
generated
vendored
@ -9,7 +9,7 @@ go_library(
|
||||
importmap = "k8s.io/kubernetes/vendor/google.golang.org/api/googleapi",
|
||||
importpath = "google.golang.org/api/googleapi",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/google.golang.org/api/googleapi/internal/uritemplates:go_default_library"],
|
||||
deps = ["//vendor/google.golang.org/api/internal/third_party/uritemplates:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@ -23,7 +23,6 @@ filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//vendor/google.golang.org/api/googleapi/internal/uritemplates:all-srcs",
|
||||
"//vendor/google.golang.org/api/googleapi/transport:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
|
21
vendor/google.golang.org/api/googleapi/googleapi.go
generated
vendored
21
vendor/google.golang.org/api/googleapi/googleapi.go
generated
vendored
@ -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
|
||||
@ -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
|
||||
|
18
vendor/google.golang.org/api/googleapi/internal/uritemplates/LICENSE
generated
vendored
18
vendor/google.golang.org/api/googleapi/internal/uritemplates/LICENSE
generated
vendored
@ -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.
|
8
vendor/google.golang.org/api/googleapi/transport/apikey.go
generated
vendored
8
vendor/google.golang.org/api/googleapi/transport/apikey.go
generated
vendored
@ -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
|
||||
|
2
vendor/google.golang.org/api/googleapi/types.go
generated
vendored
2
vendor/google.golang.org/api/googleapi/types.go
generated
vendored
@ -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.
|
||||
|
||||
|
6
vendor/google.golang.org/api/internal/BUILD
generated
vendored
6
vendor/google.golang.org/api/internal/BUILD
generated
vendored
@ -27,7 +27,11 @@ filegroup(
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:all-srcs",
|
||||
"//vendor/google.golang.org/api/internal/third_party/uritemplates:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
16
vendor/google.golang.org/api/internal/creds.go
generated
vendored
16
vendor/google.golang.org/api/internal/creds.go
generated
vendored
@ -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
|
||||
|
||||
|
@ -3,22 +3,22 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"backoff.go",
|
||||
"buffer.go",
|
||||
"doc.go",
|
||||
"header.go",
|
||||
"json.go",
|
||||
"jsonfloat.go",
|
||||
"media.go",
|
||||
"params.go",
|
||||
"resumable.go",
|
||||
"retry.go",
|
||||
"send.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/google.golang.org/api/gensupport",
|
||||
importpath = "google.golang.org/api/gensupport",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/google.golang.org/api/googleapi:go_default_library"],
|
||||
importmap = "k8s.io/kubernetes/vendor/google.golang.org/api/internal/gensupport",
|
||||
importpath = "google.golang.org/api/internal/gensupport",
|
||||
visibility = ["//vendor/google.golang.org/api:__subpackages__"],
|
||||
deps = [
|
||||
"//vendor/github.com/googleapis/gax-go/v2:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
@ -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
|
||||
|
@ -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
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
16
vendor/google.golang.org/api/internal/pool.go
generated
vendored
16
vendor/google.golang.org/api/internal/pool.go
generated
vendored
@ -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
|
||||
|
||||
|
43
vendor/google.golang.org/api/internal/settings.go
generated
vendored
43
vendor/google.golang.org/api/internal/settings.go
generated
vendored
@ -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,20 @@ 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
|
||||
NoAuth bool
|
||||
TelemetryDisabled bool
|
||||
|
||||
// Google API system parameters. For more information please read:
|
||||
// https://cloud.google.com/apis/docs/system-parameters
|
||||
|
@ -6,9 +6,9 @@ go_library(
|
||||
"uritemplates.go",
|
||||
"utils.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/google.golang.org/api/googleapi/internal/uritemplates",
|
||||
importpath = "google.golang.org/api/googleapi/internal/uritemplates",
|
||||
visibility = ["//vendor/google.golang.org/api/googleapi:__subpackages__"],
|
||||
importmap = "k8s.io/kubernetes/vendor/google.golang.org/api/internal/third_party/uritemplates",
|
||||
importpath = "google.golang.org/api/internal/third_party/uritemplates",
|
||||
visibility = ["//vendor/google.golang.org/api:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
27
vendor/google.golang.org/api/internal/third_party/uritemplates/LICENSE
generated
vendored
Normal file
27
vendor/google.golang.org/api/internal/third_party/uritemplates/LICENSE
generated
vendored
Normal 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.
|
14
vendor/google.golang.org/api/internal/third_party/uritemplates/METADATA
generated
vendored
Normal file
14
vendor/google.golang.org/api/internal/third_party/uritemplates/METADATA
generated
vendored
Normal 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
|
||||
}
|
@ -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
|
||||
}
|
2
vendor/google.golang.org/api/logging/v2beta1/BUILD
generated
vendored
2
vendor/google.golang.org/api/logging/v2beta1/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/logging/v2beta1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
2
vendor/google.golang.org/api/logging/v2beta1/logging-gen.go
generated
vendored
2
vendor/google.golang.org/api/logging/v2beta1/logging-gen.go
generated
vendored
@ -55,8 +55,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
gensupport "google.golang.org/api/gensupport"
|
||||
googleapi "google.golang.org/api/googleapi"
|
||||
gensupport "google.golang.org/api/internal/gensupport"
|
||||
option "google.golang.org/api/option"
|
||||
htransport "google.golang.org/api/transport/http"
|
||||
)
|
||||
|
2
vendor/google.golang.org/api/monitoring/v3/BUILD
generated
vendored
2
vendor/google.golang.org/api/monitoring/v3/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/monitoring/v3",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
968
vendor/google.golang.org/api/monitoring/v3/monitoring-api.json
generated
vendored
968
vendor/google.golang.org/api/monitoring/v3/monitoring-api.json
generated
vendored
File diff suppressed because it is too large
Load Diff
3053
vendor/google.golang.org/api/monitoring/v3/monitoring-gen.go
generated
vendored
3053
vendor/google.golang.org/api/monitoring/v3/monitoring-gen.go
generated
vendored
File diff suppressed because it is too large
Load Diff
16
vendor/google.golang.org/api/option/credentials_go19.go
generated
vendored
16
vendor/google.golang.org/api/option/credentials_go19.go
generated
vendored
@ -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
|
||||
|
||||
|
16
vendor/google.golang.org/api/option/credentials_notgo19.go
generated
vendored
16
vendor/google.golang.org/api/option/credentials_notgo19.go
generated
vendored
@ -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
|
||||
|
||||
|
31
vendor/google.golang.org/api/option/option.go
generated
vendored
31
vendor/google.golang.org/api/option/option.go
generated
vendored
@ -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.
|
||||
@ -233,3 +223,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
|
||||
}
|
||||
|
2
vendor/google.golang.org/api/pubsub/v1/BUILD
generated
vendored
2
vendor/google.golang.org/api/pubsub/v1/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/pubsub/v1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
65
vendor/google.golang.org/api/pubsub/v1/pubsub-api.json
generated
vendored
65
vendor/google.golang.org/api/pubsub/v1/pubsub-api.json
generated
vendored
@ -120,7 +120,7 @@
|
||||
],
|
||||
"parameters": {
|
||||
"name": {
|
||||
"description": "Optional user-provided name for this snapshot.\nIf the name is not provided in the request, the server will assign a random\nname for this snapshot on the same project as the subscription.\nNote that for REST API requests, you must specify a name. See the\n\u003ca href=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e\nresource name rules\u003c/a\u003e.\nFormat is `projects/{project}/snapshots/{snap}`.",
|
||||
"description": "User-provided name for this snapshot. If the name is not provided in the\nrequest, the server will assign a random name for this snapshot on the same\nproject as the subscription. Note that for REST API requests, you must\nspecify a name. See the \u003ca\nhref=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e resource\nname rules\u003c/a\u003e. Format is `projects/{project}/snapshots/{snap}`.",
|
||||
"location": "path",
|
||||
"pattern": "^projects/[^/]+/snapshots/[^/]+$",
|
||||
"required": true,
|
||||
@ -200,6 +200,12 @@
|
||||
"resource"
|
||||
],
|
||||
"parameters": {
|
||||
"options.requestedPolicyVersion": {
|
||||
"description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
|
||||
"format": "int32",
|
||||
"location": "query",
|
||||
"type": "integer"
|
||||
},
|
||||
"resource": {
|
||||
"description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
|
||||
"location": "path",
|
||||
@ -284,7 +290,7 @@
|
||||
]
|
||||
},
|
||||
"setIamPolicy": {
|
||||
"description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
|
||||
"description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
|
||||
"flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:setIamPolicy",
|
||||
"httpMethod": "POST",
|
||||
"id": "pubsub.projects.snapshots.setIamPolicy",
|
||||
@ -464,6 +470,12 @@
|
||||
"resource"
|
||||
],
|
||||
"parameters": {
|
||||
"options.requestedPolicyVersion": {
|
||||
"description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
|
||||
"format": "int32",
|
||||
"location": "query",
|
||||
"type": "integer"
|
||||
},
|
||||
"resource": {
|
||||
"description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
|
||||
"location": "path",
|
||||
@ -664,7 +676,7 @@
|
||||
]
|
||||
},
|
||||
"setIamPolicy": {
|
||||
"description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
|
||||
"description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
|
||||
"flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy",
|
||||
"httpMethod": "POST",
|
||||
"id": "pubsub.projects.subscriptions.setIamPolicy",
|
||||
@ -815,6 +827,12 @@
|
||||
"resource"
|
||||
],
|
||||
"parameters": {
|
||||
"options.requestedPolicyVersion": {
|
||||
"description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
|
||||
"format": "int32",
|
||||
"location": "query",
|
||||
"type": "integer"
|
||||
},
|
||||
"resource": {
|
||||
"description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
|
||||
"location": "path",
|
||||
@ -928,7 +946,7 @@
|
||||
]
|
||||
},
|
||||
"setIamPolicy": {
|
||||
"description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
|
||||
"description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
|
||||
"flatPath": "v1/projects/{projectsId}/topics/{topicsId}:setIamPolicy",
|
||||
"httpMethod": "POST",
|
||||
"id": "pubsub.projects.topics.setIamPolicy",
|
||||
@ -1074,7 +1092,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"revision": "20190429",
|
||||
"revision": "20191203",
|
||||
"rootUrl": "https://pubsub.googleapis.com/",
|
||||
"schemas": {
|
||||
"AcknowledgeRequest": {
|
||||
@ -1100,7 +1118,7 @@
|
||||
"description": "The condition that is associated with this binding.\nNOTE: An unsatisfied condition will not allow user access via current\nbinding. Different bindings, including their conditions, are examined\nindependently."
|
||||
},
|
||||
"members": {
|
||||
"description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` .\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n\n* `domain:{domain}`: The G Suite domain (primary) that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n",
|
||||
"description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@example.com` .\n\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique\n identifier) representing a user that has been recently deleted. For\n example, `alice@example.com?uid=123456789012345678901`. If the user is\n recovered, this value reverts to `user:{emailid}` and the recovered user\n retains the role in the binding.\n\n* `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus\n unique identifier) representing a service account that has been recently\n deleted. For example,\n `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.\n If the service account is undeleted, this value reverts to\n `serviceAccount:{emailid}` and the undeleted service account retains the\n role in the binding.\n\n* `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique\n identifier) representing a Google group that has been recently\n deleted. For example, `admins@example.com?uid=123456789012345678901`. If\n the group is recovered, this value reverts to `group:{emailid}` and the\n recovered group retains the role in the binding.\n\n\n* `domain:{domain}`: The G Suite domain (primary) that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -1262,6 +1280,19 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"MessageStoragePolicy": {
|
||||
"id": "MessageStoragePolicy",
|
||||
"properties": {
|
||||
"allowedPersistenceRegions": {
|
||||
"description": "A list of IDs of GCP regions where messages that are published to the topic\nmay be persisted in storage. Messages published by publishers running in\nnon-allowed GCP regions (or running outside of GCP altogether) will be\nrouted for storage in one of the allowed regions. An empty list means that\nno regions are allowed, and is not a valid configuration.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"ModifyAckDeadlineRequest": {
|
||||
"description": "Request for the ModifyAckDeadline method.",
|
||||
"id": "ModifyAckDeadlineRequest",
|
||||
@ -1308,23 +1339,23 @@
|
||||
"type": "object"
|
||||
},
|
||||
"Policy": {
|
||||
"description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**JSON Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\"\n ]\n },\n {\n \"role\": \"roles/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\n**YAML Example**\n\n bindings:\n - members:\n - user:mike@example.com\n - group:admins@example.com\n - domain:google.com\n - serviceAccount:my-other-app@appspot.gserviceaccount.com\n role: roles/owner\n - members:\n - user:sean@example.com\n role: roles/viewer\n\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https://cloud.google.com/iam/docs).",
|
||||
"description": "An Identity and Access Management (IAM) policy, which specifies access\ncontrols for Google Cloud resources.\n\n\nA `Policy` is a collection of `bindings`. A `binding` binds one or more\n`members` to a single `role`. Members can be user accounts, service accounts,\nGoogle groups, and domains (such as G Suite). A `role` is a named list of\npermissions; each `role` can be an IAM predefined role or a user-created\ncustom role.\n\nOptionally, a `binding` can specify a `condition`, which is a logical\nexpression that allows access to a resource only if the expression evaluates\nto `true`. A condition can add constraints based on attributes of the\nrequest, the resource, or both.\n\n**JSON example:**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles/resourcemanager.organizationAdmin\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-project-id@appspot.gserviceaccount.com\"\n ]\n },\n {\n \"role\": \"roles/resourcemanager.organizationViewer\",\n \"members\": [\"user:eve@example.com\"],\n \"condition\": {\n \"title\": \"expirable access\",\n \"description\": \"Does not grant access after Sep 2020\",\n \"expression\": \"request.time \u003c timestamp('2020-10-01T00:00:00.000Z')\",\n }\n }\n ],\n \"etag\": \"BwWWja0YfJA=\",\n \"version\": 3\n }\n\n**YAML example:**\n\n bindings:\n - members:\n - user:mike@example.com\n - group:admins@example.com\n - domain:google.com\n - serviceAccount:my-project-id@appspot.gserviceaccount.com\n role: roles/resourcemanager.organizationAdmin\n - members:\n - user:eve@example.com\n role: roles/resourcemanager.organizationViewer\n condition:\n title: expirable access\n description: Does not grant access after Sep 2020\n expression: request.time \u003c timestamp('2020-10-01T00:00:00.000Z')\n - etag: BwWWja0YfJA=\n - version: 3\n\nFor a description of IAM and its features, see the\n[IAM documentation](https://cloud.google.com/iam/docs/).",
|
||||
"id": "Policy",
|
||||
"properties": {
|
||||
"bindings": {
|
||||
"description": "Associates a list of `members` to a `role`.\n`bindings` with no members will result in an error.",
|
||||
"description": "Associates a list of `members` to a `role`. Optionally, may specify a\n`condition` that determines how and when the `bindings` are applied. Each\nof the `bindings` must contain at least one member.",
|
||||
"items": {
|
||||
"$ref": "Binding"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"etag": {
|
||||
"description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.",
|
||||
"description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\n**Important:** If you use IAM Conditions, you must include the `etag` field\nwhenever you call `setIamPolicy`. If you omit this field, then IAM allows\nyou to overwrite a version `3` policy with a version `1` policy, and all of\nthe conditions in the version `3` policy are lost.",
|
||||
"format": "byte",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "Deprecated.",
|
||||
"description": "Specifies the format of the policy.\n\nValid values are `0`, `1`, and `3`. Requests that specify an invalid value\nare rejected.\n\nAny operation that affects conditional role bindings must specify version\n`3`. This requirement applies to the following operations:\n\n* Getting a policy that includes a conditional role binding\n* Adding a conditional role binding to a policy\n* Changing a conditional role binding in a policy\n* Removing any role binding, with or without a condition, from a policy\n that includes conditions\n\n**Important:** If you use IAM Conditions, you must include the `etag` field\nwhenever you call `setIamPolicy`. If you omit this field, then IAM allows\nyou to overwrite a version `3` policy with a version `1` policy, and all of\nthe conditions in the version `3` policy are lost.\n\nIf a policy does not include any conditions, operations on that policy may\nspecify any valid version or leave the field unset.",
|
||||
"format": "int32",
|
||||
"type": "integer"
|
||||
}
|
||||
@ -1367,7 +1398,7 @@
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Optional attributes for this message.",
|
||||
"description": "Attributes for this message. If this field is empty, the message must\ncontain non-empty data.",
|
||||
"type": "object"
|
||||
},
|
||||
"data": {
|
||||
@ -1392,7 +1423,7 @@
|
||||
"id": "PullRequest",
|
||||
"properties": {
|
||||
"maxMessages": {
|
||||
"description": "The maximum number of messages returned for this request. The Pub/Sub\nsystem may return fewer than the number specified.",
|
||||
"description": "The maximum number of messages to return for this request. Must be a\npositive integer. The Pub/Sub system may return fewer than the number\nspecified.",
|
||||
"format": "int32",
|
||||
"type": "integer"
|
||||
},
|
||||
@ -1425,7 +1456,7 @@
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Endpoint configuration attributes.\n\nEvery endpoint has a set of API supported attributes that can be used to\ncontrol different aspects of the message delivery.\n\nThe currently supported attribute is `x-goog-version`, which you can\nuse to change the format of the pushed message. This attribute\nindicates the version of the data expected by the endpoint. This\ncontrols the shape of the pushed message (i.e., its fields and metadata).\nThe endpoint version is based on the version of the Pub/Sub API.\n\nIf not present during the `CreateSubscription` call, it will default to\nthe version of the API used to make such call. If not present during a\n`ModifyPushConfig` call, its value will not be changed. `GetSubscription`\ncalls will always return a valid version, even if the subscription was\ncreated without this attribute.\n\nThe possible values for this attribute are:\n\n* `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.\n* `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.",
|
||||
"description": "Endpoint configuration attributes that can be used to control different\naspects of the message delivery.\n\nThe only currently supported attribute is `x-goog-version`, which you can\nuse to change the format of the pushed message. This attribute\nindicates the version of the data expected by the endpoint. This\ncontrols the shape of the pushed message (i.e., its fields and metadata).\n\nIf not present during the `CreateSubscription` call, it will default to\nthe version of the Pub/Sub API used to make such call. If not present in a\n`ModifyPushConfig` call, its value will not be changed. `GetSubscription`\ncalls will always return a valid version, even if the subscription was\ncreated without this attribute.\n\nThe only supported values for the `x-goog-version` attribute are:\n\n* `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.\n* `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.\n\nFor example:\n\u003cpre\u003e\u003ccode\u003eattributes { \"x-goog-version\": \"v1\" } \u003c/code\u003e\u003c/pre\u003e",
|
||||
"type": "object"
|
||||
},
|
||||
"oidcToken": {
|
||||
@ -1590,6 +1621,10 @@
|
||||
"description": "A topic resource.",
|
||||
"id": "Topic",
|
||||
"properties": {
|
||||
"kmsKeyName": {
|
||||
"description": "The resource name of the Cloud KMS CryptoKey to be used to protect access\nto messages published on this topic.\n\nThe expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.",
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
@ -1597,6 +1632,10 @@
|
||||
"description": "See \u003ca href=\"https://cloud.google.com/pubsub/docs/labels\"\u003e Creating and\nmanaging labels\u003c/a\u003e.",
|
||||
"type": "object"
|
||||
},
|
||||
"messageStoragePolicy": {
|
||||
"$ref": "MessageStoragePolicy",
|
||||
"description": "Policy constraining the set of Google Cloud Platform regions where messages\npublished to the topic may be stored. If not present, then no constraints\nare in effect."
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.",
|
||||
"type": "string"
|
||||
|
363
vendor/google.golang.org/api/pubsub/v1/pubsub-gen.go
generated
vendored
363
vendor/google.golang.org/api/pubsub/v1/pubsub-gen.go
generated
vendored
@ -55,8 +55,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
gensupport "google.golang.org/api/gensupport"
|
||||
googleapi "google.golang.org/api/googleapi"
|
||||
gensupport "google.golang.org/api/internal/gensupport"
|
||||
option "google.golang.org/api/option"
|
||||
htransport "google.golang.org/api/transport/http"
|
||||
)
|
||||
@ -263,7 +263,7 @@ type Binding struct {
|
||||
//
|
||||
// * `user:{emailid}`: An email address that represents a specific
|
||||
// Google
|
||||
// account. For example, `alice@gmail.com` .
|
||||
// account. For example, `alice@example.com` .
|
||||
//
|
||||
//
|
||||
// * `serviceAccount:{emailid}`: An email address that represents a
|
||||
@ -275,6 +275,38 @@ type Binding struct {
|
||||
// group.
|
||||
// For example, `admins@example.com`.
|
||||
//
|
||||
// * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus
|
||||
// unique
|
||||
// identifier) representing a user that has been recently deleted.
|
||||
// For
|
||||
// example, `alice@example.com?uid=123456789012345678901`. If the
|
||||
// user is
|
||||
// recovered, this value reverts to `user:{emailid}` and the
|
||||
// recovered user
|
||||
// retains the role in the binding.
|
||||
//
|
||||
// * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address
|
||||
// (plus
|
||||
// unique identifier) representing a service account that has been
|
||||
// recently
|
||||
// deleted. For example,
|
||||
//
|
||||
// `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
|
||||
//
|
||||
// If the service account is undeleted, this value reverts to
|
||||
// `serviceAccount:{emailid}` and the undeleted service account
|
||||
// retains the
|
||||
// role in the binding.
|
||||
//
|
||||
// * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus
|
||||
// unique
|
||||
// identifier) representing a Google group that has been recently
|
||||
// deleted. For example,
|
||||
// `admins@example.com?uid=123456789012345678901`. If
|
||||
// the group is recovered, this value reverts to `group:{emailid}`
|
||||
// and the
|
||||
// recovered group retains the role in the binding.
|
||||
//
|
||||
//
|
||||
// * `domain:{domain}`: The G Suite domain (primary) that represents all
|
||||
// the
|
||||
@ -661,6 +693,43 @@ func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
|
||||
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
|
||||
}
|
||||
|
||||
type MessageStoragePolicy struct {
|
||||
// AllowedPersistenceRegions: A list of IDs of GCP regions where
|
||||
// messages that are published to the topic
|
||||
// may be persisted in storage. Messages published by publishers running
|
||||
// in
|
||||
// non-allowed GCP regions (or running outside of GCP altogether) will
|
||||
// be
|
||||
// routed for storage in one of the allowed regions. An empty list means
|
||||
// that
|
||||
// no regions are allowed, and is not a valid configuration.
|
||||
AllowedPersistenceRegions []string `json:"allowedPersistenceRegions,omitempty"`
|
||||
|
||||
// ForceSendFields is a list of field names (e.g.
|
||||
// "AllowedPersistenceRegions") to unconditionally include in API
|
||||
// requests. By default, fields with empty values are omitted from API
|
||||
// requests. However, any non-pointer, non-interface field appearing in
|
||||
// ForceSendFields will be sent to the server regardless of whether the
|
||||
// field is empty or not. This may be used to include empty fields in
|
||||
// Patch requests.
|
||||
ForceSendFields []string `json:"-"`
|
||||
|
||||
// NullFields is a list of field names (e.g.
|
||||
// "AllowedPersistenceRegions") to include in API requests with the JSON
|
||||
// null value. By default, fields with empty values are omitted from API
|
||||
// requests. However, any field with an empty value appearing in
|
||||
// NullFields will be sent to the server as null. It is an error if a
|
||||
// field in this list has a non-empty value. This may be used to include
|
||||
// null fields in Patch requests.
|
||||
NullFields []string `json:"-"`
|
||||
}
|
||||
|
||||
func (s *MessageStoragePolicy) MarshalJSON() ([]byte, error) {
|
||||
type NoMethod MessageStoragePolicy
|
||||
raw := NoMethod(*s)
|
||||
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
|
||||
}
|
||||
|
||||
// ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method.
|
||||
type ModifyAckDeadlineRequest struct {
|
||||
// AckDeadlineSeconds: The new ack deadline with respect to the time
|
||||
@ -791,59 +860,86 @@ func (s *OidcToken) MarshalJSON() ([]byte, error) {
|
||||
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
|
||||
}
|
||||
|
||||
// Policy: Defines an Identity and Access Management (IAM) policy. It is
|
||||
// used to
|
||||
// specify access control policies for Cloud Platform resources.
|
||||
// Policy: An Identity and Access Management (IAM) policy, which
|
||||
// specifies access
|
||||
// controls for Google Cloud 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.
|
||||
// A `Policy` is a collection of `bindings`. A `binding` binds one or
|
||||
// more
|
||||
// `members` to a single `role`. Members can be user accounts, service
|
||||
// accounts,
|
||||
// Google groups, and domains (such as G Suite). A `role` is a named
|
||||
// list of
|
||||
// permissions; each `role` can be an IAM predefined role or a
|
||||
// user-created
|
||||
// custom role.
|
||||
//
|
||||
// **JSON Example**
|
||||
// Optionally, a `binding` can specify a `condition`, which is a
|
||||
// logical
|
||||
// expression that allows access to a resource only if the expression
|
||||
// evaluates
|
||||
// to `true`. A condition can add constraints based on attributes of
|
||||
// the
|
||||
// request, the resource, or both.
|
||||
//
|
||||
// **JSON example:**
|
||||
//
|
||||
// {
|
||||
// "bindings": [
|
||||
// {
|
||||
// "role": "roles/owner",
|
||||
// "role": "roles/resourcemanager.organizationAdmin",
|
||||
// "members": [
|
||||
// "user:mike@example.com",
|
||||
// "group:admins@example.com",
|
||||
// "domain:google.com",
|
||||
//
|
||||
// "serviceAccount:my-other-app@appspot.gserviceaccount.com"
|
||||
// "serviceAccount:my-project-id@appspot.gserviceaccount.com"
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "role": "roles/viewer",
|
||||
// "members": ["user:sean@example.com"]
|
||||
// "role": "roles/resourcemanager.organizationViewer",
|
||||
// "members": ["user:eve@example.com"],
|
||||
// "condition": {
|
||||
// "title": "expirable access",
|
||||
// "description": "Does not grant access after Sep 2020",
|
||||
// "expression": "request.time <
|
||||
// timestamp('2020-10-01T00:00:00.000Z')",
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// ],
|
||||
// "etag": "BwWWja0YfJA=",
|
||||
// "version": 3
|
||||
// }
|
||||
//
|
||||
// **YAML Example**
|
||||
// **YAML example:**
|
||||
//
|
||||
// bindings:
|
||||
// - members:
|
||||
// - user:mike@example.com
|
||||
// - group:admins@example.com
|
||||
// - domain:google.com
|
||||
// - serviceAccount:my-other-app@appspot.gserviceaccount.com
|
||||
// role: roles/owner
|
||||
// - serviceAccount:my-project-id@appspot.gserviceaccount.com
|
||||
// role: roles/resourcemanager.organizationAdmin
|
||||
// - members:
|
||||
// - user:sean@example.com
|
||||
// role: roles/viewer
|
||||
//
|
||||
// - user:eve@example.com
|
||||
// role: roles/resourcemanager.organizationViewer
|
||||
// condition:
|
||||
// title: expirable access
|
||||
// description: Does not grant access after Sep 2020
|
||||
// expression: request.time <
|
||||
// timestamp('2020-10-01T00:00:00.000Z')
|
||||
// - etag: BwWWja0YfJA=
|
||||
// - version: 3
|
||||
//
|
||||
// For a description of IAM and its features, see the
|
||||
// [IAM developer's guide](https://cloud.google.com/iam/docs).
|
||||
// [IAM documentation](https://cloud.google.com/iam/docs/).
|
||||
type Policy struct {
|
||||
// Bindings: Associates a list of `members` to a `role`.
|
||||
// `bindings` with no members will result in an error.
|
||||
// Bindings: Associates a list of `members` to a `role`. Optionally, may
|
||||
// specify a
|
||||
// `condition` that determines how and when the `bindings` are applied.
|
||||
// Each
|
||||
// of the `bindings` must contain at least one member.
|
||||
Bindings []*Binding `json:"bindings,omitempty"`
|
||||
|
||||
// Etag: `etag` is used for optimistic concurrency control as a way to
|
||||
@ -861,12 +957,43 @@ type Policy struct {
|
||||
// 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.
|
||||
// **Important:** If you use IAM Conditions, you must include the `etag`
|
||||
// field
|
||||
// whenever you call `setIamPolicy`. If you omit this field, then IAM
|
||||
// allows
|
||||
// you to overwrite a version `3` policy with a version `1` policy, and
|
||||
// all of
|
||||
// the conditions in the version `3` policy are lost.
|
||||
Etag string `json:"etag,omitempty"`
|
||||
|
||||
// Version: Deprecated.
|
||||
// Version: Specifies the format of the policy.
|
||||
//
|
||||
// Valid values are `0`, `1`, and `3`. Requests that specify an invalid
|
||||
// value
|
||||
// are rejected.
|
||||
//
|
||||
// Any operation that affects conditional role bindings must specify
|
||||
// version
|
||||
// `3`. This requirement applies to the following operations:
|
||||
//
|
||||
// * Getting a policy that includes a conditional role binding
|
||||
// * Adding a conditional role binding to a policy
|
||||
// * Changing a conditional role binding in a policy
|
||||
// * Removing any role binding, with or without a condition, from a
|
||||
// policy
|
||||
// that includes conditions
|
||||
//
|
||||
// **Important:** If you use IAM Conditions, you must include the `etag`
|
||||
// field
|
||||
// whenever you call `setIamPolicy`. If you omit this field, then IAM
|
||||
// allows
|
||||
// you to overwrite a version `3` policy with a version `1` policy, and
|
||||
// all of
|
||||
// the conditions in the version `3` policy are lost.
|
||||
//
|
||||
// If a policy does not include any conditions, operations on that
|
||||
// policy may
|
||||
// specify any valid version or leave the field unset.
|
||||
Version int64 `json:"version,omitempty"`
|
||||
|
||||
// ServerResponse contains the HTTP response code and headers from the
|
||||
@ -975,7 +1102,9 @@ func (s *PublishResponse) MarshalJSON() ([]byte, error) {
|
||||
// limits</a>
|
||||
// for more information about message limits.
|
||||
type PubsubMessage struct {
|
||||
// Attributes: Optional attributes for this message.
|
||||
// Attributes: Attributes for this message. If this field is empty, the
|
||||
// message must
|
||||
// contain non-empty data.
|
||||
Attributes map[string]string `json:"attributes,omitempty"`
|
||||
|
||||
// Data: The message data field. If this field is empty, the message
|
||||
@ -1025,9 +1154,11 @@ func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
|
||||
|
||||
// PullRequest: Request for the `Pull` method.
|
||||
type PullRequest struct {
|
||||
// MaxMessages: The maximum number of messages returned for this
|
||||
// request. The Pub/Sub
|
||||
// system may return fewer than the number specified.
|
||||
// MaxMessages: The maximum number of messages to return for this
|
||||
// request. Must be a
|
||||
// positive integer. The Pub/Sub system may return fewer than the
|
||||
// number
|
||||
// specified.
|
||||
MaxMessages int64 `json:"maxMessages,omitempty"`
|
||||
|
||||
// ReturnImmediately: If this field set to true, the system will respond
|
||||
@ -1103,13 +1234,11 @@ func (s *PullResponse) MarshalJSON() ([]byte, error) {
|
||||
|
||||
// PushConfig: Configuration for a push delivery endpoint.
|
||||
type PushConfig struct {
|
||||
// Attributes: Endpoint configuration attributes.
|
||||
// Attributes: Endpoint configuration attributes that can be used to
|
||||
// control different
|
||||
// aspects of the message delivery.
|
||||
//
|
||||
// Every endpoint has a set of API supported attributes that can be used
|
||||
// to
|
||||
// control different aspects of the message delivery.
|
||||
//
|
||||
// The currently supported attribute is `x-goog-version`, which you
|
||||
// The only currently supported attribute is `x-goog-version`, which you
|
||||
// can
|
||||
// use to change the format of the pushed message. This
|
||||
// attribute
|
||||
@ -1117,24 +1246,26 @@ type PushConfig struct {
|
||||
// This
|
||||
// controls the shape of the pushed message (i.e., its fields and
|
||||
// metadata).
|
||||
// The endpoint version is based on the version of the Pub/Sub API.
|
||||
//
|
||||
// If not present during the `CreateSubscription` call, it will default
|
||||
// to
|
||||
// the version of the API used to make such call. If not present during
|
||||
// a
|
||||
// the version of the Pub/Sub API used to make such call. If not present
|
||||
// in a
|
||||
// `ModifyPushConfig` call, its value will not be changed.
|
||||
// `GetSubscription`
|
||||
// calls will always return a valid version, even if the subscription
|
||||
// was
|
||||
// created without this attribute.
|
||||
//
|
||||
// The possible values for this attribute are:
|
||||
// The only supported values for the `x-goog-version` attribute are:
|
||||
//
|
||||
// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub
|
||||
// API.
|
||||
// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub
|
||||
// API.
|
||||
//
|
||||
// For example:
|
||||
// <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
|
||||
Attributes map[string]string `json:"attributes,omitempty"`
|
||||
|
||||
// OidcToken: If specified, Pub/Sub will generate and attach an OIDC JWT
|
||||
@ -1570,11 +1701,26 @@ func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
|
||||
|
||||
// Topic: A topic resource.
|
||||
type Topic struct {
|
||||
// KmsKeyName: The resource name of the Cloud KMS CryptoKey to be used
|
||||
// to protect access
|
||||
// to messages published on this topic.
|
||||
//
|
||||
// The expected format is
|
||||
// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
|
||||
KmsKeyName string `json:"kmsKeyName,omitempty"`
|
||||
|
||||
// Labels: See <a href="https://cloud.google.com/pubsub/docs/labels">
|
||||
// Creating and
|
||||
// managing labels</a>.
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
|
||||
// MessageStoragePolicy: Policy constraining the set of Google Cloud
|
||||
// Platform regions where messages
|
||||
// published to the topic may be stored. If not present, then no
|
||||
// constraints
|
||||
// are in effect.
|
||||
MessageStoragePolicy *MessageStoragePolicy `json:"messageStoragePolicy,omitempty"`
|
||||
|
||||
// Name: The name of the topic. It must have the
|
||||
// format
|
||||
// "projects/{project}/topics/{topic}". `{topic}` must start with a
|
||||
@ -1592,7 +1738,7 @@ type Topic struct {
|
||||
// server.
|
||||
googleapi.ServerResponse `json:"-"`
|
||||
|
||||
// ForceSendFields is a list of field names (e.g. "Labels") to
|
||||
// ForceSendFields is a list of field names (e.g. "KmsKeyName") to
|
||||
// unconditionally include in API requests. By default, fields with
|
||||
// empty values are omitted from API requests. However, any non-pointer,
|
||||
// non-interface field appearing in ForceSendFields will be sent to the
|
||||
@ -1600,8 +1746,8 @@ type Topic struct {
|
||||
// used to include empty fields in Patch requests.
|
||||
ForceSendFields []string `json:"-"`
|
||||
|
||||
// NullFields is a list of field names (e.g. "Labels") to include in API
|
||||
// requests with the JSON null value. By default, fields with empty
|
||||
// NullFields is a list of field names (e.g. "KmsKeyName") to include in
|
||||
// API requests with the JSON null value. By default, fields with empty
|
||||
// values are omitted from API requests. However, any field with an
|
||||
// empty value appearing in NullFields will be sent to the server as
|
||||
// null. It is an error if a field in this list has a non-empty value.
|
||||
@ -1796,6 +1942,7 @@ func (c *ProjectsSnapshotsCreateCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsCreateCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -1868,7 +2015,7 @@ func (c *ProjectsSnapshotsCreateCall) Do(opts ...googleapi.CallOption) (*Snapsho
|
||||
// ],
|
||||
// "parameters": {
|
||||
// "name": {
|
||||
// "description": "Optional user-provided name for this snapshot.\nIf the name is not provided in the request, the server will assign a random\nname for this snapshot on the same project as the subscription.\nNote that for REST API requests, you must specify a name. See the\n\u003ca href=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e\nresource name rules\u003c/a\u003e.\nFormat is `projects/{project}/snapshots/{snap}`.",
|
||||
// "description": "User-provided name for this snapshot. If the name is not provided in the\nrequest, the server will assign a random name for this snapshot on the same\nproject as the subscription. Note that for REST API requests, you must\nspecify a name. See the \u003ca\nhref=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e resource\nname rules\u003c/a\u003e. Format is `projects/{project}/snapshots/{snap}`.",
|
||||
// "location": "path",
|
||||
// "pattern": "^projects/[^/]+/snapshots/[^/]+$",
|
||||
// "required": true,
|
||||
@ -1951,6 +2098,7 @@ func (c *ProjectsSnapshotsDeleteCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsDeleteCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2101,6 +2249,7 @@ func (c *ProjectsSnapshotsGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2211,6 +2360,24 @@ func (r *ProjectsSnapshotsService) GetIamPolicy(resource string) *ProjectsSnapsh
|
||||
return c
|
||||
}
|
||||
|
||||
// OptionsRequestedPolicyVersion sets the optional parameter
|
||||
// "options.requestedPolicyVersion": The policy format version to be
|
||||
// returned.
|
||||
//
|
||||
// Valid values are 0, 1, and 3. Requests specifying an invalid value
|
||||
// will be
|
||||
// rejected.
|
||||
//
|
||||
// Requests for policies with any conditional bindings must specify
|
||||
// version 3.
|
||||
// Policies without any conditional bindings may specify any valid value
|
||||
// or
|
||||
// leave the field unset.
|
||||
func (c *ProjectsSnapshotsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsSnapshotsGetIamPolicyCall {
|
||||
c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
|
||||
return c
|
||||
}
|
||||
|
||||
// Fields allows partial responses to be retrieved. See
|
||||
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
||||
// for more information.
|
||||
@ -2248,6 +2415,7 @@ func (c *ProjectsSnapshotsGetIamPolicyCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2317,6 +2485,12 @@ func (c *ProjectsSnapshotsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*P
|
||||
// "resource"
|
||||
// ],
|
||||
// "parameters": {
|
||||
// "options.requestedPolicyVersion": {
|
||||
// "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
|
||||
// "format": "int32",
|
||||
// "location": "query",
|
||||
// "type": "integer"
|
||||
// },
|
||||
// "resource": {
|
||||
// "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
|
||||
// "location": "path",
|
||||
@ -2418,6 +2592,7 @@ func (c *ProjectsSnapshotsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2594,6 +2769,7 @@ func (c *ProjectsSnapshotsPatchCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsPatchCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2702,6 +2878,9 @@ type ProjectsSnapshotsSetIamPolicyCall struct {
|
||||
// SetIamPolicy: Sets the access control policy on the specified
|
||||
// resource. Replaces any
|
||||
// existing policy.
|
||||
//
|
||||
// Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and
|
||||
// PERMISSION_DENIED
|
||||
func (r *ProjectsSnapshotsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSnapshotsSetIamPolicyCall {
|
||||
c := &ProjectsSnapshotsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
|
||||
c.resource = resource
|
||||
@ -2736,6 +2915,7 @@ func (c *ProjectsSnapshotsSetIamPolicyCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2799,7 +2979,7 @@ func (c *ProjectsSnapshotsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*P
|
||||
}
|
||||
return ret, nil
|
||||
// {
|
||||
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
|
||||
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
|
||||
// "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:setIamPolicy",
|
||||
// "httpMethod": "POST",
|
||||
// "id": "pubsub.projects.snapshots.setIamPolicy",
|
||||
@ -2886,6 +3066,7 @@ func (c *ProjectsSnapshotsTestIamPermissionsCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSnapshotsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3036,6 +3217,7 @@ func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3195,6 +3377,7 @@ func (c *ProjectsSubscriptionsCreateCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3341,6 +3524,7 @@ func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3482,6 +3666,7 @@ func (c *ProjectsSubscriptionsGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3592,6 +3777,24 @@ func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSu
|
||||
return c
|
||||
}
|
||||
|
||||
// OptionsRequestedPolicyVersion sets the optional parameter
|
||||
// "options.requestedPolicyVersion": The policy format version to be
|
||||
// returned.
|
||||
//
|
||||
// Valid values are 0, 1, and 3. Requests specifying an invalid value
|
||||
// will be
|
||||
// rejected.
|
||||
//
|
||||
// Requests for policies with any conditional bindings must specify
|
||||
// version 3.
|
||||
// Policies without any conditional bindings may specify any valid value
|
||||
// or
|
||||
// leave the field unset.
|
||||
func (c *ProjectsSubscriptionsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsSubscriptionsGetIamPolicyCall {
|
||||
c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
|
||||
return c
|
||||
}
|
||||
|
||||
// Fields allows partial responses to be retrieved. See
|
||||
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
||||
// for more information.
|
||||
@ -3629,6 +3832,7 @@ func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3698,6 +3902,12 @@ func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption)
|
||||
// "resource"
|
||||
// ],
|
||||
// "parameters": {
|
||||
// "options.requestedPolicyVersion": {
|
||||
// "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
|
||||
// "format": "int32",
|
||||
// "location": "query",
|
||||
// "type": "integer"
|
||||
// },
|
||||
// "resource": {
|
||||
// "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
|
||||
// "location": "path",
|
||||
@ -3790,6 +4000,7 @@ func (c *ProjectsSubscriptionsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3965,6 +4176,7 @@ func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4115,6 +4327,7 @@ func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4257,6 +4470,7 @@ func (c *ProjectsSubscriptionsPatchCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsPatchCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4401,6 +4615,7 @@ func (c *ProjectsSubscriptionsPullCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4554,6 +4769,7 @@ func (c *ProjectsSubscriptionsSeekCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsSeekCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4662,6 +4878,9 @@ type ProjectsSubscriptionsSetIamPolicyCall struct {
|
||||
// SetIamPolicy: Sets the access control policy on the specified
|
||||
// resource. Replaces any
|
||||
// existing policy.
|
||||
//
|
||||
// Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and
|
||||
// PERMISSION_DENIED
|
||||
func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall {
|
||||
c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
|
||||
c.resource = resource
|
||||
@ -4696,6 +4915,7 @@ func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4759,7 +4979,7 @@ func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption)
|
||||
}
|
||||
return ret, nil
|
||||
// {
|
||||
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
|
||||
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
|
||||
// "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy",
|
||||
// "httpMethod": "POST",
|
||||
// "id": "pubsub.projects.subscriptions.setIamPolicy",
|
||||
@ -4846,6 +5066,7 @@ func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -4990,6 +5211,7 @@ func (c *ProjectsTopicsCreateCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -5136,6 +5358,7 @@ func (c *ProjectsTopicsDeleteCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -5277,6 +5500,7 @@ func (c *ProjectsTopicsGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -5387,6 +5611,24 @@ func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGet
|
||||
return c
|
||||
}
|
||||
|
||||
// OptionsRequestedPolicyVersion sets the optional parameter
|
||||
// "options.requestedPolicyVersion": The policy format version to be
|
||||
// returned.
|
||||
//
|
||||
// Valid values are 0, 1, and 3. Requests specifying an invalid value
|
||||
// will be
|
||||
// rejected.
|
||||
//
|
||||
// Requests for policies with any conditional bindings must specify
|
||||
// version 3.
|
||||
// Policies without any conditional bindings may specify any valid value
|
||||
// or
|
||||
// leave the field unset.
|
||||
func (c *ProjectsTopicsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsTopicsGetIamPolicyCall {
|
||||
c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
|
||||
return c
|
||||
}
|
||||
|
||||
// Fields allows partial responses to be retrieved. See
|
||||
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
||||
// for more information.
|
||||
@ -5424,6 +5666,7 @@ func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -5493,6 +5736,12 @@ func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Poli
|
||||
// "resource"
|
||||
// ],
|
||||
// "parameters": {
|
||||
// "options.requestedPolicyVersion": {
|
||||
// "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
|
||||
// "format": "int32",
|
||||
// "location": "query",
|
||||
// "type": "integer"
|
||||
// },
|
||||
// "resource": {
|
||||
// "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
|
||||
// "location": "path",
|
||||
@ -5585,6 +5834,7 @@ func (c *ProjectsTopicsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -5754,6 +6004,7 @@ func (c *ProjectsTopicsPatchCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsPatchCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -5896,6 +6147,7 @@ func (c *ProjectsTopicsPublishCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -6004,6 +6256,9 @@ type ProjectsTopicsSetIamPolicyCall struct {
|
||||
// SetIamPolicy: Sets the access control policy on the specified
|
||||
// resource. Replaces any
|
||||
// existing policy.
|
||||
//
|
||||
// Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and
|
||||
// PERMISSION_DENIED
|
||||
func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall {
|
||||
c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
|
||||
c.resource = resource
|
||||
@ -6038,6 +6293,7 @@ func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -6101,7 +6357,7 @@ func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Poli
|
||||
}
|
||||
return ret, nil
|
||||
// {
|
||||
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
|
||||
// "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
|
||||
// "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:setIamPolicy",
|
||||
// "httpMethod": "POST",
|
||||
// "id": "pubsub.projects.topics.setIamPolicy",
|
||||
@ -6188,6 +6444,7 @@ func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -6364,6 +6621,7 @@ func (c *ProjectsTopicsSnapshotsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsSnapshotsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -6557,6 +6815,7 @@ func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
|
2
vendor/google.golang.org/api/tpu/v1/BUILD
generated
vendored
2
vendor/google.golang.org/api/tpu/v1/BUILD
generated
vendored
@ -7,8 +7,8 @@ go_library(
|
||||
importpath = "google.golang.org/api/tpu/v1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/google.golang.org/api/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/googleapi:go_default_library",
|
||||
"//vendor/google.golang.org/api/internal/gensupport:go_default_library",
|
||||
"//vendor/google.golang.org/api/option:go_default_library",
|
||||
"//vendor/google.golang.org/api/transport/http:go_default_library",
|
||||
],
|
||||
|
32
vendor/google.golang.org/api/tpu/v1/tpu-api.json
generated
vendored
32
vendor/google.golang.org/api/tpu/v1/tpu-api.json
generated
vendored
@ -658,7 +658,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"revision": "20190509",
|
||||
"revision": "20190821",
|
||||
"rootUrl": "https://tpu.googleapis.com/",
|
||||
"schemas": {
|
||||
"AcceleratorType": {
|
||||
@ -696,6 +696,13 @@
|
||||
"nextPageToken": {
|
||||
"description": "The next page token or empty if none.",
|
||||
"type": "string"
|
||||
},
|
||||
"unreachable": {
|
||||
"description": "Locations that could not be reached.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@ -775,6 +782,13 @@
|
||||
"$ref": "TensorFlowVersion"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"unreachable": {
|
||||
"description": "Locations that could not be reached.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
@ -842,7 +856,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"description": "Output only.\nThe time when the node was created.",
|
||||
"description": "Output only. The time when the node was created.",
|
||||
"format": "google-datetime",
|
||||
"type": "string"
|
||||
},
|
||||
@ -871,11 +885,11 @@
|
||||
"type": "string"
|
||||
},
|
||||
"healthDescription": {
|
||||
"description": "Output only.\nIf this field is populated, it contains a description of why the TPU Node\nis unhealthy.",
|
||||
"description": "Output only. If this field is populated, it contains a description of why the TPU Node\nis unhealthy.",
|
||||
"type": "string"
|
||||
},
|
||||
"ipAddress": {
|
||||
"description": "Output only.\nDEPRECATED! Use network_endpoints instead.\nThe network address for the TPU Node as visible to Compute Engine\ninstances.",
|
||||
"description": "Output only. DEPRECATED! Use network_endpoints instead.\nThe network address for the TPU Node as visible to Compute Engine\ninstances.",
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
@ -886,7 +900,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"name": {
|
||||
"description": "Output only.\nThe immutable name of the TPU",
|
||||
"description": "Output only. The immutable name of the TPU",
|
||||
"type": "string"
|
||||
},
|
||||
"network": {
|
||||
@ -901,18 +915,18 @@
|
||||
"type": "array"
|
||||
},
|
||||
"port": {
|
||||
"description": "Output only.\nDEPRECATED! Use network_endpoints instead.\nThe network port for the TPU Node as visible to Compute Engine instances.",
|
||||
"description": "Output only. DEPRECATED! Use network_endpoints instead.\nThe network port for the TPU Node as visible to Compute Engine instances.",
|
||||
"type": "string"
|
||||
},
|
||||
"schedulingConfig": {
|
||||
"$ref": "SchedulingConfig"
|
||||
},
|
||||
"serviceAccount": {
|
||||
"description": "Output only.\nThe service account used to run the tensor flow services within the node.\nTo share resources, including Google Cloud Storage data, with the\nTensorflow job running in the Node, this account must have permissions to\nthat data.",
|
||||
"description": "Output only. The service account used to run the tensor flow services within the node.\nTo share resources, including Google Cloud Storage data, with the\nTensorflow job running in the Node, this account must have permissions to\nthat data.",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "Output only.\nThe current state for the TPU Node.",
|
||||
"description": "Output only. The current state for the TPU Node.",
|
||||
"enum": [
|
||||
"STATE_UNSPECIFIED",
|
||||
"CREATING",
|
||||
@ -1059,7 +1073,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"Status": {
|
||||
"description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error\nmessage, and error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` that can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.",
|
||||
"description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors).",
|
||||
"id": "Status",
|
||||
"properties": {
|
||||
"code": {
|
||||
|
132
vendor/google.golang.org/api/tpu/v1/tpu-gen.go
generated
vendored
132
vendor/google.golang.org/api/tpu/v1/tpu-gen.go
generated
vendored
@ -49,8 +49,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
gensupport "google.golang.org/api/gensupport"
|
||||
googleapi "google.golang.org/api/googleapi"
|
||||
gensupport "google.golang.org/api/internal/gensupport"
|
||||
option "google.golang.org/api/option"
|
||||
htransport "google.golang.org/api/transport/http"
|
||||
)
|
||||
@ -261,6 +261,9 @@ type ListAcceleratorTypesResponse struct {
|
||||
// NextPageToken: The next page token or empty if none.
|
||||
NextPageToken string `json:"nextPageToken,omitempty"`
|
||||
|
||||
// Unreachable: Locations that could not be reached.
|
||||
Unreachable []string `json:"unreachable,omitempty"`
|
||||
|
||||
// ServerResponse contains the HTTP response code and headers from the
|
||||
// server.
|
||||
googleapi.ServerResponse `json:"-"`
|
||||
@ -409,6 +412,9 @@ type ListTensorFlowVersionsResponse struct {
|
||||
// TensorflowVersions: The listed nodes.
|
||||
TensorflowVersions []*TensorFlowVersion `json:"tensorflowVersions,omitempty"`
|
||||
|
||||
// Unreachable: Locations that could not be reached.
|
||||
Unreachable []string `json:"unreachable,omitempty"`
|
||||
|
||||
// ServerResponse contains the HTTP response code and headers from the
|
||||
// server.
|
||||
googleapi.ServerResponse `json:"-"`
|
||||
@ -546,8 +552,7 @@ type Node struct {
|
||||
// Required.
|
||||
CidrBlock string `json:"cidrBlock,omitempty"`
|
||||
|
||||
// CreateTime: Output only.
|
||||
// The time when the node was created.
|
||||
// CreateTime: Output only. The time when the node was created.
|
||||
CreateTime string `json:"createTime,omitempty"`
|
||||
|
||||
// Description: The user-supplied description of the TPU. Maximum of 512
|
||||
@ -568,14 +573,13 @@ type Node struct {
|
||||
// will resume running once rescheduled.
|
||||
Health string `json:"health,omitempty"`
|
||||
|
||||
// HealthDescription: Output only.
|
||||
// If this field is populated, it contains a description of why the TPU
|
||||
// Node
|
||||
// HealthDescription: Output only. If this field is populated, it
|
||||
// contains a description of why the TPU Node
|
||||
// is unhealthy.
|
||||
HealthDescription string `json:"healthDescription,omitempty"`
|
||||
|
||||
// IpAddress: Output only.
|
||||
// DEPRECATED! Use network_endpoints instead.
|
||||
// IpAddress: Output only. DEPRECATED! Use network_endpoints
|
||||
// instead.
|
||||
// The network address for the TPU Node as visible to Compute
|
||||
// Engine
|
||||
// instances.
|
||||
@ -584,8 +588,7 @@ type Node struct {
|
||||
// Labels: Resource labels to represent user-provided metadata.
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
|
||||
// Name: Output only.
|
||||
// The immutable name of the TPU
|
||||
// Name: Output only. The immutable name of the TPU
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Network: The name of a network they wish to peer the TPU node to. It
|
||||
@ -602,17 +605,15 @@ type Node struct {
|
||||
// to the 0th entry in this map first.
|
||||
NetworkEndpoints []*NetworkEndpoint `json:"networkEndpoints,omitempty"`
|
||||
|
||||
// Port: Output only.
|
||||
// DEPRECATED! Use network_endpoints instead.
|
||||
// Port: Output only. DEPRECATED! Use network_endpoints instead.
|
||||
// The network port for the TPU Node as visible to Compute Engine
|
||||
// instances.
|
||||
Port string `json:"port,omitempty"`
|
||||
|
||||
SchedulingConfig *SchedulingConfig `json:"schedulingConfig,omitempty"`
|
||||
|
||||
// ServiceAccount: Output only.
|
||||
// The service account used to run the tensor flow services within the
|
||||
// node.
|
||||
// ServiceAccount: Output only. The service account used to run the
|
||||
// tensor flow services within the node.
|
||||
// To share resources, including Google Cloud Storage data, with
|
||||
// the
|
||||
// Tensorflow job running in the Node, this account must have
|
||||
@ -620,8 +621,7 @@ type Node struct {
|
||||
// that data.
|
||||
ServiceAccount string `json:"serviceAccount,omitempty"`
|
||||
|
||||
// State: Output only.
|
||||
// The current state for the TPU Node.
|
||||
// State: Output only. The current state for the TPU Node.
|
||||
//
|
||||
// Possible values:
|
||||
// "STATE_UNSPECIFIED" - TPU node state is not known/set.
|
||||
@ -876,81 +876,14 @@ type StartNodeRequest struct {
|
||||
// suitable for
|
||||
// different programming environments, including REST APIs and RPC APIs.
|
||||
// It is
|
||||
// used by [gRPC](https://github.com/grpc). The error model is designed
|
||||
// to be:
|
||||
// used by [gRPC](https://github.com/grpc). Each `Status` message
|
||||
// contains
|
||||
// three pieces of data: error code, error message, and error
|
||||
// details.
|
||||
//
|
||||
// - Simple to use and understand for most users
|
||||
// - Flexible enough to meet unexpected needs
|
||||
//
|
||||
// # Overview
|
||||
//
|
||||
// The `Status` message contains three pieces of data: error code,
|
||||
// error
|
||||
// message, and error details. The error code should be an enum value
|
||||
// of
|
||||
// google.rpc.Code, but it may accept additional error codes if needed.
|
||||
// The
|
||||
// error message should be a developer-facing English message that
|
||||
// helps
|
||||
// developers *understand* and *resolve* the error. If a localized
|
||||
// user-facing
|
||||
// error message is needed, put the localized message in the error
|
||||
// details or
|
||||
// localize it in the client. The optional error details may contain
|
||||
// arbitrary
|
||||
// information about the error. There is a predefined set of error
|
||||
// detail types
|
||||
// in the package `google.rpc` that can be used for common error
|
||||
// conditions.
|
||||
//
|
||||
// # Language mapping
|
||||
//
|
||||
// The `Status` message is the logical representation of the error
|
||||
// model, but it
|
||||
// is not necessarily the actual wire format. When the `Status` message
|
||||
// is
|
||||
// exposed in different client libraries and different wire protocols,
|
||||
// it can be
|
||||
// mapped differently. For example, it will likely be mapped to some
|
||||
// exceptions
|
||||
// in Java, but more likely mapped to some error codes in C.
|
||||
//
|
||||
// # Other uses
|
||||
//
|
||||
// The error model and the `Status` message can be used in a variety
|
||||
// of
|
||||
// environments, either with or without APIs, to provide a
|
||||
// consistent developer experience across different
|
||||
// environments.
|
||||
//
|
||||
// Example uses of this error model include:
|
||||
//
|
||||
// - Partial errors. If a service needs to return partial errors to the
|
||||
// client,
|
||||
// it may embed the `Status` in the normal response to indicate the
|
||||
// partial
|
||||
// errors.
|
||||
//
|
||||
// - Workflow errors. A typical workflow has multiple steps. Each step
|
||||
// may
|
||||
// have a `Status` message for error reporting.
|
||||
//
|
||||
// - Batch operations. If a client uses batch request and batch
|
||||
// response, the
|
||||
// `Status` message should be used directly inside batch response,
|
||||
// one for
|
||||
// each error sub-response.
|
||||
//
|
||||
// - Asynchronous operations. If an API call embeds asynchronous
|
||||
// operation
|
||||
// results in its response, the status of those operations should
|
||||
// be
|
||||
// represented directly using the `Status` message.
|
||||
//
|
||||
// - Logging. If some API errors are stored in logs, the message
|
||||
// `Status` could
|
||||
// be used directly after any stripping needed for security/privacy
|
||||
// reasons.
|
||||
// You can find out more about this error model and how to work with it
|
||||
// in the
|
||||
// [API Design Guide](https://cloud.google.com/apis/design/errors).
|
||||
type Status struct {
|
||||
// Code: The status code, which should be an enum value of
|
||||
// google.rpc.Code.
|
||||
@ -1086,6 +1019,7 @@ func (c *ProjectsLocationsGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -1251,6 +1185,7 @@ func (c *ProjectsLocationsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -1431,6 +1366,7 @@ func (c *ProjectsLocationsAcceleratorTypesGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsAcceleratorTypesGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -1600,6 +1536,7 @@ func (c *ProjectsLocationsAcceleratorTypesListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsAcceleratorTypesListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -1783,6 +1720,7 @@ func (c *ProjectsLocationsNodesCreateCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesCreateCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -1925,6 +1863,7 @@ func (c *ProjectsLocationsNodesDeleteCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesDeleteCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2065,6 +2004,7 @@ func (c *ProjectsLocationsNodesGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2222,6 +2162,7 @@ func (c *ProjectsLocationsNodesListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2388,6 +2329,7 @@ func (c *ProjectsLocationsNodesReimageCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesReimageCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2527,6 +2469,7 @@ func (c *ProjectsLocationsNodesStartCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesStartCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2666,6 +2609,7 @@ func (c *ProjectsLocationsNodesStopCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsNodesStopCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2820,6 +2764,7 @@ func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -2955,6 +2900,7 @@ func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3099,6 +3045,7 @@ func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3279,6 +3226,7 @@ func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3459,6 +3407,7 @@ func (c *ProjectsLocationsTensorflowVersionsGetCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsTensorflowVersionsGetCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
@ -3628,6 +3577,7 @@ func (c *ProjectsLocationsTensorflowVersionsListCall) Header() http.Header {
|
||||
|
||||
func (c *ProjectsLocationsTensorflowVersionsListCall) doRequest(alt string) (*http.Response, error) {
|
||||
reqHeaders := make(http.Header)
|
||||
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191216")
|
||||
for k, v := range c.header_ {
|
||||
reqHeaders[k] = v
|
||||
}
|
||||
|
32
vendor/google.golang.org/api/transport/http/dial.go
generated
vendored
32
vendor/google.golang.org/api/transport/http/dial.go
generated
vendored
@ -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
|
||||
@ -70,7 +60,7 @@ func newTransport(ctx context.Context, base http.RoundTripper, settings *interna
|
||||
quotaProject: settings.QuotaProject,
|
||||
requestReason: settings.RequestReason,
|
||||
}
|
||||
trans = addOCTransport(trans)
|
||||
trans = addOCTransport(trans, settings)
|
||||
switch {
|
||||
case settings.NoAuth:
|
||||
// Do nothing.
|
||||
@ -119,16 +109,15 @@ func (t parameterTransport) RoundTrip(req *http.Request) (*http.Response, error)
|
||||
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 +142,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{},
|
||||
|
16
vendor/google.golang.org/api/transport/http/dial_appengine.go
generated
vendored
16
vendor/google.golang.org/api/transport/http/dial_appengine.go
generated
vendored
@ -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
|
||||
|
||||
|
16
vendor/google.golang.org/api/transport/http/internal/propagation/http.go
generated
vendored
16
vendor/google.golang.org/api/transport/http/internal/propagation/http.go
generated
vendored
@ -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
|
||||
|
||||
|
8
vendor/modules.txt
vendored
8
vendor/modules.txt
vendored
@ -366,6 +366,8 @@ github.com/google/go-cmp/cmp/internal/value
|
||||
github.com/google/gofuzz
|
||||
# github.com/google/uuid v1.1.1 => github.com/google/uuid v1.1.1
|
||||
github.com/google/uuid
|
||||
# github.com/googleapis/gax-go/v2 v2.0.5 => github.com/googleapis/gax-go/v2 v2.0.5
|
||||
github.com/googleapis/gax-go/v2
|
||||
# github.com/googleapis/gnostic v0.4.1 => github.com/googleapis/gnostic v0.4.1
|
||||
github.com/googleapis/gnostic/compiler
|
||||
github.com/googleapis/gnostic/extensions
|
||||
@ -941,16 +943,16 @@ gonum.org/v1/gonum/lapack
|
||||
gonum.org/v1/gonum/lapack/gonum
|
||||
gonum.org/v1/gonum/lapack/lapack64
|
||||
gonum.org/v1/gonum/mat
|
||||
# google.golang.org/api v0.6.1-0.20190607001116-5213b8090861 => google.golang.org/api v0.6.1-0.20190607001116-5213b8090861
|
||||
# google.golang.org/api v0.15.1 => google.golang.org/api v0.15.1
|
||||
google.golang.org/api/compute/v0.alpha
|
||||
google.golang.org/api/compute/v0.beta
|
||||
google.golang.org/api/compute/v1
|
||||
google.golang.org/api/container/v1
|
||||
google.golang.org/api/gensupport
|
||||
google.golang.org/api/googleapi
|
||||
google.golang.org/api/googleapi/internal/uritemplates
|
||||
google.golang.org/api/googleapi/transport
|
||||
google.golang.org/api/internal
|
||||
google.golang.org/api/internal/gensupport
|
||||
google.golang.org/api/internal/third_party/uritemplates
|
||||
google.golang.org/api/logging/v2beta1
|
||||
google.golang.org/api/monitoring/v3
|
||||
google.golang.org/api/option
|
||||
|
Loading…
Reference in New Issue
Block a user