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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTelegrafNotFound is used when the telegraf configuration is not found.
	ErrTelegrafNotFound = &errors.Error{
		Msg:  "telegraf configuration not found",
		Code: errors.ENotFound,
	}

	// ErrInvalidTelegrafID is used when the service was provided
	// an invalid ID format.
	ErrInvalidTelegrafID = &errors.Error{
		Code: errors.EInvalid,
		Msg:  "provided telegraf configuration ID has invalid format",
	}

	// ErrInvalidTelegrafOrgID is the error message for a missing or invalid organization ID.
	ErrInvalidTelegrafOrgID = &errors.Error{
		Code: errors.EEmptyValue,
		Msg:  "provided telegraf configuration organization ID is missing or invalid",
	}
)

Functions

func CorruptTelegrafError

func CorruptTelegrafError(err error) *errors.Error

CorruptTelegrafError is used when the config cannot be unmarshalled from the bytes stored in the kv.

func ErrUnprocessableTelegraf

func ErrUnprocessableTelegraf(err error) *errors.Error

ErrUnprocessableTelegraf is used when a telegraf is not able to be converted to JSON.

func InternalTelegrafServiceError

func InternalTelegrafServiceError(err error) *errors.Error

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

func UnavailableTelegrafServiceError

func UnavailableTelegrafServiceError(err error) *errors.Error

UnavailableTelegrafServiceError 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 Service

type Service struct {
	IDGenerator platform.IDGenerator
	// contains filtered or unexported fields
}

Service is a telegraf config service.

func New

func New(store kv.Store) *Service

New constructs and configures a new telegraf config service.

func (*Service) CreateTelegrafConfig

func (s *Service) CreateTelegrafConfig(ctx context.Context, tc *influxdb.TelegrafConfig, userID platform.ID) error

CreateTelegrafConfig creates a new telegraf config and sets b.ID with the new identifier.

func (*Service) DeleteTelegrafConfig

func (s *Service) DeleteTelegrafConfig(ctx context.Context, id platform.ID) error

DeleteTelegrafConfig removes a telegraf config by ID.

func (*Service) FindTelegrafConfigByID

func (s *Service) FindTelegrafConfigByID(ctx context.Context, id platform.ID) (*influxdb.TelegrafConfig, error)

FindTelegrafConfigByID returns a single telegraf config by ID.

func (*Service) FindTelegrafConfigs

func (s *Service) FindTelegrafConfigs(ctx context.Context, filter influxdb.TelegrafConfigFilter, opt ...influxdb.FindOptions) (tcs []*influxdb.TelegrafConfig, n int, err error)

FindTelegrafConfigs returns a list of telegraf configs that match filter and the total count of matching telegraf configs. FindOptions are ignored.

func (*Service) PutTelegrafConfig

func (s *Service) PutTelegrafConfig(ctx context.Context, tc *influxdb.TelegrafConfig) error

PutTelegrafConfig put a telegraf config to storage.

func (*Service) UpdateTelegrafConfig

func (s *Service) UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *influxdb.TelegrafConfig, userID platform.ID) (*influxdb.TelegrafConfig, error)

UpdateTelegrafConfig updates a single telegraf config. Returns the new telegraf config after update.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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