service

package
v2.7.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 12 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 = &errors.Error{
		Msg:  "notification rule not found",
		Code: errors.ENotFound,
	}

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

Functions

func InternalNotificationRuleStoreError

func InternalNotificationRuleStoreError(err error) *errors.Error

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

func UnavailableNotificationRuleStoreError

func UnavailableNotificationRuleStoreError(err error) *errors.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 taskmodel.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 platform.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 platform.ID) error

DeleteNotificationRule removes a notification rule by ID.

func (*RuleService) FindNotificationRuleByID

func (s *RuleService) FindNotificationRuleByID(ctx context.Context, id platform.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 platform.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 platform.ID, nr influxdb.NotificationRuleCreate, userID platform.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