Documentation ¶
Index ¶
- Constants
- Variables
- func ErrDBRPAlreadyExists(msg string) *errors.Error
- func ErrInternalService(err error) *errors.Error
- func ErrInvalidBucketID(id string, err error) error
- func ErrInvalidDBRP(err error) *errors.Error
- func ErrInvalidDBRPID(id string, err error) error
- func ErrInvalidOrgID(id string, err error) error
- func ErrOrgNotFound(org string) error
- func NewService(ctx context.Context, bucketSvc influxdb.BucketService, st kv.Store) influxdb.DBRPMappingService
- type AuthorizedService
- func (svc AuthorizedService) Create(ctx context.Context, t *influxdb.DBRPMapping) error
- func (svc AuthorizedService) Delete(ctx context.Context, orgID, id platform.ID) error
- func (svc AuthorizedService) FindByID(ctx context.Context, orgID, id platform.ID) (*influxdb.DBRPMapping, error)
- func (svc AuthorizedService) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilter, ...) ([]*influxdb.DBRPMapping, int, error)
- func (svc AuthorizedService) Update(ctx context.Context, u *influxdb.DBRPMapping) error
- type BucketService
- type Client
- func (c *Client) Create(ctx context.Context, dbrp *influxdb.DBRPMapping) error
- func (c *Client) Delete(ctx context.Context, orgID, id platform.ID) error
- func (c *Client) FindByID(ctx context.Context, orgID, id platform.ID) (*influxdb.DBRPMapping, error)
- func (c *Client) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilter, ...) ([]*influxdb.DBRPMapping, int, error)
- func (c *Client) Update(ctx context.Context, dbrp *influxdb.DBRPMapping) error
- type Handler
- type Service
- func (s *Service) Create(ctx context.Context, dbrp *influxdb.DBRPMapping) error
- func (s *Service) Delete(ctx context.Context, orgID, id platform.ID) error
- func (s *Service) FindByID(ctx context.Context, orgID, id platform.ID) (*influxdb.DBRPMapping, error)
- func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilter, ...) ([]*influxdb.DBRPMapping, int, error)
- func (s *Service) Update(ctx context.Context, dbrp *influxdb.DBRPMapping) error
Constants ¶
const (
PrefixDBRP = "/api/v2/dbrps"
)
Variables ¶
var ( // ErrDBRPNotFound is used when the specified DBRP cannot be found. ErrDBRPNotFound = &errors.Error{ Code: errors.ENotFound, Msg: "unable to find DBRP", } // ErrNotUniqueID is used when the ID of the DBRP is not unique. ErrNotUniqueID = &errors.Error{ Code: errors.EConflict, Msg: "ID already exists", } // ErrFailureGeneratingID occurs ony when the random number generator // cannot generate an ID in MaxIDGenerationN times. ErrFailureGeneratingID = &errors.Error{ Code: errors.EInternal, Msg: "unable to generate valid id", } ErrNoOrgProvided = &errors.Error{ Code: errors.EInvalid, Msg: "either 'org' or 'orgID' must be provided", } )
Functions ¶
func ErrDBRPAlreadyExists ¶
ErrDBRPAlreadyExists is used when there is a conflict in creating a new DBRP.
func ErrInternalService ¶
ErrInternalService is used when the error comes from an internal system.
func ErrInvalidBucketID ¶ added in v2.0.4
ErrInvalidBucketID returns a more informative error about a failure to decode a bucket ID.
func ErrInvalidDBRP ¶
ErrInvalidDBRP is used when a service was provided an invalid DBRP.
func ErrInvalidDBRPID ¶
ErrInvalidDBRPID is used when the ID of the DBRP cannot be encoded.
func ErrInvalidOrgID ¶ added in v2.0.4
ErrInvalidOrgID returns a more informative error about a failure to decode an organization ID.
func ErrOrgNotFound ¶ added in v2.0.4
ErrOrgNotFound returns a more informative error about a 404 on org name.
Types ¶
type AuthorizedService ¶
type AuthorizedService struct {
influxdb.DBRPMappingService
}
func NewAuthorizedService ¶
func NewAuthorizedService(s influxdb.DBRPMappingService) *AuthorizedService
func (AuthorizedService) Create ¶
func (svc AuthorizedService) Create(ctx context.Context, t *influxdb.DBRPMapping) error
type BucketService ¶
type BucketService struct { influxdb.BucketService Logger *zap.Logger DBRPMappingService influxdb.DBRPMappingService }
func NewBucketService ¶
func NewBucketService(logger *zap.Logger, bucketService influxdb.BucketService, dbrpService influxdb.DBRPMappingService) *BucketService
func (*BucketService) DeleteBucket ¶
type Client ¶
Client connects to Influx via HTTP using tokens to manage DBRPs.
type Handler ¶
func NewHTTPHandler ¶
func NewHTTPHandler(log *zap.Logger, dbrpSvc influxdb.DBRPMappingService, orgSvc influxdb.OrganizationService) *Handler
NewHTTPHandler constructs a new http server.
type Service ¶
type Service struct { IDGen platform.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 platform.ID) (*influxdb.DBRPMapping, error)
FindBy returns the mapping for the given ID.
func (*Service) FindMany ¶
func (s *Service) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilter, opts ...influxdb.FindOptions) ([]*influxdb.DBRPMapping, 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.