Skip to content

Commit

Permalink
feat(storage): add better version metadata to calls (#5507)
Browse files Browse the repository at this point in the history
Adding a new file that should be maintained auotmatically by
release-please.

Updates: #2749
  • Loading branch information
codyoss authored Feb 10, 2022
1 parent 61f23b2 commit 13fe0bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions storage/internal/version.go
Original file line number Diff line number Diff line change
@@ -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.20.0"
5 changes: 3 additions & 2 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"cloud.google.com/go/internal/optional"
"cloud.google.com/go/internal/trace"
"cloud.google.com/go/internal/version"
"cloud.google.com/go/storage/internal"
gapic "cloud.google.com/go/storage/internal/apiv2"
"github.com/googleapis/gax-go/v2"
"golang.org/x/oauth2/google"
Expand Down Expand Up @@ -69,7 +70,7 @@ var (
errMethodNotValid = fmt.Errorf("storage: HTTP method should be one of %v", reflect.ValueOf(signedURLMethods).MapKeys())
)

var userAgent = fmt.Sprintf("gcloud-golang-storage/%s", version.Repo)
var userAgent = fmt.Sprintf("gcloud-golang-storage/%s", internal.Version)

const (
// ScopeFullControl grants permissions to manage your
Expand All @@ -91,7 +92,7 @@ const (
defaultConnPoolSize = 4
)

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)
Expand Down

0 comments on commit 13fe0bc

Please sign in to comment.