From f8d6f87b21ae536e902238d76dc1caf3778f90b8 Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Fri, 11 Feb 2022 09:58:25 -0700 Subject: [PATCH] chore: bulk update version for manual This changes bulk updates all manuals that has reference to the old version.Repo that has been a long incorrect value. This new version files will be maintained by release please. Updates: #2749 feat(bigquery): add better version metadata to calls feat(datastore): add better version metadata to calls feat(errorreporting): add better version metadata to calls feat(firestore): add better version metadata to calls feat(logging): add better version metadata to calls feat(profiler): add better version metadata to calls feat(pubsub): add better version metadata to calls feat(translate): add better version metadata to calls --- bigquery/bigquery.go | 5 +++-- bigquery/internal/version.go | 18 ++++++++++++++++++ datastore/client.go | 7 ++++--- datastore/internal/version.go | 18 ++++++++++++++++++ errorreporting/errors.go | 4 ++-- errorreporting/internal/version.go | 18 ++++++++++++++++++ firestore/client.go | 4 ++-- firestore/internal/version.go | 18 ++++++++++++++++++ logging/internal/version.go | 18 ++++++++++++++++++ logging/logadmin/logadmin.go | 7 +++---- logging/logging.go | 3 +-- profiler/internal/version.go | 18 ++++++++++++++++++ profiler/profiler.go | 7 ++++--- pubsub/internal/version.go | 18 ++++++++++++++++++ pubsub/pubsub.go | 4 ++-- translate/internal/version.go | 18 ++++++++++++++++++ translate/translate.go | 3 ++- 17 files changed, 167 insertions(+), 21 deletions(-) create mode 100644 bigquery/internal/version.go create mode 100644 datastore/internal/version.go create mode 100644 errorreporting/internal/version.go create mode 100644 firestore/internal/version.go create mode 100644 logging/internal/version.go create mode 100644 profiler/internal/version.go create mode 100644 pubsub/internal/version.go create mode 100644 translate/internal/version.go diff --git a/bigquery/bigquery.go b/bigquery/bigquery.go index 54800f8417b9..7819efcf5f33 100644 --- a/bigquery/bigquery.go +++ b/bigquery/bigquery.go @@ -23,6 +23,7 @@ import ( "strings" "time" + "cloud.google.com/go/bigquery/internal" "cloud.google.com/go/internal" "cloud.google.com/go/internal/detect" "cloud.google.com/go/internal/version" @@ -40,7 +41,7 @@ const ( userAgentPrefix = "gcloud-golang-bigquery" ) -var xGoogHeader = fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), version.Repo) +var xGoogHeader = fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), internal.Version) func setClientHeader(headers http.Header) { headers.Set("x-goog-api-client", xGoogHeader) @@ -74,7 +75,7 @@ const DetectProjectID = "*detect-project-id*" func NewClient(ctx context.Context, projectID string, opts ...option.ClientOption) (*Client, error) { o := []option.ClientOption{ option.WithScopes(Scope), - option.WithUserAgent(fmt.Sprintf("%s/%s", userAgentPrefix, version.Repo)), + option.WithUserAgent(fmt.Sprintf("%s/%s", userAgentPrefix, internal.Version)), } o = append(o, opts...) bqs, err := bq.NewService(ctx, o...) diff --git a/bigquery/internal/version.go b/bigquery/internal/version.go new file mode 100644 index 000000000000..dc1cb9f6009b --- /dev/null +++ b/bigquery/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "1.27.0" diff --git a/datastore/client.go b/datastore/client.go index 2792fb5209e6..6cc6b4935354 100644 --- a/datastore/client.go +++ b/datastore/client.go @@ -19,7 +19,8 @@ import ( "fmt" "time" - "cloud.google.com/go/internal" + "cloud.google.com/go/datastore/internal" + cloudinternal "cloud.google.com/go/internal" "cloud.google.com/go/internal/trace" "cloud.google.com/go/internal/version" gax "github.com/googleapis/gax-go/v2" @@ -46,7 +47,7 @@ func newDatastoreClient(conn grpc.ClientConnInterface, projectID string) pb.Data c: pb.NewDatastoreClient(conn), md: metadata.Pairs( resourcePrefixHeader, "projects/"+projectID, - "x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s grpc/", version.Go(), version.Repo)), + "x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s grpc/", version.Go(), internal.Version)), } } @@ -118,7 +119,7 @@ func (dc *datastoreClient) AllocateIds(ctx context.Context, in *pb.AllocateIdsRe func (dc *datastoreClient) invoke(ctx context.Context, f func(ctx context.Context) error) error { ctx = metadata.NewOutgoingContext(ctx, dc.md) - return internal.Retry(ctx, gax.Backoff{Initial: 100 * time.Millisecond}, func() (stop bool, err error) { + return cloudinternal.Retry(ctx, gax.Backoff{Initial: 100 * time.Millisecond}, func() (stop bool, err error) { err = f(ctx) return !shouldRetry(err), err }) diff --git a/datastore/internal/version.go b/datastore/internal/version.go new file mode 100644 index 000000000000..05d3396f1001 --- /dev/null +++ b/datastore/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "1.6.0" diff --git a/errorreporting/errors.go b/errorreporting/errors.go index 25683e7c0d87..e83c189b0ff9 100644 --- a/errorreporting/errors.go +++ b/errorreporting/errors.go @@ -33,7 +33,7 @@ import ( "time" vkit "cloud.google.com/go/errorreporting/apiv1beta1" - "cloud.google.com/go/internal/version" + "cloud.google.com/go/errorreporting/internal" "github.com/golang/protobuf/ptypes" gax "github.com/googleapis/gax-go/v2" "google.golang.org/api/option" @@ -88,7 +88,7 @@ var newClient = func(ctx context.Context, opts ...option.ClientOption) (client, if err != nil { return nil, err } - client.SetGoogleClientInfo("gccl", version.Repo) + client.SetGoogleClientInfo("gccl", internal.Version) return client, nil } diff --git a/errorreporting/internal/version.go b/errorreporting/internal/version.go new file mode 100644 index 000000000000..b74ae121b41e --- /dev/null +++ b/errorreporting/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "0.1.0" diff --git a/firestore/client.go b/firestore/client.go index 1b4c4618672a..35d695a3e749 100644 --- a/firestore/client.go +++ b/firestore/client.go @@ -24,8 +24,8 @@ import ( "time" vkit "cloud.google.com/go/firestore/apiv1" + "cloud.google.com/go/firestore/internal" "cloud.google.com/go/internal/trace" - "cloud.google.com/go/internal/version" "github.com/golang/protobuf/ptypes" gax "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" @@ -92,7 +92,7 @@ func NewClient(ctx context.Context, projectID string, opts ...option.ClientOptio if err != nil { return nil, err } - vc.SetGoogleClientInfo("gccl", version.Repo) + vc.SetGoogleClientInfo("gccl", internal.Version) c := &Client{ c: vc, projectID: projectID, diff --git a/firestore/internal/version.go b/firestore/internal/version.go new file mode 100644 index 000000000000..b819fa786d1c --- /dev/null +++ b/firestore/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "1.6.1" diff --git a/logging/internal/version.go b/logging/internal/version.go new file mode 100644 index 000000000000..5a350533db55 --- /dev/null +++ b/logging/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "1.4.2" diff --git a/logging/logadmin/logadmin.go b/logging/logadmin/logadmin.go index d6ffc31f045c..12329d01c493 100644 --- a/logging/logadmin/logadmin.go +++ b/logging/logadmin/logadmin.go @@ -33,7 +33,6 @@ import ( "strings" "time" - "cloud.google.com/go/internal/version" "cloud.google.com/go/logging" vkit "cloud.google.com/go/logging/apiv2" "cloud.google.com/go/logging/internal" @@ -95,9 +94,9 @@ func NewClient(ctx context.Context, parent string, opts ...option.ClientOption) mc.CallOptions.CreateLogMetric = []gax.CallOption{gax.WithRetry(retryerOnInternal)} mc.CallOptions.UpdateLogMetric = []gax.CallOption{gax.WithRetry(retryerOnInternal)} - lc.SetGoogleClientInfo("gccl", version.Repo) - sc.SetGoogleClientInfo("gccl", version.Repo) - mc.SetGoogleClientInfo("gccl", version.Repo) + lc.SetGoogleClientInfo("gccl", internal.Version) + sc.SetGoogleClientInfo("gccl", internal.Version) + mc.SetGoogleClientInfo("gccl", internal.Version) client := &Client{ lClient: lc, sClient: sc, diff --git a/logging/logging.go b/logging/logging.go index 6f990f26a149..f344cc6880c2 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -39,7 +39,6 @@ import ( "time" "unicode/utf8" - "cloud.google.com/go/internal/version" vkit "cloud.google.com/go/logging/apiv2" "cloud.google.com/go/logging/internal" "github.com/golang/protobuf/proto" @@ -143,7 +142,7 @@ func NewClient(ctx context.Context, parent string, opts ...option.ClientOption) if err != nil { return nil, err } - c.SetGoogleClientInfo("gccl", version.Repo) + c.SetGoogleClientInfo("gccl", internal.Version) client := &Client{ client: c, parent: parent, diff --git a/profiler/internal/version.go b/profiler/internal/version.go new file mode 100644 index 000000000000..a9b0ea53c7b1 --- /dev/null +++ b/profiler/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "0.1.2" diff --git a/profiler/profiler.go b/profiler/profiler.go index c6f90e8b1e18..003bcab2650b 100644 --- a/profiler/profiler.go +++ b/profiler/profiler.go @@ -50,6 +50,7 @@ import ( gcemd "cloud.google.com/go/compute/metadata" "cloud.google.com/go/internal/version" + "cloud.google.com/go/profiler/internal" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/google/pprof/profile" @@ -240,7 +241,7 @@ func start(cfg Config, options ...option.ClientOption) error { opts := []option.ClientOption{ option.WithEndpoint(config.APIAddr), option.WithScopes(scope), - option.WithUserAgent(fmt.Sprintf("gcloud-go-profiler/%s", version.Repo)), + option.WithUserAgent(fmt.Sprintf("gcloud-go-profiler/%s", internal.Version)), } if !config.EnableOCTelemetry { opts = append(opts, option.WithTelemetryDisabled()) @@ -475,7 +476,7 @@ func mutexProfile() (*profile.Profile, error) { // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. func withXGoogHeader(ctx context.Context, keyval ...string) context.Context { - kv := append([]string{"gl-go", version.Go(), "gccl", version.Repo}, keyval...) + kv := append([]string{"gl-go", version.Go(), "gccl", internal.Version}, keyval...) kv = append(kv, "gax", gax.Version, "grpc", grpc.Version) md, _ := grpcmd.FromOutgoingContext(ctx) @@ -610,7 +611,7 @@ func initializeConfig(cfg Config) error { // server for instructions, and collects and uploads profiles as // requested. func pollProfilerService(ctx context.Context, a *agent) { - debugLog("Cloud Profiler Go Agent version: %s", version.Repo) + debugLog("Cloud Profiler Go Agent version: %s", internal.Version) debugLog("profiler has started") for i := 0; config.numProfiles == 0 || i < config.numProfiles; i++ { p := a.createProfile(ctx) diff --git a/pubsub/internal/version.go b/pubsub/internal/version.go new file mode 100644 index 000000000000..ddddbd21f21f --- /dev/null +++ b/pubsub/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "1.18.0" diff --git a/pubsub/pubsub.go b/pubsub/pubsub.go index ec9ac4a55ba8..7ea72ae816c1 100644 --- a/pubsub/pubsub.go +++ b/pubsub/pubsub.go @@ -23,8 +23,8 @@ import ( "strings" "time" - "cloud.google.com/go/internal/version" vkit "cloud.google.com/go/pubsub/apiv1" + "cloud.google.com/go/pubsub/internal" gax "github.com/googleapis/gax-go/v2" "google.golang.org/api/option" "google.golang.org/grpc" @@ -158,7 +158,7 @@ func NewClientWithConfig(ctx context.Context, projectID string, config *ClientCo pubc.CallOptions = mergePublisherCallOptions(pubc.CallOptions, config.PublisherCallOptions) subc.CallOptions = mergeSubscriberCallOptions(subc.CallOptions, config.SubscriberCallOptions) } - pubc.SetGoogleClientInfo("gccl", version.Repo) + pubc.SetGoogleClientInfo("gccl", internal.Version) return &Client{ projectID: projectID, pubc: pubc, diff --git a/translate/internal/version.go b/translate/internal/version.go new file mode 100644 index 000000000000..db6d2e3e99d1 --- /dev/null +++ b/translate/internal/version.go @@ -0,0 +1,18 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +// Version is the current tagged release of the library. +const Version = "1.0.0" diff --git a/translate/translate.go b/translate/translate.go index f389cf7a3f66..95898a1b5464 100644 --- a/translate/translate.go +++ b/translate/translate.go @@ -26,6 +26,7 @@ import ( "net/http" "cloud.google.com/go/internal/version" + "cloud.google.com/go/translate/internal" "golang.org/x/text/language" "google.golang.org/api/option" raw "google.golang.org/api/translate/v2" @@ -236,5 +237,5 @@ type Language struct { } func setClientHeader(headers http.Header) { - headers.Set("x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), version.Repo)) + headers.Set("x-goog-api-client", fmt.Sprintf("gl-go/%s gccl/%s", version.Go(), internal.Version)) }