Skip to content
This repository was archived by the owner on Jun 27, 2021. It is now read-only.

Commit f78820a

Browse files
authored
switch to NewService style (#100)
1 parent 45bbe2a commit f78820a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

gsuite/config.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"golang.org/x/oauth2/jwt"
1717
directory "google.golang.org/api/admin/directory/v1"
1818
groupSettings "google.golang.org/api/groupssettings/v1"
19+
"google.golang.org/api/option"
1920
)
2021

2122
var defaultOauthScopes = []string{
@@ -99,18 +100,20 @@ func (c *Config) loadAndValidate(terraformVersion string) error {
99100
userAgent := fmt.Sprintf("(%s %s) Terraform/%s",
100101
runtime.GOOS, runtime.GOARCH, terraformVersion)
101102

103+
context := context.Background()
104+
102105
// Create the directory service.
103-
directorySvc, err := directory.New(client)
106+
directorySvc, err := directory.NewService(context, option.WithHTTPClient(client))
104107
if err != nil {
105-
return nil
108+
return err
106109
}
107110
directorySvc.UserAgent = userAgent
108111
c.directory = directorySvc
109112

110113
// Create the groupSettings service.
111-
groupSettingsSvc, err := groupSettings.New(client)
114+
groupSettingsSvc, err := groupSettings.NewService(context, option.WithHTTPClient(client))
112115
if err != nil {
113-
return nil
116+
return err
114117
}
115118
groupSettingsSvc.UserAgent = userAgent
116119
c.groupSettings = groupSettingsSvc

0 commit comments

Comments
 (0)