psd

package module
v0.0.0-...-37e74ed Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: LGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultUserAgent is the default user agent used by the client
	DefaultUserAgent = "Go-PSD-client/v0.0.0"
	// DefaultMaxRetries is the default number of retries for failed requests
	DefaultMaxRetries = 3
	// DefaultMaxIdleConns is the maximum number of idle connections across all hosts.
	DefaultMaxIdleConns = 256
	// DefaultMaxIdleConnsPerHost is the maximum idle connections per host.
	DefaultMaxIdleConnsPerHost = 256
	// DefaultMaxConnsPerHost is the maximum total connections per host.
	DefaultMaxConnsPerHost = 256
	// DefaultIdleConnTimeout controls how long idle keep-alive connections stay around.
	DefaultIdleConnTimeout = 90 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the client to interact with the Prometheus Service Discovery HTTP API

func NewClient

func NewClient(baseURL, login, password string, userAgentOverride ...string) *Client

NewClient returns a new PSD client

func (*Client) Get

func (p *Client) Get(identifier string) (Items, error)

Get returns the list of targets for the given identifier

func (*Client) GetRaw

func (p *Client) GetRaw(ctx context.Context, identifier string, jobOverride ...string) ([]byte, error)

GetRaw returns the raw data for the given identifier, without using the cache or parsing the response. Do not use this method unless you need the raw data, as it does not parse the response

func (*Client) GetWithContext

func (p *Client) GetWithContext(ctx context.Context, identifier string, jobOverride ...string) (Items, error)

GetWithContext returns the list of targets for the given identifier using the given context

type Item

type Item struct {
	Targets []string          `json:"targets"`
	Labels  map[string]string `json:"labels"`
}

Item is a struct that represents a single set of targets in Prometheus Service Discovery

func (*Item) GetDomain

func (i *Item) GetDomain() string

GetDomain returns the domain of the target

type Items

type Items []*Item

Items is a slice of Prometheus Service Discovery items

func (Items) Contains

func (items Items) Contains(needle string) bool

Contains - check if target exists in service discovery items

func (Items) ContainsDelegation

func (items Items) ContainsDelegation() bool

ContainsDelegation - check if service discovery items contain matrix server delegation endpoint

func (Items) ContainsDiscovery

func (items Items) ContainsDiscovery() bool

ContainsDiscovery - check if service discovery items contain matrix client discovery endpoint

func (Items) ContainsFederation

func (items Items) ContainsFederation() bool

ContainsFederation - check if service discovery items contain matrix federation endpoint

func (Items) ContainsMSC1929

func (items Items) ContainsMSC1929() bool

ContainsMSC1929 - check if service discovery items contain matrix MSC1929 endpoint

func (Items) ContainsSuffix

func (items Items) ContainsSuffix(needle string) bool

ContainsSuffix - check if any target in service discovery items ends with the given suffix

func (Items) GetDomains

func (items Items) GetDomains() []string

GetDomains - get domains from service discovery labels

Jump to

Keyboard shortcuts

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