config.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package podmanreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver"
  4. import (
  5. "errors"
  6. "go.opentelemetry.io/collector/component"
  7. "go.opentelemetry.io/collector/config/configopaque"
  8. "go.opentelemetry.io/collector/receiver/scraperhelper"
  9. )
  10. var _ component.Config = (*Config)(nil)
  11. type Config struct {
  12. scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
  13. // The URL of the podman server. Default is "unix:///run/podman/podman.sock"
  14. Endpoint string `mapstructure:"endpoint"`
  15. APIVersion string `mapstructure:"api_version"`
  16. SSHKey string `mapstructure:"ssh_key"`
  17. SSHPassphrase configopaque.String `mapstructure:"ssh_passphrase"`
  18. }
  19. func (config Config) Validate() error {
  20. if config.Endpoint == "" {
  21. return errors.New("config.Endpoint must be specified")
  22. }
  23. if config.CollectionInterval == 0 {
  24. return errors.New("config.CollectionInterval must be specified")
  25. }
  26. return nil
  27. }