Skip to content

Commit cd5c49b

Browse files
authored
[receiver/pulsar] Change the types of Token and PrivateKey to be configopaque.String (#23894)
**Description:** Split out from: #17353 **Link to tracking Issue:** #17273
1 parent 4341e10 commit cd5c49b

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: breaking
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: receiver/pulsar
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: Change the types of `Config.Authentication.Token.Token` and `Config.Authentication.Athenz.PrivateKey` to be `configopaque.String`
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [17273]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext:

receiver/pulsarreceiver/config.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/apache/pulsar-client-go/pulsar"
1010
"go.opentelemetry.io/collector/component"
11+
"go.opentelemetry.io/collector/config/configopaque"
1112
)
1213

1314
type Config struct {
@@ -42,17 +43,17 @@ type TLS struct {
4243
}
4344

4445
type Token struct {
45-
Token string `mapstructure:"token"`
46+
Token configopaque.String `mapstructure:"token"`
4647
}
4748

4849
type Athenz struct {
49-
ProviderDomain string `mapstructure:"provider_domain"`
50-
TenantDomain string `mapstructure:"tenant_domain"`
51-
TenantService string `mapstructure:"tenant_service"`
52-
PrivateKey string `mapstructure:"private_key"`
53-
KeyID string `mapstructure:"key_id"`
54-
PrincipalHeader string `mapstructure:"principal_header"`
55-
ZtsURL string `mapstructure:"zts_url"`
50+
ProviderDomain string `mapstructure:"provider_domain"`
51+
TenantDomain string `mapstructure:"tenant_domain"`
52+
TenantService string `mapstructure:"tenant_service"`
53+
PrivateKey configopaque.String `mapstructure:"private_key"`
54+
KeyID string `mapstructure:"key_id"`
55+
PrincipalHeader string `mapstructure:"principal_header"`
56+
ZtsURL string `mapstructure:"zts_url"`
5657
}
5758

5859
type OAuth2 struct {
@@ -74,7 +75,7 @@ func (cfg *Config) auth() pulsar.Authentication {
7475
return pulsar.NewAuthenticationTLS(authentication.TLS.CertFile, authentication.TLS.KeyFile)
7576
}
7677
if authentication.Token != nil {
77-
return pulsar.NewAuthenticationToken(authentication.Token.Token)
78+
return pulsar.NewAuthenticationToken(string(authentication.Token.Token))
7879
}
7980
if authentication.OAuth2 != nil {
8081
return pulsar.NewAuthenticationOAuth2(map[string]string{
@@ -88,7 +89,7 @@ func (cfg *Config) auth() pulsar.Authentication {
8889
"providerDomain": authentication.Athenz.ProviderDomain,
8990
"tenantDomain": authentication.Athenz.TenantDomain,
9091
"tenantService": authentication.Athenz.TenantService,
91-
"privateKey": authentication.Athenz.PrivateKey,
92+
"privateKey": string(authentication.Athenz.PrivateKey),
9293
"keyId": authentication.Athenz.KeyID,
9394
"principalHeader": authentication.Athenz.PrincipalHeader,
9495
"ztsUrl": authentication.Athenz.ZtsURL,

receiver/pulsarreceiver/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/openzipkin/zipkin-go v0.4.1
1313
github.com/stretchr/testify v1.8.4
1414
go.opentelemetry.io/collector/component v0.81.0
15+
go.opentelemetry.io/collector/config/configopaque v0.81.0
1516
go.opentelemetry.io/collector/confmap v0.81.0
1617
go.opentelemetry.io/collector/consumer v0.81.0
1718
go.opentelemetry.io/collector/pdata v1.0.0-rcv0013

receiver/pulsarreceiver/go.sum

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)