mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description An attempt at splitting `extensionauth.Client` by protocol type. open-telemetry/opentelemetry-collector-contrib/pull/38451 removes usages of the `NewClient` and `NewServer` constructor --------- Co-authored-by: Jade Guiton <[email protected]>
30 lines
973 B
Go
30 lines
973 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package extensionauthtest // import "go.opentelemetry.io/collector/extension/extensionauth/extensionauthtest"
|
|
|
|
import (
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/extension"
|
|
"go.opentelemetry.io/collector/extension/extensionauth"
|
|
)
|
|
|
|
var (
|
|
_ extension.Extension = (*nopClient)(nil)
|
|
_ extensionauth.HTTPClient = (*nopClient)(nil)
|
|
_ extensionauth.GRPCClient = (*nopClient)(nil)
|
|
)
|
|
|
|
type nopClient struct {
|
|
component.StartFunc
|
|
component.ShutdownFunc
|
|
extensionauth.ClientRoundTripperFunc
|
|
extensionauth.ClientPerRPCCredentialsFunc
|
|
}
|
|
|
|
// NewNopClient returns a new [extension.Extension] that implements the [extensionauth.HTTPClient] and [extensionauth.GRPCClient].
|
|
// For HTTP requests it returns the base RoundTripper and for gRPC requests it returns a nil [credentials.PerRPCCredentials].
|
|
func NewNopClient() extension.Extension {
|
|
return &nopClient{}
|
|
}
|