@@ -7,21 +7,8 @@ import (
77 "net/http"
88
99 "google.golang.org/grpc/credentials"
10-
11- "go.opentelemetry.io/collector/component"
12- "go.opentelemetry.io/collector/extension"
1310)
1411
15- // Client is an optional Extension interface that can be used as an HTTP and gRPC authenticator for the configauth.Authentication option.
16- // Authenticators are then included as part of OpenTelemetry Collector builds and can be referenced by their
17- // names from the Authentication configuration.
18- // Deprecated: [v0.122.0] Assert the use of HTTPClient and GRPCClient interfaces instead.
19- type Client interface {
20- extension.Extension
21- HTTPClient
22- GRPCClient
23- }
24-
2512// HTTPClient is an optional Extension interface that can be used as an HTTP authenticator for the configauth.Authentication option.
2613// Authenticators are then included as part of OpenTelemetry Collector builds and can be referenced by their
2714// names from the Authentication configuration.
@@ -38,18 +25,6 @@ type GRPCClient interface {
3825 PerRPCCredentials () (credentials.PerRPCCredentials , error )
3926}
4027
41- // ClientOption represents the possible options for NewClient.
42- // Deprecated: [v0.122.0] This type is deprecated and will be removed in the next release.
43- type ClientOption interface {
44- apply (* defaultClient )
45- }
46-
47- type clientOptionFunc func (* defaultClient )
48-
49- func (of clientOptionFunc ) apply (e * defaultClient ) {
50- of (e )
51- }
52-
5328var _ HTTPClient = (* ClientRoundTripperFunc )(nil )
5429
5530// ClientRoundTripperFunc specifies the function that returns a RoundTripper that can be used to authenticate HTTP requests.
@@ -73,77 +48,3 @@ func (f ClientPerRPCCredentialsFunc) PerRPCCredentials() (credentials.PerRPCCred
7348 }
7449 return f ()
7550}
76-
77- var _ Client = (* defaultClient )(nil )
78-
79- type defaultClient struct {
80- component.StartFunc
81- component.ShutdownFunc
82- clientRoundTripperFunc ClientRoundTripperFunc
83- clientPerRPCCredentialsFunc ClientPerRPCCredentialsFunc
84- }
85-
86- // PerRPCCredentials implements Client.
87- func (d * defaultClient ) PerRPCCredentials () (credentials.PerRPCCredentials , error ) {
88- if d .clientPerRPCCredentialsFunc == nil {
89- return nil , nil
90- }
91- return d .clientPerRPCCredentialsFunc ()
92- }
93-
94- // RoundTripper implements Client.
95- func (d * defaultClient ) RoundTripper (base http.RoundTripper ) (http.RoundTripper , error ) {
96- if d .clientRoundTripperFunc == nil {
97- return base , nil
98- }
99- return d .clientRoundTripperFunc (base )
100- }
101-
102- // WithClientStart overrides the default `Start` function for a component.Component.
103- // The default always returns nil.
104- // Deprecated: [v0.122.0] This type is deprecated and will be removed in the next release.
105- func WithClientStart (startFunc component.StartFunc ) ClientOption {
106- return clientOptionFunc (func (o * defaultClient ) {
107- o .StartFunc = startFunc
108- })
109- }
110-
111- // WithClientShutdown overrides the default `Shutdown` function for a component.Component.
112- // The default always returns nil.
113- // Deprecated: [v0.122.0] This type is deprecated and will be removed in the next release.
114- func WithClientShutdown (shutdownFunc component.ShutdownFunc ) ClientOption {
115- return clientOptionFunc (func (o * defaultClient ) {
116- o .ShutdownFunc = shutdownFunc
117- })
118- }
119-
120- // WithClientRoundTripper provides a `RoundTripper` function for this client authenticator.
121- // The default round tripper is no-op.
122- // Deprecated: [v0.122.0] This type is deprecated and will be removed in the next release.
123- func WithClientRoundTripper (roundTripperFunc ClientRoundTripperFunc ) ClientOption {
124- return clientOptionFunc (func (o * defaultClient ) {
125- o .clientRoundTripperFunc = roundTripperFunc
126- })
127- }
128-
129- // WithClientPerRPCCredentials provides a `PerRPCCredentials` function for this client authenticator.
130- // There's no default.
131- // Deprecated: [v0.122.0] This type is deprecated and will be removed in the next release.
132- func WithClientPerRPCCredentials (perRPCCredentialsFunc ClientPerRPCCredentialsFunc ) ClientOption {
133- return clientOptionFunc (func (o * defaultClient ) {
134- o .clientPerRPCCredentialsFunc = perRPCCredentialsFunc
135- })
136- }
137-
138- // NewClient returns a Client configured with the provided options.
139- // Deprecated: [v0.122.0] This type is deprecated and will be removed in the next release.
140- // Manually implement the [HTTPClient] and/or [GRPCClient] interfaces instead.
141- func NewClient (options ... ClientOption ) (Client , error ) {
142- bc := & defaultClient {}
143-
144- for _ , op := range options {
145- op .apply (bc )
146- }
147-
148- return bc , nil
149- }
0 commit comments