From 56d0d596b79b753530b6d158ca47791fc8d05e91 Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:14:17 -0500 Subject: [PATCH] chore: remove some nil clients (#2631) --- .../v1/corp_autopush_learningstate-api.json | 1 - .../v1/corp_autopush_learningstate-gen.go | 118 ------------------ .../v1/corp_spatialanalytics-api.json | 1 - .../v1/corp_spatialanalytics-gen.go | 118 ------------------ go.work.sum | 1 - 5 files changed, 239 deletions(-) delete mode 100644 corp_autopush_learningstate/v1/corp_autopush_learningstate-api.json delete mode 100644 corp_autopush_learningstate/v1/corp_autopush_learningstate-gen.go delete mode 100644 corp_spatialanalytics/v1/corp_spatialanalytics-api.json delete mode 100644 corp_spatialanalytics/v1/corp_spatialanalytics-gen.go diff --git a/corp_autopush_learningstate/v1/corp_autopush_learningstate-api.json b/corp_autopush_learningstate/v1/corp_autopush_learningstate-api.json deleted file mode 100644 index 9e26dfeeb6e..00000000000 --- a/corp_autopush_learningstate/v1/corp_autopush_learningstate-api.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/corp_autopush_learningstate/v1/corp_autopush_learningstate-gen.go b/corp_autopush_learningstate/v1/corp_autopush_learningstate-gen.go deleted file mode 100644 index 0935986310c..00000000000 --- a/corp_autopush_learningstate/v1/corp_autopush_learningstate-gen.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2021 Google LLC. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated file. DO NOT EDIT. - -// Package corp_autopush_learningstate provides access to the . -// -// # Creating a client -// -// Usage example: -// -// import "google.golang.org/api/corp_autopush_learningstate/v1" -// ... -// ctx := context.Background() -// corp_autopush_learningstateService, err := corp_autopush_learningstate.NewService(ctx) -// -// In this example, Google Application Default Credentials are used for authentication. -// -// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. -// -// # Other authentication options -// -// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: -// -// corp_autopush_learningstateService, err := corp_autopush_learningstate.NewService(ctx, option.WithAPIKey("AIza...")) -// -// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: -// -// config := &oauth2.Config{...} -// // ... -// token, err := config.Exchange(ctx, ...) -// corp_autopush_learningstateService, err := corp_autopush_learningstate.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) -// -// See https://godoc.org/google.golang.org/api/option/ for details on options. -package corp_autopush_learningstate // import "google.golang.org/api/corp_autopush_learningstate/v1" - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "strings" - - googleapi "google.golang.org/api/googleapi" - gensupport "google.golang.org/api/internal/gensupport" - option "google.golang.org/api/option" - internaloption "google.golang.org/api/option/internaloption" - htransport "google.golang.org/api/transport/http" -) - -// Always reference these packages, just in case the auto-generated code -// below doesn't. -var _ = bytes.NewBuffer -var _ = strconv.Itoa -var _ = fmt.Sprintf -var _ = json.NewDecoder -var _ = io.Copy -var _ = url.Parse -var _ = gensupport.MarshalJSON -var _ = googleapi.Version -var _ = errors.New -var _ = strings.Replace -var _ = context.Canceled -var _ = internaloption.WithDefaultEndpoint - -const apiId = "" -const apiName = "" -const apiVersion = "" -const basePath = "https://www.googleapis.com/discovery/v1/apis" - -// NewService creates a new Service. -func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { - opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) - client, endpoint, err := htransport.NewClient(ctx, opts...) - if err != nil { - return nil, err - } - s, err := New(client) - if err != nil { - return nil, err - } - if endpoint != "" { - s.BasePath = endpoint - } - return s, nil -} - -// New creates a new Service. It uses the provided http.Client for requests. -// -// Deprecated: please use NewService instead. -// To provide a custom HTTP client, use option.WithHTTPClient. -// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. -func New(client *http.Client) (*Service, error) { - if client == nil { - return nil, errors.New("client is nil") - } - s := &Service{client: client, BasePath: basePath} - return s, nil -} - -type Service struct { - client *http.Client - BasePath string // API endpoint base URL - UserAgent string // optional additional User-Agent fragment -} - -func (s *Service) userAgent() string { - if s.UserAgent == "" { - return googleapi.UserAgent - } - return googleapi.UserAgent + " " + s.UserAgent -} diff --git a/corp_spatialanalytics/v1/corp_spatialanalytics-api.json b/corp_spatialanalytics/v1/corp_spatialanalytics-api.json deleted file mode 100644 index 9e26dfeeb6e..00000000000 --- a/corp_spatialanalytics/v1/corp_spatialanalytics-api.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/corp_spatialanalytics/v1/corp_spatialanalytics-gen.go b/corp_spatialanalytics/v1/corp_spatialanalytics-gen.go deleted file mode 100644 index 474cd330600..00000000000 --- a/corp_spatialanalytics/v1/corp_spatialanalytics-gen.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2021 Google LLC. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated file. DO NOT EDIT. - -// Package corp_spatialanalytics provides access to the . -// -// # Creating a client -// -// Usage example: -// -// import "google.golang.org/api/corp_spatialanalytics/v1" -// ... -// ctx := context.Background() -// corp_spatialanalyticsService, err := corp_spatialanalytics.NewService(ctx) -// -// In this example, Google Application Default Credentials are used for authentication. -// -// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. -// -// # Other authentication options -// -// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: -// -// corp_spatialanalyticsService, err := corp_spatialanalytics.NewService(ctx, option.WithAPIKey("AIza...")) -// -// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: -// -// config := &oauth2.Config{...} -// // ... -// token, err := config.Exchange(ctx, ...) -// corp_spatialanalyticsService, err := corp_spatialanalytics.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) -// -// See https://godoc.org/google.golang.org/api/option/ for details on options. -package corp_spatialanalytics // import "google.golang.org/api/corp_spatialanalytics/v1" - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "strconv" - "strings" - - googleapi "google.golang.org/api/googleapi" - gensupport "google.golang.org/api/internal/gensupport" - option "google.golang.org/api/option" - internaloption "google.golang.org/api/option/internaloption" - htransport "google.golang.org/api/transport/http" -) - -// Always reference these packages, just in case the auto-generated code -// below doesn't. -var _ = bytes.NewBuffer -var _ = strconv.Itoa -var _ = fmt.Sprintf -var _ = json.NewDecoder -var _ = io.Copy -var _ = url.Parse -var _ = gensupport.MarshalJSON -var _ = googleapi.Version -var _ = errors.New -var _ = strings.Replace -var _ = context.Canceled -var _ = internaloption.WithDefaultEndpoint - -const apiId = "" -const apiName = "" -const apiVersion = "" -const basePath = "https://www.googleapis.com/discovery/v1/apis" - -// NewService creates a new Service. -func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { - opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) - client, endpoint, err := htransport.NewClient(ctx, opts...) - if err != nil { - return nil, err - } - s, err := New(client) - if err != nil { - return nil, err - } - if endpoint != "" { - s.BasePath = endpoint - } - return s, nil -} - -// New creates a new Service. It uses the provided http.Client for requests. -// -// Deprecated: please use NewService instead. -// To provide a custom HTTP client, use option.WithHTTPClient. -// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. -func New(client *http.Client) (*Service, error) { - if client == nil { - return nil, errors.New("client is nil") - } - s := &Service{client: client, BasePath: basePath} - return s, nil -} - -type Service struct { - client *http.Client - BasePath string // API endpoint base URL - UserAgent string // optional additional User-Agent fragment -} - -func (s *Service) userAgent() string { - if s.UserAgent == "" { - return googleapi.UserAgent - } - return googleapi.UserAgent + " " + s.UserAgent -} diff --git a/go.work.sum b/go.work.sum index e5f9fd34ea4..0f65fa8d51b 100644 --- a/go.work.sum +++ b/go.work.sum @@ -32,7 +32,6 @@ cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzc cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU= -cloud.google.com/go/compute v1.27.0 h1:EGawh2RUnfHT5g8f/FX3Ds6KZuIBC77hZoDrBvEZw94= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/contactcenterinsights v1.13.0/go.mod h1:ieq5d5EtHsu8vhe2y3amtZ+BE+AQwX5qAy7cpo0POsI= cloud.google.com/go/container v1.31.0/go.mod h1:7yABn5s3Iv3lmw7oMmyGbeV6tQj86njcTijkkGuvdZA=