...

Package client

import "github.com/prometheus/alertmanager/api/v2/client"
Overview
Index
Subdirectories

Overview ▾

Constants

const (
    // DefaultHost is the default Host
    // found in Meta (info) section of spec file
    DefaultHost string = "localhost"
    // DefaultBasePath is the default BasePath
    // found in Meta (info) section of spec file
    DefaultBasePath string = "/api/v2/"
)

Variables

Default alertmanager API HTTP client.

var Default = NewHTTPClient(nil)

DefaultSchemes are the default schemes found in Meta (info) section of spec file

var DefaultSchemes = []string{"http"}

type AlertmanagerAPI

AlertmanagerAPI is a client for alertmanager API

type AlertmanagerAPI struct {
    Alert alert.ClientService

    Alertgroup alertgroup.ClientService

    General general.ClientService

    Receiver receiver.ClientService

    Silence silence.ClientService

    Transport runtime.ClientTransport
}

func New

func New(transport runtime.ClientTransport, formats strfmt.Registry) *AlertmanagerAPI

New creates a new alertmanager API client

func NewHTTPClient

func NewHTTPClient(formats strfmt.Registry) *AlertmanagerAPI

NewHTTPClient creates a new alertmanager API HTTP client.

func NewHTTPClientWithConfig

func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *AlertmanagerAPI

NewHTTPClientWithConfig creates a new alertmanager API HTTP client, using a customizable transport config.

func (*AlertmanagerAPI) SetTransport

func (c *AlertmanagerAPI) SetTransport(transport runtime.ClientTransport)

SetTransport changes the transport on the client and all its subresources

type TransportConfig

TransportConfig contains the transport related info, found in the meta section of the spec file.

type TransportConfig struct {
    Host     string
    BasePath string
    Schemes  []string
}

func DefaultTransportConfig

func DefaultTransportConfig() *TransportConfig

DefaultTransportConfig creates a TransportConfig with the default settings taken from the meta section of the spec file.

func (*TransportConfig) WithBasePath

func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig

WithBasePath overrides the default basePath, provided by the meta section of the spec file.

func (*TransportConfig) WithHost

func (cfg *TransportConfig) WithHost(host string) *TransportConfig

WithHost overrides the default host, provided by the meta section of the spec file.

func (*TransportConfig) WithSchemes

func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig

WithSchemes overrides the default schemes, provided by the meta section of the spec file.

Subdirectories