trace: add exported SetGoogleClientInfo wrapper to manual file
Make the generated setGoogleClientInfo package internal.
Remove trace/apiv1 from post-processing list per #1924.
Change-Id: I45422f2a422ceebf414caddc186a430d7027ab51
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/54772
Reviewed-by: Chris Broadfoot <cbro@google.com>
Reviewed-by: kokoro <noreply+kokoro@google.com>
diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go
index c334cd5..30f7a8e 100644
--- a/internal/gapicgen/generator/config.go
+++ b/internal/gapicgen/generator/config.go
@@ -692,5 +692,4 @@
"logging/apiv2",
"longrunning/autogen",
"pubsub/apiv1",
- "trace/apiv1",
}
diff --git a/trace/apiv1/info.go b/trace/apiv1/info.go
new file mode 100644
index 0000000..5ae6883
--- /dev/null
+++ b/trace/apiv1/info.go
@@ -0,0 +1,24 @@
+// Copyright 2020 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 trace
+
+// SetGoogleClientInfo sets the name and version of the application in
+// the `x-goog-api-client` header passed on each request. Also passes any
+// provided key-value pairs. Intended for use by Google-written clients.
+//
+// Internal use only.
+func (c *Client) SetGoogleClientInfo(keyval ...string) {
+ c.setGoogleClientInfo(keyval...)
+}
diff --git a/trace/apiv1/trace_client.go b/trace/apiv1/trace_client.go
index 955cd7c..8af48f4 100644
--- a/trace/apiv1/trace_client.go
+++ b/trace/apiv1/trace_client.go
@@ -137,7 +137,7 @@
client: cloudtracepb.NewTraceServiceClient(connPool),
}
- c.SetGoogleClientInfo()
+ c.setGoogleClientInfo()
return c, nil
}
@@ -155,10 +155,10 @@
return c.connPool.Close()
}
-// SetGoogleClientInfo sets the name and version of the application in
+// setGoogleClientInfo sets the name and version of the application in
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
-func (c *Client) SetGoogleClientInfo(keyval ...string) {
+func (c *Client) setGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", versionGo()}, keyval...)
kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))