rule

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalJSON

func UnmarshalJSON(b []byte) (influxdb.NotificationRule, error)

UnmarshalJSON will convert

Types

type Base

type Base struct {
	ID          platform.ID `json:"id,omitempty"`
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	EndpointID  platform.ID `json:"endpointID,omitempty"`
	OrgID       platform.ID `json:"orgID,omitempty"`
	OwnerID     platform.ID `json:"ownerID,omitempty"`
	TaskID      platform.ID `json:"taskID,omitempty"`
	// SleepUntil is an optional sleeptime to start a task.
	SleepUntil *time.Time             `json:"sleepUntil,omitempty"`
	Every      *notification.Duration `json:"every,omitempty"`
	// Offset represents a delay before execution.
	// It gets marshalled from a string duration, i.e.: "10s" is 10 seconds
	Offset      *notification.Duration    `json:"offset,omitempty"`
	RunbookLink string                    `json:"runbookLink"`
	TagRules    []notification.TagRule    `json:"tagRules,omitempty"`
	StatusRules []notification.StatusRule `json:"statusRules,omitempty"`
	*influxdb.Limit
	influxdb.CRUDLog
}

Base is the embed struct of every notification rule.

func (*Base) ClearPrivateData

func (b *Base) ClearPrivateData()

ClearPrivateData clears the task ID from the base.

func (Base) GetCRUDLog

func (b Base) GetCRUDLog() influxdb.CRUDLog

GetCRUDLog implements influxdb.Getter interface.

func (*Base) GetDescription

func (b *Base) GetDescription() string

GetDescription implements influxdb.Getter interface.

func (Base) GetEndpointID

func (b Base) GetEndpointID() platform.ID

GetEndpointID gets the endpointID for a base.

func (Base) GetID

func (b Base) GetID() platform.ID

GetID implements influxdb.Getter interface.

func (*Base) GetLimit

func (b *Base) GetLimit() *influxdb.Limit

GetLimit returns the limit pointer.

func (*Base) GetName

func (b *Base) GetName() string

GetName implements influxdb.Getter interface.

func (Base) GetOrgID

func (b Base) GetOrgID() platform.ID

GetOrgID implements influxdb.Getter interface.

func (Base) GetOwnerID

func (b Base) GetOwnerID() platform.ID

GetOwnerID returns the owner id.

func (Base) GetTaskID

func (b Base) GetTaskID() platform.ID

GetTaskID gets the task ID for a base.

func (*Base) MatchesTags

func (b *Base) MatchesTags(tags []influxdb.Tag) bool

MatchesTags returns true if the Rule matches all of the tags

func (*Base) SetDescription

func (b *Base) SetDescription(description string)

SetDescription implements influxdb.Updator interface.

func (*Base) SetID

func (b *Base) SetID(id platform.ID)

SetID will set the primary key.

func (*Base) SetName

func (b *Base) SetName(name string)

SetName implements influxdb.Updator interface.

func (*Base) SetOrgID

func (b *Base) SetOrgID(id platform.ID)

SetOrgID will set the org key.

func (*Base) SetOwnerID

func (b *Base) SetOwnerID(id platform.ID)

SetOwnerID will set the owner id.

func (*Base) SetTaskID

func (b *Base) SetTaskID(id platform.ID)

SetTaskID sets the task ID for a base.

type HTTP

type HTTP struct {
	Base
}

HTTP is the notification rule config of http.

func (*HTTP) GenerateFlux

func (s *HTTP) GenerateFlux(e influxdb.NotificationEndpoint) (string, error)

GenerateFlux generates a flux script for the http notification rule.

func (*HTTP) GenerateFluxAST

func (s *HTTP) GenerateFluxAST(e *endpoint.HTTP) *ast.File

GenerateFluxAST generates a flux AST for the http notification rule.

func (HTTP) MarshalJSON

func (s HTTP) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (HTTP) Type

func (s HTTP) Type() string

Type returns the type of the rule config.

func (HTTP) Valid

func (s HTTP) Valid() error

Valid returns where the config is valid.

type PagerDuty

type PagerDuty struct {
	Base
	MessageTemplate string `json:"messageTemplate"`
}

PagerDuty is the rule config of pagerduty notification.

func (*PagerDuty) GenerateFlux

func (s *PagerDuty) GenerateFlux(e influxdb.NotificationEndpoint) (string, error)

GenerateFlux generates a flux script for the pagerduty notification rule.

func (*PagerDuty) GenerateFluxAST

func (s *PagerDuty) GenerateFluxAST(e *endpoint.PagerDuty) *ast.File

GenerateFluxAST generates a flux AST for the pagerduty notification rule.

func (PagerDuty) MarshalJSON

func (s PagerDuty) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (PagerDuty) Type

func (s PagerDuty) Type() string

Type returns the type of the rule config.

func (PagerDuty) Valid

func (s PagerDuty) Valid() error

Valid returns where the config is valid.

type Slack

type Slack struct {
	Base
	Channel         string `json:"channel"`
	MessageTemplate string `json:"messageTemplate"`
}

Slack is the notification rule config of slack.

func (*Slack) GenerateFlux

func (s *Slack) GenerateFlux(e influxdb.NotificationEndpoint) (string, error)

GenerateFlux generates a flux script for the slack notification rule.

func (*Slack) GenerateFluxAST

func (s *Slack) GenerateFluxAST(e *endpoint.Slack) *ast.File

GenerateFluxAST generates a flux AST for the slack notification rule.

func (Slack) MarshalJSON

func (s Slack) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Slack) Type

func (s Slack) Type() string

Type returns the type of the rule config.

func (Slack) Valid

func (s Slack) Valid() error

Valid returns where the config is valid.

type Telegram

type Telegram struct {
	Base
	MessageTemplate       string `json:"messageTemplate"`
	ParseMode             string `json:"parseMode"`
	DisableWebPagePreview bool   `json:"disableWebPagePreview"`
}

Telegram is the notification rule config of telegram.

func (*Telegram) GenerateFlux

func (s *Telegram) GenerateFlux(e influxdb.NotificationEndpoint) (string, error)

GenerateFlux generates a flux script for the telegram notification rule.

func (*Telegram) GenerateFluxAST

func (s *Telegram) GenerateFluxAST(e *endpoint.Telegram) *ast.File

GenerateFluxAST generates a flux AST for the telegram notification rule.

func (Telegram) MarshalJSON

func (s Telegram) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Telegram) Type

func (s Telegram) Type() string

Type returns the type of the rule config.

func (Telegram) Valid

func (s Telegram) Valid() error

Valid returns where the config is valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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