config

package
v1.2.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config contains types from github.com/prometheus/common/config, but modifies them to be serializable with Alloy.

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPClientConfig = HTTPClientConfig{
	FollowRedirects: true,
	EnableHTTP2:     true,
}

DefaultHTTPClientConfig for initializing objects

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	Type            string            `alloy:"type,attr,optional"`
	Credentials     alloytypes.Secret `alloy:"credentials,attr,optional"`
	CredentialsFile string            `alloy:"credentials_file,attr,optional"`
}

Authorization sets up HTTP authorization credentials.

func (*Authorization) Convert

func (a *Authorization) Convert() *config.Authorization

Convert converts our type to the native prometheus type

func (*Authorization) Validate

func (a *Authorization) Validate() error

type BasicAuth

type BasicAuth struct {
	Username     string            `alloy:"username,attr,optional"`
	Password     alloytypes.Secret `alloy:"password,attr,optional"`
	PasswordFile string            `alloy:"password_file,attr,optional"`
}

BasicAuth configures Basic HTTP authentication credentials.

func (*BasicAuth) Convert

func (b *BasicAuth) Convert() *config.BasicAuth

Convert converts our type to the native prometheus type

func (*BasicAuth) Validate

func (b *BasicAuth) Validate() error

type HTTPClientConfig

type HTTPClientConfig struct {
	BasicAuth       *BasicAuth        `alloy:"basic_auth,block,optional"`
	Authorization   *Authorization    `alloy:"authorization,block,optional"`
	OAuth2          *OAuth2Config     `alloy:"oauth2,block,optional"`
	BearerToken     alloytypes.Secret `alloy:"bearer_token,attr,optional"`
	BearerTokenFile string            `alloy:"bearer_token_file,attr,optional"`
	ProxyConfig     *ProxyConfig      `alloy:",squash"`
	TLSConfig       TLSConfig         `alloy:"tls_config,block,optional"`
	FollowRedirects bool              `alloy:"follow_redirects,attr,optional"`
	EnableHTTP2     bool              `alloy:"enable_http2,attr,optional"`
}

HTTPClientConfig mirrors config.HTTPClientConfig

func CloneDefaultHTTPClientConfig

func CloneDefaultHTTPClientConfig() *HTTPClientConfig

Clone creates a shallow clone of h.

func (*HTTPClientConfig) Convert

Convert converts HTTPClientConfig to the native Prometheus type. If h is nil, the default client config is returned.

func (*HTTPClientConfig) SetToDefault

func (h *HTTPClientConfig) SetToDefault()

SetToDefault implements the syntax.Defaulter

func (*HTTPClientConfig) Validate

func (h *HTTPClientConfig) Validate() error

Validate returns an error if h is invalid.

type Header struct {
	Header map[string][]alloytypes.Secret `alloy:"proxy_connect_header,attr,optional"`
}

func (*Header) Convert

func (h *Header) Convert() config.Header

type LabelSelector

type LabelSelector struct {
	MatchLabels      map[string]string `alloy:"match_labels,attr,optional"`
	MatchExpressions []MatchExpression `alloy:"match_expression,block,optional"`
}

LabelSelector defines a selector to check to see if a set of Kubernetes labels matches a selector.

func (*LabelSelector) BuildSelector

func (ls *LabelSelector) BuildSelector() (labels.Selector, error)

BuildSelector builds a labels.Selector from an Alloy LabelSelector.

type MatchExpression

type MatchExpression struct {
	Key      string   `alloy:"key,attr"`
	Operator string   `alloy:"operator,attr"`
	Values   []string `alloy:"values,attr,optional"`
}

MatchExpression defines an expression matcher to check to see if some key from a Kubernetes resource matches a selector.

type OAuth2Config

type OAuth2Config struct {
	ClientID         string            `alloy:"client_id,attr,optional"`
	ClientSecret     alloytypes.Secret `alloy:"client_secret,attr,optional"`
	ClientSecretFile string            `alloy:"client_secret_file,attr,optional"`
	Scopes           []string          `alloy:"scopes,attr,optional"`
	TokenURL         string            `alloy:"token_url,attr,optional"`
	EndpointParams   map[string]string `alloy:"endpoint_params,attr,optional"`
	ProxyConfig      *ProxyConfig      `alloy:",squash"`
	TLSConfig        *TLSConfig        `alloy:"tls_config,block,optional"`
}

OAuth2Config sets up the OAuth2 client.

func (*OAuth2Config) Convert

func (o *OAuth2Config) Convert() *config.OAuth2

Convert converts our type to the native prometheus type

func (*OAuth2Config) Validate

func (o *OAuth2Config) Validate() error

type ProxyConfig

type ProxyConfig struct {
	ProxyURL             URL    `alloy:"proxy_url,attr,optional"`
	NoProxy              string `alloy:"no_proxy,attr,optional"`
	ProxyFromEnvironment bool   `alloy:"proxy_from_environment,attr,optional"`
	ProxyConnectHeader   Header `alloy:",squash"`
}

func (*ProxyConfig) Convert

func (p *ProxyConfig) Convert() config.ProxyConfig

func (*ProxyConfig) Validate

func (p *ProxyConfig) Validate() error

type TLSConfig

type TLSConfig struct {
	CA                 string            `alloy:"ca_pem,attr,optional"`
	CAFile             string            `alloy:"ca_file,attr,optional"`
	Cert               string            `alloy:"cert_pem,attr,optional"`
	CertFile           string            `alloy:"cert_file,attr,optional"`
	Key                alloytypes.Secret `alloy:"key_pem,attr,optional"`
	KeyFile            string            `alloy:"key_file,attr,optional"`
	ServerName         string            `alloy:"server_name,attr,optional"`
	InsecureSkipVerify bool              `alloy:"insecure_skip_verify,attr,optional"`
	MinVersion         TLSVersion        `alloy:"min_version,attr,optional"`
}

TLSConfig sets up options for TLS connections.

func (*TLSConfig) Convert

func (t *TLSConfig) Convert() *config.TLSConfig

Convert converts our type to the native prometheus type

func (*TLSConfig) Validate

func (t *TLSConfig) Validate() error

Validate reports whether t is valid.

type TLSVersion

type TLSVersion uint16

TLSVersion mirrors config.TLSVersion

func (TLSVersion) MarshalText

func (tv TLSVersion) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*TLSVersion) UnmarshalText

func (tv *TLSVersion) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type URL

type URL struct {
	*url.URL
}

URL mirrors config.URL

func (*URL) Convert

func (u *URL) Convert() config.URL

Convert converts our type to the native prometheus type

func (URL) MarshalText

func (u URL) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL