service

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotificationRuleNotFound is used when the notification rule is not found.
	ErrNotificationRuleNotFound = &influxdb.Error{
		Msg:  "notification rule not found",
		Code: influxdb.ENotFound,
	}

	// ErrInvalidNotificationRuleID is used when the service was provided
	// an invalid ID format.
	ErrInvalidNotificationRuleID = &influxdb.Error{
		Code: influxdb.EInvalid,
		Msg:  "provided notification rule ID has invalid format",
	}
)

Functions

func InternalNotificationRuleStoreError

func InternalNotificationRuleStoreError(err error) *influxdb.Error

InternalNotificationRuleStoreError is used when the error comes from an internal system.

func UnavailableNotificationRuleStoreError

func UnavailableNotificationRuleStoreError(err error) *influxdb.Error

UnavailableNotificationRuleStoreError is used if we aren't able to interact with the store, it means the store is not available at the moment (e.g. network).

Types

type RuleService

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

RuleService is an implementation of the influxdb CheckService It is backed by the kv store abstraction.

func New

func New(logger *zap.Logger, store kv.Store, tasks influxdb.TaskService, orgs influxdb.OrganizationService, endpoints influxdb.NotificationEndpointService) (*RuleService, error)

New constructs and configures a notification rule service

func (*RuleService) CreateNotificationRule

func (s *RuleService) CreateNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error

CreateNotificationRule creates a new notification rule and sets b.ID with the new identifier.

func (*RuleService) DeleteNotificationRule

func (s *RuleService) DeleteNotificationRule(ctx context.Context, id influxdb.ID) error

DeleteNotificationRule removes a notification rule by ID.

func (*RuleService) FindNotificationRuleByID

func (s *RuleService) FindNotificationRuleByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)

FindNotificationRuleByID returns a single notification rule by ID.

func (*RuleService) FindNotificationRules

func (s *RuleService) FindNotificationRules(ctx context.Context, filter influxdb.NotificationRuleFilter, opt ...influxdb.FindOptions) (nrs []influxdb.NotificationRule, n int, err error)

FindNotificationRules returns a list of notification rules that match filter and the total count of matching notification rules. Additional options provide pagination & sorting.

func (*RuleService) PatchNotificationRule

func (s *RuleService) PatchNotificationRule(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)

PatchNotificationRule updates a single notification rule with changeset. Returns the new notification rule state after update.

func (*RuleService) PutNotificationRule

func (s *RuleService) PutNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate) error

PutNotificationRule put a notification rule to storage.

func (*RuleService) UpdateNotificationRule

func (s *RuleService) UpdateNotificationRule(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, userID influxdb.ID) (influxdb.NotificationRule, error)

UpdateNotificationRule updates a single notification rule. Returns the new notification rule after update.

Jump to

Keyboard shortcuts

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