Back to godoc.org
bosun.org / annotate

Package annotate

v0.0.0-...-8a7cd2d
Latest Go to latest

The latest major version is .

Published: Jun 18, 2020 | License: MIT | Module: bosun.org

Index

Constants

const (
	Message      = "Message"
	StartDate    = "StartDate"
	EndDate      = "EndDate"
	Source       = "Source"
	Host         = "Host"
	CreationUser = "CreationUser"
	Owner        = "Owner"
	Category     = "Category"
	Url          = "Url"
)

type Annotation

type Annotation struct {
	AnnotationFields
	StartDate RFC3339
	EndDate   RFC3339
}

func NewAnnotation

func NewAnnotation(id string, start, end time.Time, user, owner, source, host, category, url, message string) (a Annotation)

func (*Annotation) AsEpochAnnotation

func (a *Annotation) AsEpochAnnotation() (ea EpochAnnotation)

func (Annotation) Ask

func (a Annotation) Ask(filter string) (bool, error)

Ask makes it so annotations can be filtered in memory using github.com/kylebrandt/boolq

func (*Annotation) IsOneTimeSet

func (a *Annotation) IsOneTimeSet() bool

func (*Annotation) IsTimeNotSet

func (a *Annotation) IsTimeNotSet() bool

func (*Annotation) MatchTimes

func (a *Annotation) MatchTimes()

Match Times Sets Both times to the greater of the two times

func (*Annotation) SetNow

func (a *Annotation) SetNow()

func (*Annotation) ValidateTime

func (a *Annotation) ValidateTime() error

type AnnotationFields

type AnnotationFields struct {
	Id           string
	Message      string
	CreationUser string
	Url          string
	Source       string
	Host         string
	Owner        string
	Category     string
}

type Annotations

type Annotations []Annotation

func (Annotations) AsEpochAnnotations

func (as Annotations) AsEpochAnnotations() EpochAnnotations

type AnnotationsByStartID

type AnnotationsByStartID Annotations

AnnotationsByStartID is a Type to sort by start time then by id

func (AnnotationsByStartID) Len

func (b AnnotationsByStartID) Len() int

func (AnnotationsByStartID) Less

func (b AnnotationsByStartID) Less(i, j int) bool

func (AnnotationsByStartID) Swap

func (b AnnotationsByStartID) Swap(i, j int)

type Client

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

func NewClient

func NewClient(apiRoot string) Client

func (*Client) GetAnnotation

func (c *Client) GetAnnotation(id string) (*Annotation, error)

GetAnnotation gets an annotation by ID, and will return nil without an error if the annotation does not exist

func (*Client) GetAnnotations

func (c *Client) GetAnnotations(start, end *time.Time, source, host, creationUser, owner, category, url, message string) (Annotations, error)

func (*Client) SendAnnotation

func (c *Client) SendAnnotation(a Annotation) (Annotation, error)

SendAnnotation sends a annotation to an annotations server apiRoot should be "http://foo/api" where the annotation routes would be available at http://foo/api/annotation...

type Epoch

type Epoch struct {
	time.Time
}

func (Epoch) MarshalJSON

func (t Epoch) MarshalJSON() ([]byte, error)

func (*Epoch) UnmarshalJSON

func (t *Epoch) UnmarshalJSON(b []byte) (err error)

type EpochAnnotation

type EpochAnnotation struct {
	AnnotationFields
	StartDate Epoch
	EndDate   Epoch
}

func (*EpochAnnotation) AsAnnotation

func (ea *EpochAnnotation) AsAnnotation() (a Annotation)

type EpochAnnotations

type EpochAnnotations []EpochAnnotation

type RFC3339

type RFC3339 struct {
	time.Time
}

func (RFC3339) MarshalJSON

func (t RFC3339) MarshalJSON() ([]byte, error)

func (*RFC3339) UnmarshalJSON

func (t *RFC3339) UnmarshalJSON(b []byte) (err error)

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier