Documentation
¶
Index ¶
- type Authorization
- type BasicAuthConfig
- type Config
- func (ac *Config) GetAuthHeader() (string, error)
- func (ac *Config) GetHTTPHeadersNoAuth() http.Header
- func (ac *Config) GetTLSConfig() (*tls.Config, error)
- func (ac *Config) HeadersNoAuthString() string
- func (ac *Config) NewRoundTripper(trBase *http.Transport) http.RoundTripper
- func (ac *Config) NewRoundTripperFromGetter(get func(tls *tls.Config) http.RoundTripper) http.RoundTripper
- func (ac *Config) SetHeaders(req *http.Request, setAuthHeader bool) error
- func (ac *Config) String() string
- type HTTPClientConfig
- type OAuth2Config
- type Options
- type ProxyClientConfig
- type Secret
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶ added in v1.58.0
type Authorization struct {
Type string `yaml:"type,omitempty"`
Credentials *Secret `yaml:"credentials,omitempty"`
CredentialsFile string `yaml:"credentials_file,omitempty"`
}
Authorization represents generic authorization config.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/
type BasicAuthConfig ¶
type BasicAuthConfig struct {
Username string `yaml:"username,omitempty"`
UsernameFile string `yaml:"username_file,omitempty"`
Password *Secret `yaml:"password,omitempty"`
PasswordFile string `yaml:"password_file,omitempty"`
}
BasicAuthConfig represents basic auth config.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is auth config.
func (*Config) GetAuthHeader ¶ added in v1.60.0
GetAuthHeader returns optional `Authorization: ...` http header.
func (*Config) GetHTTPHeadersNoAuth ¶ added in v1.97.7
GetHTTPHeadersNoAuth returns http formatted headers without Authorization header
func (*Config) GetTLSConfig ¶ added in v1.97.7
GetTLSConfig returns cached tls configuration
func (*Config) HeadersNoAuthString ¶ added in v1.79.0
HeadersNoAuthString returns string representation of ac headers
func (*Config) NewRoundTripper ¶ added in v1.97.7
func (ac *Config) NewRoundTripper(trBase *http.Transport) http.RoundTripper
NewRoundTripper returns new http.RoundTripper for the given ac, which uses the given trBase as base transport.
The caller shouldn't change the trBase, since the returned RoundTripper owns it.
func (*Config) NewRoundTripperFromGetter ¶ added in v1.97.10
func (ac *Config) NewRoundTripperFromGetter(get func(tls *tls.Config) http.RoundTripper) http.RoundTripper
NewRoundTripperFromGetter returns new http.RoundTripper for the given ac, which uses the given get as transport getter.
func (*Config) SetHeaders ¶ added in v1.79.0
SetHeaders sets the configured ac headers to req.
type HTTPClientConfig ¶ added in v1.58.0
type HTTPClientConfig struct {
Authorization *Authorization `yaml:"authorization,omitempty"`
BasicAuth *BasicAuthConfig `yaml:"basic_auth,omitempty"`
BearerToken *Secret `yaml:"bearer_token,omitempty"`
BearerTokenFile string `yaml:"bearer_token_file,omitempty"`
OAuth2 *OAuth2Config `yaml:"oauth2,omitempty"`
TLSConfig *TLSConfig `yaml:"tls_config,omitempty"`
// Headers contains optional HTTP headers, which must be sent in the request to the server
Headers []string `yaml:"headers,omitempty"`
// FollowRedirects specifies whether the client should follow HTTP 3xx redirects.
FollowRedirects *bool `yaml:"follow_redirects,omitempty"`
}
HTTPClientConfig represents http client config.
type OAuth2Config ¶ added in v1.60.0
type OAuth2Config struct {
ClientID string `yaml:"client_id"`
ClientSecret *Secret `yaml:"client_secret,omitempty"`
ClientSecretFile string `yaml:"client_secret_file,omitempty"`
Scopes []string `yaml:"scopes,omitempty"`
TokenURL string `yaml:"token_url"`
EndpointParams map[string]string `yaml:"endpoint_params,omitempty"`
TLSConfig *TLSConfig `yaml:"tls_config,omitempty"`
ProxyURL string `yaml:"proxy_url,omitempty"`
}
OAuth2Config represent OAuth2 configuration
type Options ¶ added in v1.79.0
type Options struct {
// BaseDir is an optional path to a base directory for resolving
// relative filepaths in various config options.
//
// It is set to the current directory by default.
BaseDir string
// Authorization contains optional Authorization.
Authorization *Authorization
// BasicAuth contains optional BasicAuthConfig.
BasicAuth *BasicAuthConfig
// BearerToken contains optional bearer token.
BearerToken string
// BearerTokenFile contains optional path to a file with bearer token.
BearerTokenFile string
// OAuth2 contains optional OAuth2Config.
OAuth2 *OAuth2Config
// TLSconfig contains optional TLSConfig.
TLSConfig *TLSConfig
// Headers contains optional http request headers in the form 'Foo: bar'.
Headers []string
}
Options contain options, which must be passed to NewConfig.
type ProxyClientConfig ¶ added in v1.58.0
type ProxyClientConfig struct {
Authorization *Authorization `yaml:"proxy_authorization,omitempty"`
BasicAuth *BasicAuthConfig `yaml:"proxy_basic_auth,omitempty"`
BearerToken *Secret `yaml:"proxy_bearer_token,omitempty"`
BearerTokenFile string `yaml:"proxy_bearer_token_file,omitempty"`
OAuth2 *OAuth2Config `yaml:"proxy_oauth2,omitempty"`
TLSConfig *TLSConfig `yaml:"proxy_tls_config,omitempty"`
// Headers contains optional HTTP headers, which must be sent in the request to the proxy
Headers []string `yaml:"proxy_headers,omitempty"`
}
ProxyClientConfig represents proxy client config.
type Secret ¶ added in v1.69.0
type Secret struct {
S string
}
Secret represents a string secret such as password or auth token.
It is marshaled to "<secret>" string in yaml.
This is needed for hiding secret strings in /config page output. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1764
func (*Secret) MarshalYAML ¶ added in v1.69.0
MarshalYAML implements yaml.Marshaler interface.
It substitutes the secret with "<secret>" string.
type TLSConfig ¶
type TLSConfig struct {
CA string `yaml:"ca,omitempty"`
CAFile string `yaml:"ca_file,omitempty"`
Cert string `yaml:"cert,omitempty"`
CertFile string `yaml:"cert_file,omitempty"`
Key string `yaml:"key,omitempty"`
KeyFile string `yaml:"key_file,omitempty"`
ServerName string `yaml:"server_name,omitempty"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify,omitempty"`
MinVersion string `yaml:"min_version,omitempty"`
}
TLSConfig represents TLS config.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#tls_config