github.com/GoogleCloudPlatform/terraformer@v0.8.18/providers/commercetools/connectivity/client.go (about) 1 package connectivity 2 3 import ( 4 "context" 5 "strings" 6 7 "github.com/labd/commercetools-go-sdk/commercetools" 8 "golang.org/x/oauth2/clientcredentials" 9 ) 10 11 func (c *Config) NewClient() *commercetools.Client { 12 oauth2Config := &clientcredentials.Config{ 13 ClientID: c.ClientID, 14 ClientSecret: c.ClientSecret, 15 Scopes: strings.Split(c.ClientScope, " "), 16 TokenURL: c.TokenURL, 17 } 18 19 httpClient := oauth2Config.Client(context.TODO()) 20 21 return commercetools.New(&commercetools.Config{ 22 ProjectKey: c.ProjectKey, 23 URL: c.BaseURL, 24 HTTPClient: httpClient, 25 LibraryName: "terraformer", 26 }) 27 }