vendor: update all dependencies to latest versions

This commit is contained in:
Nick Craig-Wood
2018-01-16 13:20:59 +00:00
parent 8e83fb6fb9
commit 7d3a17725d
4878 changed files with 1974213 additions and 201199 deletions
+26 -29
View File
@@ -34,23 +34,42 @@ var appengineDialerHook func(context.Context) grpc.DialOption
// Dial returns a GRPC connection for use communicating with a Google cloud
// service, configured with the given ClientOptions.
func Dial(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
return dial(ctx, false, opts)
}
// DialInsecure returns an insecure GRPC connection for use communicating
// with fake or mock Google cloud service implementations, such as emulators.
// The connection is configured with the given ClientOptions.
func DialInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
return dial(ctx, true, opts)
}
func dial(ctx context.Context, insecure bool, opts []option.ClientOption) (*grpc.ClientConn, error) {
var o internal.DialSettings
for _, opt := range opts {
opt.Apply(&o)
}
if err := o.Validate(); err != nil {
return nil, err
}
if o.HTTPClient != nil {
return nil, errors.New("unsupported HTTP client specified")
}
if o.GRPCConn != nil {
return o.GRPCConn, nil
}
creds, err := internal.Creds(ctx, &o)
if err != nil {
return nil, err
}
grpcOpts := []grpc.DialOption{
grpc.WithPerRPCCredentials(oauth.TokenSource{creds.TokenSource}),
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
var grpcOpts []grpc.DialOption
if insecure {
grpcOpts = []grpc.DialOption{grpc.WithInsecure()}
} else if !o.NoAuth {
creds, err := internal.Creds(ctx, &o)
if err != nil {
return nil, err
}
grpcOpts = []grpc.DialOption{
grpc.WithPerRPCCredentials(oauth.TokenSource{creds.TokenSource}),
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
}
}
if appengineDialerHook != nil {
// Use the Socket API on App Engine.
@@ -62,25 +81,3 @@ func Dial(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, e
}
return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
}
// DialInsecure returns an insecure GRPC connection for use communicating
// with fake or mock Google cloud service implementations, such as emulators.
// The connection is configured with the given ClientOptions.
func DialInsecure(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, error) {
var o internal.DialSettings
for _, opt := range opts {
opt.Apply(&o)
}
if o.HTTPClient != nil {
return nil, errors.New("unsupported HTTP client specified")
}
if o.GRPCConn != nil {
return o.GRPCConn, nil
}
grpcOpts := []grpc.DialOption{grpc.WithInsecure()}
grpcOpts = append(grpcOpts, o.GRPCDialOpts...)
if o.UserAgent != "" {
grpcOpts = append(grpcOpts, grpc.WithUserAgent(o.UserAgent))
}
return grpc.DialContext(ctx, o.Endpoint, grpcOpts...)
}
+25 -20
View File
@@ -36,6 +36,9 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*http.Client,
for _, opt := range opts {
opt.Apply(&o)
}
if err := o.Validate(); err != nil {
return nil, "", err
}
if o.GRPCConn != nil {
return nil, "", errors.New("unsupported gRPC connection specified")
}
@@ -43,30 +46,32 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*http.Client,
if o.HTTPClient != nil {
return o.HTTPClient, o.Endpoint, nil
}
if o.APIKey != "" {
hc := &http.Client{
uat := userAgentTransport{
base: baseTransport(ctx),
userAgent: o.UserAgent,
}
var hc *http.Client
switch {
case o.NoAuth:
hc = &http.Client{Transport: uat}
case o.APIKey != "":
hc = &http.Client{
Transport: &transport.APIKey{
Key: o.APIKey,
Transport: userAgentTransport{
base: baseTransport(ctx),
userAgent: o.UserAgent,
},
Key: o.APIKey,
Transport: uat,
},
}
return hc, o.Endpoint, nil
}
creds, err := internal.Creds(ctx, &o)
if err != nil {
return nil, "", err
}
hc := &http.Client{
Transport: &oauth2.Transport{
Source: creds.TokenSource,
Base: userAgentTransport{
base: baseTransport(ctx),
userAgent: o.UserAgent,
default:
creds, err := internal.Creds(ctx, &o)
if err != nil {
return nil, "", err
}
hc = &http.Client{
Transport: &oauth2.Transport{
Source: creds.TokenSource,
Base: uat,
},
},
}
}
return hc, o.Endpoint, nil
}