icinga2

package
v0.0.0-...-c12697c Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("service not found")
	ErrForbidden    = errors.New("forbidden")
	ErrUnauthorized = errors.New("unauthorized")
	ErrUnknown      = errors.New("unknown error")
)

Functions

This section is empty.

Types

type Checkable

type Checkable interface {
	GetCheckCommand() string
	GetVars() Vars
	GetNotes() string
	GetNotesURL() string
}

type Client

type Client interface {
	GetHost(string) (Host, error)
	CreateHost(Host) error
	ListHosts() ([]Host, error)
	DeleteHost(string) error
	UpdateHost(Host) error

	GetHostGroup(string) (HostGroup, error)
	CreateHostGroup(HostGroup) error
	ListHostGroups() ([]HostGroup, error)
	DeleteHostGroup(string) error
	UpdateHostGroup(HostGroup) error

	GetService(string) (Service, error)
	CreateService(Service) error
	ListServices() ([]Service, error)
	DeleteService(string) error
	UpdateService(Service) error
}

type Host

type Host struct {
	Name         string   `json:"display_name"`
	Address      string   `json:"address,omitempty"`
	Address6     string   `json:"address6,omitempty"`
	CheckCommand string   `json:"check_command,omitempty"`
	Notes        string   `json:"notes"`
	NotesURL     string   `json:"notes_url"`
	Vars         Vars     `json:"vars"`
	Groups       []string `json:"groups,omitempty"`
	Zone         string   `json:"zone,omitempty"`
}

func (Host) GetCheckCommand

func (h Host) GetCheckCommand() string

func (Host) GetNotes

func (h Host) GetNotes() string

func (Host) GetNotesURL

func (h Host) GetNotesURL() string

func (Host) GetVars

func (h Host) GetVars() Vars

type HostCreate

type HostCreate struct {
	Templates []string `json:"templates"`
	Attrs     Host     `json:"attrs"`
}

type HostGroup

type HostGroup struct {
	Name string `json:"display_name,omitempty"`
	Vars Vars   `json:"vars"`
	Zone string `json:"zone,omitempty"`
}

func (HostGroup) GetVars

func (hg HostGroup) GetVars() Vars

type HostGroupCreate

type HostGroupCreate struct {
	Templates []string  `json:"templates"`
	Attrs     HostGroup `json:"attrs"`
}

type HostGroupResults

type HostGroupResults struct {
	Results []struct {
		HostGroup HostGroup `json:"attrs"`
	} `json:"results"`
}

type HostResults

type HostResults struct {
	Results []struct {
		Host Host `json:"attrs"`
	} `json:"results"`
}

type MockClient

type MockClient struct {
	Hostgroups map[string]HostGroup
	Hosts      map[string]Host
	Services   map[string]Service
	// contains filtered or unexported fields
}

func NewMockClient

func NewMockClient() (c *MockClient)

func (*MockClient) CreateHost

func (s *MockClient) CreateHost(host Host) error

func (*MockClient) CreateHostGroup

func (s *MockClient) CreateHostGroup(hostGroup HostGroup) error

func (*MockClient) CreateService

func (s *MockClient) CreateService(service Service) error

func (*MockClient) DeleteHost

func (s *MockClient) DeleteHost(name string) error

func (*MockClient) DeleteHostGroup

func (s *MockClient) DeleteHostGroup(name string) error

func (*MockClient) DeleteService

func (s *MockClient) DeleteService(name string) error

func (*MockClient) GetHost

func (s *MockClient) GetHost(name string) (Host, error)

func (*MockClient) GetHostGroup

func (s *MockClient) GetHostGroup(name string) (HostGroup, error)

func (*MockClient) GetService

func (s *MockClient) GetService(name string) (Service, error)

func (*MockClient) ListHostGroups

func (s *MockClient) ListHostGroups() ([]HostGroup, error)

func (*MockClient) ListHosts

func (s *MockClient) ListHosts() ([]Host, error)

func (*MockClient) ListServices

func (s *MockClient) ListServices() ([]Service, error)

func (*MockClient) UpdateHost

func (s *MockClient) UpdateHost(host Host) error

func (*MockClient) UpdateHostGroup

func (s *MockClient) UpdateHostGroup(hostGroup HostGroup) error

func (*MockClient) UpdateService

func (s *MockClient) UpdateService(service Service) error

type Object

type Object interface {
	GetVars() Vars
}

type Results

type Results struct {
	Results []struct {
		Code   float64  `json:"code"`
		Errors []string `json:"errors,omitempty"`
		Status string   `json:"status,omitempty"`
		Name   string   `json:"name,omitempty"`
		Type   string   `json:"type,omitempty"`
	} `json:"results"`
}

type Service

type Service struct {
	Name         string `json:"display_name"`
	HostName     string `json:"host_name"`
	CheckCommand string `json:"check_command"`
	Notes        string `json:"notes"`
	NotesURL     string `json:"notes_url"`
	Vars         Vars   `json:"vars"`
	Zone         string `json:"zone,omitempty"`
}

func (*Service) FullName

func (s *Service) FullName() string

func (Service) GetCheckCommand

func (s Service) GetCheckCommand() string

func (Service) GetNotes

func (s Service) GetNotes() string

func (Service) GetNotesURL

func (s Service) GetNotesURL() string

func (Service) GetVars

func (s Service) GetVars() Vars

type ServiceCreate

type ServiceCreate struct {
	Attrs Service `json:"attrs"`
}

type ServiceResults

type ServiceResults struct {
	Results []struct {
		Service Service `json:"attrs"`
	} `json:"results"`
}

type Vars

type Vars map[string]interface{}

type WebClient

type WebClient struct {
	URL         string
	Username    string
	Password    string
	Debug       bool
	InsecureTLS bool
	Zone        string
	// contains filtered or unexported fields
}

func New

func New(s WebClient) (*WebClient, error)

func (*WebClient) CreateHost

func (s *WebClient) CreateHost(host Host) error

func (*WebClient) CreateHostGroup

func (s *WebClient) CreateHostGroup(hostGroup HostGroup) error

func (*WebClient) CreateObject

func (s *WebClient) CreateObject(path string, create interface{}) error

func (*WebClient) CreateService

func (s *WebClient) CreateService(service Service) error

func (*WebClient) DeleteHost

func (s *WebClient) DeleteHost(name string) (err error)

func (*WebClient) DeleteHostGroup

func (s *WebClient) DeleteHostGroup(name string) (err error)

func (*WebClient) DeleteService

func (s *WebClient) DeleteService(name string) (err error)

func (*WebClient) GetHost

func (s *WebClient) GetHost(name string) (Host, error)

func (*WebClient) GetHostGroup

func (s *WebClient) GetHostGroup(name string) (HostGroup, error)

func (*WebClient) GetService

func (s *WebClient) GetService(name string) (Service, error)

func (*WebClient) ListHostGroups

func (s *WebClient) ListHostGroups() (hostGroups []HostGroup, err error)

func (*WebClient) ListHosts

func (s *WebClient) ListHosts() (hosts []Host, err error)

func (*WebClient) ListServices

func (s *WebClient) ListServices() (services []Service, err error)

func (*WebClient) UpdateHost

func (s *WebClient) UpdateHost(host Host) error

func (*WebClient) UpdateHostGroup

func (s *WebClient) UpdateHostGroup(hostGroup HostGroup) error

func (*WebClient) UpdateObject

func (s *WebClient) UpdateObject(path string, create interface{}) error

func (*WebClient) UpdateService

func (s *WebClient) UpdateService(service Service) error

Jump to

Keyboard shortcuts

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