datadog

package
v0.0.0-...-61a96ab Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilFunction is returned if the passed parameter is nil.
	ErrNilFunction = errors.New("nil argument function")

	// ErrInvalidFunctionType is returned if the function does not have the correct signature.
	ErrInvalidFunctionType = errors.New("invalid function type")
)
View Source
var (
	// ErrInvalidComponentTypeID is returned when invalid type ID is used.
	ErrInvalidComponentTypeID = errors.New("invalid component type ID")
)

Functions

This section is empty.

Types

type Component

type Component struct {
	Type types.Component `json:"type"`

	Dashboard   json.RawMessage                 `json:"dashboard,omitempty"`
	Monitor     *client.MonitorWithDependencies `json:"monitor,omitempty"`
	Downtime    json.RawMessage                 `json:"downtime,omitempty"`
	ScreenBoard json.RawMessage                 `json:"screenboard,omitempty"`
}

Component represents a structure of a watchdog component which holds one of datadog component (dashboard, monitor etc.)

type Datadog

type Datadog struct {
	Client *client.Client
	// contains filtered or unexported fields
}

Datadog is a abstraction over datadog api library. The abstraction provides simplified interface to query datadog API.

func New

func New(apiKey, appKey string, c *client.Client, opts ...Option) (*Datadog, error)

New returns a new implementation of datadog APIs.

func (*Datadog) Update

func (dd *Datadog) Update(component *Component) error

Update will restore a datadog component from bytes.

func (*Datadog) Write

func (dd *Datadog) Write(component types.Component, id int, to io.Writer) error

Write takes a datadog component type ID (dashboard, monitor etc.), id from a datadog and queries the corresponding datadog API. The the JSON response will be written to io.Writer.

type Option

type Option func(datadog *Datadog) error

Option is a functional parameter interface for datadog constructor

func WithAccessorGetFn

func WithAccessorGetFn(component types.Component, fn func(int) (json.RawMessage, error)) Option

WithAccessorGetFn is a functional parameter to set the get functions.

func WithAccessorUpdateFn

func WithAccessorUpdateFn(component types.Component, fn func(json.RawMessage) error) Option

WithAccessorUpdateFn is a functional parameter to set the update functions.

func WithMonitorGetFn

func WithMonitorGetFn(fn func(int, bool) (*client.MonitorWithDependencies, error)) Option

WithMonitorGetFn is a functional parameter to set the dashboard get function.

func WithMonitorSetFn

func WithMonitorSetFn(fn func(*client.MonitorWithDependencies) error) Option

WithMonitorSetFn is a functional parameter that sets the update monitor function.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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