endpoint

package
v2.0.0-beta.14 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SlackType     = "slack"
	PagerDutyType = "pagerduty"
	HTTPType      = "http"
)

types of endpoints.

Variables

This section is empty.

Functions

func UnmarshalJSON

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

UnmarshalJSON will convert the bytes to notification endpoint.

Types

type Base

type Base struct {
	ID          *influxdb.ID    `json:"id,omitempty"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	OrgID       *influxdb.ID    `json:"orgID,omitempty"`
	Status      influxdb.Status `json:"status"`
	influxdb.CRUDLog
}

Base is the embed struct of every notification endpoint.

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) GetID

func (b Base) GetID() influxdb.ID

GetID implements influxdb.Getter interface.

func (*Base) GetName

func (b *Base) GetName() string

GetName implements influxdb.Getter interface.

func (Base) GetOrgID

func (b Base) GetOrgID() influxdb.ID

GetOrgID implements influxdb.Getter interface.

func (*Base) GetStatus

func (b *Base) GetStatus() influxdb.Status

GetStatus implements influxdb.Getter interface.

func (*Base) SetDescription

func (b *Base) SetDescription(description string)

SetDescription implements influxdb.Updator interface.

func (*Base) SetID

func (b *Base) SetID(id influxdb.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 influxdb.ID)

SetOrgID will set the org key.

func (*Base) SetStatus

func (b *Base) SetStatus(status influxdb.Status)

SetStatus implements influxdb.Updator interface.

type HTTP

type HTTP struct {
	Base
	// Path is the API path of HTTP
	URL string `json:"url"`
	// Token is the bearer token for authorization
	Headers         map[string]string    `json:"headers,omitempty"`
	Token           influxdb.SecretField `json:"token,omitempty"`
	Username        influxdb.SecretField `json:"username,omitempty"`
	Password        influxdb.SecretField `json:"password,omitempty"`
	AuthMethod      string               `json:"authMethod"`
	Method          string               `json:"method"`
	ContentTemplate string               `json:"contentTemplate"`
}

HTTP is the notification endpoint config of http.

func (*HTTP) BackfillSecretKeys

func (s *HTTP) BackfillSecretKeys()

BackfillSecretKeys fill back fill the secret field key during the unmarshalling if value of that secret field is not nil.

func (HTTP) MarshalJSON

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

MarshalJSON implement json.Marshaler interface.

func (HTTP) ParseResponse

func (s HTTP) ParseResponse(resp *http.Response) error

ParseResponse will parse the http response from http.

func (HTTP) SecretFields

func (s HTTP) SecretFields() []influxdb.SecretField

SecretFields return available secret fields.

func (HTTP) Type

func (s HTTP) Type() string

Type returns the type.

func (HTTP) Valid

func (s HTTP) Valid() error

Valid returns error if some configuration is invalid

type PagerDuty

type PagerDuty struct {
	Base
	// ClientURL is the url that is presented in the PagerDuty UI when this alert is triggered
	ClientURL string `json:"clientURL"`
	// RoutingKey is a version 4 UUID expressed as a 32-digit hexadecimal number.
	// This is the Integration Key for an integration on any given service.
	RoutingKey influxdb.SecretField `json:"routingKey"`
}

PagerDuty is the notification endpoint config of pagerduty.

func (*PagerDuty) BackfillSecretKeys

func (s *PagerDuty) BackfillSecretKeys()

BackfillSecretKeys fill back fill the secret field key during the unmarshalling if value of that secret field is not nil.

func (PagerDuty) MarshalJSON

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

MarshalJSON implement json.Marshaler interface.

func (PagerDuty) SecretFields

func (s PagerDuty) SecretFields() []influxdb.SecretField

SecretFields return available secret fields.

func (PagerDuty) Type

func (s PagerDuty) Type() string

Type returns the type.

func (PagerDuty) Valid

func (s PagerDuty) Valid() error

Valid returns error if some configuration is invalid

type Slack

type Slack struct {
	Base
	// URL is a valid slack webhook URL
	// TODO(jm): validate this in unmarshaler
	// example: https://slack.com/api/chat.postMessage
	URL string `json:"url"`
	// Token is the bearer token for authorization
	Token influxdb.SecretField `json:"token"`
}

Slack is the notification endpoint config of slack.

func (*Slack) BackfillSecretKeys

func (s *Slack) BackfillSecretKeys()

BackfillSecretKeys fill back fill the secret field key during the unmarshalling if value of that secret field is not nil.

func (Slack) MarshalJSON

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

MarshalJSON implement json.Marshaler interface.

func (Slack) SecretFields

func (s Slack) SecretFields() []influxdb.SecretField

SecretFields return available secret fields.

func (Slack) Type

func (s Slack) Type() string

Type returns the type.

func (Slack) Valid

func (s Slack) Valid() error

Valid returns error if some configuration is invalid

Jump to

Keyboard shortcuts

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