Documentation ¶
Index ¶
- Constants
- Variables
- func ErrDBRPAlreadyExists(msg string) *influxdb.Error
- func ErrInternalService(err error) *influxdb.Error
- func ErrInvalidDBRP(err error) *influxdb.Error
- func NewService(ctx context.Context, bucketSvc influxdb.BucketService, st kv.Store) influxdb.DBRPMappingServiceV2
- type AuthorizedService
- func (svc AuthorizedService) Create(ctx context.Context, t *influxdb.DBRPMappingV2) error
- func (svc AuthorizedService) Delete(ctx context.Context, orgID, id influxdb.ID) error
- func (svc AuthorizedService) FindByID(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)
- func (svc AuthorizedService) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilterV2, ...) ([]*influxdb.DBRPMappingV2, int, error)
- func (svc AuthorizedService) Update(ctx context.Context, u *influxdb.DBRPMappingV2) error
- type BucketService
- type Client
- func (c *Client) Create(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error
- func (c *Client) Delete(ctx context.Context, orgID, id influxdb.ID) error
- func (c *Client) FindByID(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)
- func (c *Client) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilterV2, ...) ([]*influxdb.DBRPMappingV2, int, error)
- func (c *Client) Update(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error
- type Handler
- type Service
- func (s *Service) Create(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error
- func (s *Service) Delete(ctx context.Context, orgID, id influxdb.ID) error
- func (s *Service) FindByID(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)
- func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilterV2, ...) ([]*influxdb.DBRPMappingV2, int, error)
- func (s *Service) Update(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error
Constants ¶
const (
PrefixDBRP = "/api/v2/dbrps"
)
Variables ¶
var ( // ErrInvalidDBRPID is used when the ID of the DBRP cannot be encoded. ErrInvalidDBRPID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "DBRP ID is invalid", } // ErrDBRPNotFound is used when the specified DBRP cannot be found. ErrDBRPNotFound = &influxdb.Error{ Code: influxdb.ENotFound, Msg: "unable to find DBRP", } // ErrNotUniqueID is used when the ID of the DBRP is not unique. ErrNotUniqueID = &influxdb.Error{ Code: influxdb.EConflict, Msg: "ID already exists", } // ErrFailureGeneratingID occurs ony when the random number generator // cannot generate an ID in MaxIDGenerationN times. ErrFailureGeneratingID = &influxdb.Error{ Code: influxdb.EInternal, Msg: "unable to generate valid id", } )
Functions ¶
func ErrDBRPAlreadyExists ¶
func ErrDBRPAlreadyExists(msg string) *influxdb.Error
ErrDBRPAlreadyExists is used when there is a conflict in creating a new DBRP.
func ErrInternalService ¶
func ErrInternalService(err error) *influxdb.Error
ErrInternalService is used when the error comes from an internal system.
func ErrInvalidDBRP ¶
func ErrInvalidDBRP(err error) *influxdb.Error
ErrInvalidDBRP is used when a service was provided an invalid DBRP.
Types ¶
type AuthorizedService ¶
type AuthorizedService struct {
influxdb.DBRPMappingServiceV2
}
func NewAuthorizedService ¶
func NewAuthorizedService(s influxdb.DBRPMappingServiceV2) *AuthorizedService
func (AuthorizedService) Create ¶
func (svc AuthorizedService) Create(ctx context.Context, t *influxdb.DBRPMappingV2) error
func (AuthorizedService) Delete ¶
func (svc AuthorizedService) Delete(ctx context.Context, orgID, id influxdb.ID) error
func (AuthorizedService) FindByID ¶
func (svc AuthorizedService) FindByID(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)
type BucketService ¶
type BucketService struct { influxdb.BucketService Logger *zap.Logger DBRPMappingService influxdb.DBRPMappingServiceV2 }
func NewBucketService ¶
func NewBucketService(logger *zap.Logger, bucketService influxdb.BucketService, dbrpService influxdb.DBRPMappingServiceV2) *BucketService
func (*BucketService) DeleteBucket ¶
func (s *BucketService) DeleteBucket(ctx context.Context, id influxdb.ID) error
type Client ¶
Client connects to Influx via HTTP using tokens to manage DBRPs.
type Handler ¶
func NewHTTPHandler ¶
func NewHTTPHandler(log *zap.Logger, dbrpSvc influxdb.DBRPMappingServiceV2, orgSvc influxdb.OrganizationService) *Handler
NewHTTPHandler constructs a new http server.
type Service ¶
type Service struct { IDGen influxdb.IDGenerator // contains filtered or unexported fields }
func (*Service) Create ¶
Create creates a new mapping. If another mapping with same organization ID, database, and retention policy exists, an error is returned. If the mapping already contains a valid ID, that one is used for storing the mapping.
func (*Service) Delete ¶
Delete removes a mapping. Deleting a mapping that does not exists is not an error. Deleting the default mapping will cause the first one (if any) to become the default.
func (*Service) FindByID ¶
func (s *Service) FindByID(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)
FindBy returns the mapping for the given ID.
func (*Service) FindMany ¶
func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilterV2, opts ...influxdb.FindOptions) ([]*influxdb.DBRPMappingV2, int, error)
FindMany returns a list of mappings that match filter and the total count of matching dbrp mappings. TODO(affo): find a smart way to apply FindOptions to a list of items.