vendor: update all dependencies to latest versions
This commit is contained in:
+16
-10
@@ -40,19 +40,25 @@ func (w withTokenSource) Apply(o *internal.DialSettings) {
|
||||
o.TokenSource = w.ts
|
||||
}
|
||||
|
||||
// WithServiceAccountFile returns a ClientOption that uses a Google service
|
||||
// account credentials file to authenticate.
|
||||
// Use WithTokenSource with a token source created from
|
||||
// golang.org/x/oauth2/google.JWTConfigFromJSON
|
||||
// if reading the file from disk is not an option.
|
||||
func WithServiceAccountFile(filename string) ClientOption {
|
||||
return withServiceAccountFile(filename)
|
||||
type withCredFile string
|
||||
|
||||
func (w withCredFile) Apply(o *internal.DialSettings) {
|
||||
o.CredentialsFile = string(w)
|
||||
}
|
||||
|
||||
type withServiceAccountFile string
|
||||
// WithCredentialsFile returns a ClientOption that authenticates
|
||||
// API calls with the given service account or refresh token JSON
|
||||
// credentials file.
|
||||
func WithCredentialsFile(filename string) ClientOption {
|
||||
return withCredFile(filename)
|
||||
}
|
||||
|
||||
func (w withServiceAccountFile) Apply(o *internal.DialSettings) {
|
||||
o.ServiceAccountJSONFilename = string(w)
|
||||
// WithServiceAccountFile returns a ClientOption that uses a Google service
|
||||
// account credentials file to authenticate.
|
||||
//
|
||||
// Deprecated: Use WithCredentialsFile instead.
|
||||
func WithServiceAccountFile(filename string) ClientOption {
|
||||
return WithCredentialsFile(filename)
|
||||
}
|
||||
|
||||
// WithEndpoint returns a ClientOption that overrides the default endpoint
|
||||
|
||||
+7
-7
@@ -45,7 +45,7 @@ func TestApply(t *testing.T) {
|
||||
WithScopes("https://example.com/auth/helloworld", "https://example.com/auth/otherthing"),
|
||||
WithGRPCConn(conn),
|
||||
WithUserAgent("ua"),
|
||||
WithServiceAccountFile("service-account.json"),
|
||||
WithCredentialsFile("service-account.json"),
|
||||
WithAPIKey("api-key"),
|
||||
}
|
||||
var got internal.DialSettings
|
||||
@@ -53,12 +53,12 @@ func TestApply(t *testing.T) {
|
||||
opt.Apply(&got)
|
||||
}
|
||||
want := internal.DialSettings{
|
||||
Scopes: []string{"https://example.com/auth/helloworld", "https://example.com/auth/otherthing"},
|
||||
UserAgent: "ua",
|
||||
Endpoint: "https://example.com:443",
|
||||
GRPCConn: conn,
|
||||
ServiceAccountJSONFilename: "service-account.json",
|
||||
APIKey: "api-key",
|
||||
Scopes: []string{"https://example.com/auth/helloworld", "https://example.com/auth/otherthing"},
|
||||
UserAgent: "ua",
|
||||
Endpoint: "https://example.com:443",
|
||||
GRPCConn: conn,
|
||||
CredentialsFile: "service-account.json",
|
||||
APIKey: "api-key",
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("\ngot %#v\nwant %#v", got, want)
|
||||
|
||||
Reference in New Issue
Block a user