service

package
v2.0.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 7 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 = &influxdb.Error{
		Msg:  "telegraf configuration not found",
		Code: influxdb.ENotFound,
	}

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

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

Functions

func CorruptTelegrafError

func CorruptTelegrafError(err error) *influxdb.Error

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

func ErrUnprocessableTelegraf

func ErrUnprocessableTelegraf(err error) *influxdb.Error

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

func InternalTelegrafServiceError

func InternalTelegrafServiceError(err error) *influxdb.Error

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

func UnavailableTelegrafServiceError

func UnavailableTelegrafServiceError(err error) *influxdb.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 influxdb.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 influxdb.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 influxdb.ID) error

DeleteTelegrafConfig removes a telegraf config by ID.

func (*Service) FindTelegrafConfigByID

func (s *Service) FindTelegrafConfigByID(ctx context.Context, id influxdb.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. Additional options provide pagination & sorting.

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 influxdb.ID, tc *influxdb.TelegrafConfig, userID influxdb.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