diff --git a/.chloggen/nsxt-use-configopaque.yaml b/.chloggen/nsxt-use-configopaque.yaml new file mode 100755 index 0000000000000..6fdc554a4e36c --- /dev/null +++ b/.chloggen/nsxt-use-configopaque.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/nsxt + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Change the type of `Config.Password` to be `configopaque.String` + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [17273] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/receiver/nsxtreceiver/client.go b/receiver/nsxtreceiver/client.go index fcc3ea0d38e6f..ee25688e2c300 100644 --- a/receiver/nsxtreceiver/client.go +++ b/receiver/nsxtreceiver/client.go @@ -152,7 +152,7 @@ func (c *nsxClient) doRequest(ctx context.Context, path string) ([]byte, error) if err != nil { return nil, err } - req.SetBasicAuth(c.config.Username, c.config.Password) + req.SetBasicAuth(c.config.Username, string(c.config.Password)) h := req.Header h.Add("User-Agent", "opentelemetry-collector") h.Add("Accept", "application/json") diff --git a/receiver/nsxtreceiver/config.go b/receiver/nsxtreceiver/config.go index c608ac9c08a23..302f34d599bee 100644 --- a/receiver/nsxtreceiver/config.go +++ b/receiver/nsxtreceiver/config.go @@ -9,6 +9,7 @@ import ( "net/url" "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configopaque" "go.opentelemetry.io/collector/receiver/scraperhelper" "go.uber.org/multierr" @@ -20,8 +21,8 @@ type Config struct { scraperhelper.ScraperControllerSettings `mapstructure:",squash"` confighttp.HTTPClientSettings `mapstructure:",squash"` metadata.MetricsBuilderConfig `mapstructure:",squash"` - Username string `mapstructure:"username"` - Password string `mapstructure:"password"` + Username string `mapstructure:"username"` + Password configopaque.String `mapstructure:"password"` } // Validate returns if the NSX configuration is valid diff --git a/receiver/nsxtreceiver/go.mod b/receiver/nsxtreceiver/go.mod index 42402f59d64f3..677eaa1872063 100644 --- a/receiver/nsxtreceiver/go.mod +++ b/receiver/nsxtreceiver/go.mod @@ -10,6 +10,7 @@ require ( github.com/vmware/go-vmware-nsxt v0.0.0-20220328155605-f49a14c1ef5f go.opentelemetry.io/collector/component v0.81.0 go.opentelemetry.io/collector/config/confighttp v0.81.0 + go.opentelemetry.io/collector/config/configopaque v0.81.0 go.opentelemetry.io/collector/confmap v0.81.0 go.opentelemetry.io/collector/consumer v0.81.0 go.opentelemetry.io/collector/pdata v1.0.0-rcv0013 @@ -45,7 +46,6 @@ require ( go.opentelemetry.io/collector v0.81.0 // indirect go.opentelemetry.io/collector/config/configauth v0.81.0 // indirect go.opentelemetry.io/collector/config/configcompression v0.81.0 // indirect - go.opentelemetry.io/collector/config/configopaque v0.81.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.81.0 // indirect go.opentelemetry.io/collector/config/configtls v0.81.0 // indirect go.opentelemetry.io/collector/config/internal v0.81.0 // indirect