Documentation ¶
Index ¶
- Constants
- Variables
- func BucketAlreadyExistsError(n string) *errors.Error
- func CorruptURMError(err error) *errors.Error
- func ErrBucketNotFoundByName(n string) *errors.Error
- func ErrCorruptBucket(err error) *errors.Error
- func ErrCorruptOrg(err error) *errors.Error
- func ErrCorruptUser(err error) *errors.Error
- func ErrInternalServiceError(err error) *errors.Error
- func ErrUnprocessableBucket(err error) *errors.Error
- func ErrUnprocessableMapping(err error) *errors.Error
- func ErrUnprocessableOrg(err error) *errors.Error
- func ErrUnprocessableUser(err error) *errors.Error
- func InvalidOrgIDError(err error) *errors.Error
- func InvalidUserIDError(err error) *errors.Error
- func NewBucketResponse(b *influxdb.Bucket, labels ...*influxdb.Label) *bucketResponse
- func NonUniqueMappingError(userID platform.ID) error
- func OrgAlreadyExistsError(name string) error
- func OrgNotFoundByName(name string) error
- func UnavailablePasswordServiceError(err error) *errors.Error
- func UnavailableURMServiceError(err error) *errors.Error
- func UnexpectedUserBucketError(err error) *errors.Error
- func UnexpectedUserIndexError(err error) *errors.Error
- func UserAlreadyExistsError(n string) *errors.Error
- func UserIDAlreadyExistsError(id string) *errors.Error
- type AggregateError
- type BucketFilter
- type BucketHandler
- type BucketSvc
- func (s *BucketSvc) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (s *BucketSvc) DeleteBucket(ctx context.Context, id platform.ID) error
- func (s *BucketSvc) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
- func (s *BucketSvc) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
- func (s *BucketSvc) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (*influxdb.Bucket, error)
- func (s *BucketSvc) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
- func (s *BucketSvc) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- type Service
- type Store
- func (s *Store) CreateBucket(ctx context.Context, tx kv.Tx, bucket *influxdb.Bucket) (err error)
- func (s *Store) DeleteBucket(ctx context.Context, tx kv.Tx, id platform.ID) error
- func (s *Store) GetBucket(ctx context.Context, tx kv.Tx, id platform.ID) (*influxdb.Bucket, error)
- func (s *Store) GetBucketByName(ctx context.Context, tx kv.Tx, orgID platform.ID, n string) (*influxdb.Bucket, error)
- func (s *Store) ListBuckets(ctx context.Context, tx kv.Tx, filter BucketFilter, ...) ([]*influxdb.Bucket, error)
- func (s *Store) RLock()
- func (s *Store) RUnlock()
- func (s *Store) Update(ctx context.Context, fn func(kv.Tx) error) error
- func (s *Store) UpdateBucket(ctx context.Context, tx kv.Tx, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- func (s *Store) View(ctx context.Context, fn func(kv.Tx) error) error
- type StoreOption
Constants ¶
const MaxIDGenerationN = 100
const MinPasswordLen int = 8
Variables ¶
var ( // ErrNameisEmpty is when a name is empty ErrNameisEmpty = &errors.Error{ Code: errors.EInvalid, Msg: "name is empty", } // ErrIDNotUnique is used when attempting to create an org or bucket that already // exists. ErrIDNotUnique = &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", } // ErrOnboardingNotAllowed occurs when request to onboard comes in and we are not allowing this request ErrOnboardingNotAllowed = &errors.Error{ Code: errors.EConflict, Msg: "onboarding has already been completed", } ErrNotFound = &errors.Error{ Code: errors.ENotFound, Msg: "not found", } )
var ( ErrBucketNotFound = &errors.Error{ Code: errors.ENotFound, Msg: "bucket not found", } ErrBucketNameNotUnique = &errors.Error{ Code: errors.EConflict, Msg: "bucket name is not unique", } )
var ( // ErrInvalidURMID is used when the service was provided // an invalid ID format. ErrInvalidURMID = &errors.Error{ Code: errors.EInvalid, Msg: "provided user resource mapping ID has invalid format", } // ErrURMNotFound is used when the user resource mapping is not found. ErrURMNotFound = &errors.Error{ Msg: "user to resource mapping not found", Code: errors.ENotFound, } )
var ( // ErrUserNotFound is used when the user is not found. ErrUserNotFound = &errors.Error{ Msg: "user not found", Code: errors.ENotFound, } // EIncorrectPassword is returned when any password operation fails in which // we do not want to leak information. EIncorrectPassword = &errors.Error{ Code: errors.EForbidden, Msg: "your username or password is incorrect", } // EIncorrectUser is returned when any user is failed to be found which indicates // the userID provided is for a user that does not exist. EIncorrectUser = &errors.Error{ Code: errors.EForbidden, Msg: "your userID is incorrect", } // EShortPassword is used when a password is less than the minimum // acceptable password length. EShortPassword = &errors.Error{ Code: errors.EInvalid, Msg: fmt.Sprintf("passwords must be at least %d characters long", MinPasswordLen), } )
var ( // ErrOrgNotFound is used when the user is not found. ErrOrgNotFound = &errors.Error{ Msg: "organization not found", Code: errors.ENotFound, } )
Functions ¶
func BucketAlreadyExistsError ¶
BucketAlreadyExistsError is used when attempting to create a user with a name that already exists.
func CorruptURMError ¶
CorruptURMError is used when the config cannot be unmarshalled from the bytes stored in the kv.
func ErrBucketNotFoundByName ¶
ErrBucketNotFoundByName is used when the user is not found.
func ErrCorruptBucket ¶
ErrCorruptBucket is used when the user cannot be unmarshalled from the bytes stored in the kv.
func ErrCorruptOrg ¶
ErrCorruptOrg is used when the user cannot be unmarshalled from the bytes stored in the kv.
func ErrCorruptUser ¶
ErrCorruptUser is used when the user cannot be unmarshalled from the bytes stored in the kv.
func ErrInternalServiceError ¶
ErrInternalServiceError is used when the error comes from an internal system.
func ErrUnprocessableBucket ¶
ErrUnprocessableBucket is used when a org is not able to be processed.
func ErrUnprocessableMapping ¶
ErrUnprocessableMapping is used when a user resource mapping is not able to be converted to JSON.
func ErrUnprocessableOrg ¶
ErrUnprocessableOrg is used when a org is not able to be processed.
func ErrUnprocessableUser ¶
ErrUnprocessableUser is used when a user is not able to be processed.
func InvalidOrgIDError ¶
InvalidOrgIDError is used when a service was provided an invalid ID. This is some sort of internal server error.
func InvalidUserIDError ¶
InvalidUserIDError is used when a service was provided an invalid ID. This is some sort of internal server error.
func NewBucketResponse ¶
func NewBucketResponse(b *influxdb.Bucket, labels ...*influxdb.Label) *bucketResponse
func NonUniqueMappingError ¶
NonUniqueMappingError is an internal error when a user already has been mapped to a resource
func OrgAlreadyExistsError ¶
OrgAlreadyExistsError is used when creating a new organization with a name that has already been used. Organization names must be unique.
func OrgNotFoundByName ¶
func UnavailablePasswordServiceError ¶
UnavailablePasswordServiceError is used if we aren't able to add the password to the store, it means the store is not available at the moment (e.g. network).
func UnavailableURMServiceError ¶
UnavailableURMServiceError 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).
func UnexpectedUserBucketError ¶
UnexpectedUserBucketError is used when the error comes from an internal system.
func UnexpectedUserIndexError ¶
UnexpectedUserIndexError is used when the error comes from an internal system.
func UserAlreadyExistsError ¶
UserAlreadyExistsError is used when attempting to create a user with a name that already exists.
func UserIDAlreadyExistsError ¶
UserIDAlreadyExistsError is used when attempting to create a user with an ID that already exists.
Types ¶
type AggregateError ¶
type AggregateError struct {
// contains filtered or unexported fields
}
AggregateError enables composing multiple errors. This is ideal in the case that you are applying functions with side effects to a slice of elements. E.g., deleting/updating a slice of resources.
func NewAggregateError ¶
func NewAggregateError() *AggregateError
NewAggregateError returns a new AggregateError.
func (*AggregateError) Add ¶
func (e *AggregateError) Add(err error)
Add adds an error to the aggregate.
func (*AggregateError) Err ¶
func (e *AggregateError) Err() error
Err returns a proper error from this aggregate error.
type BucketFilter ¶
type BucketHandler ¶
BucketHandler represents an HTTP API handler for users.
func NewHTTPBucketHandler ¶
func NewHTTPBucketHandler(log *zap.Logger, bucketSvc influxdb.BucketService, labelSvc influxdb.LabelService, urmHandler, labelHandler http.Handler) *BucketHandler
NewHTTPBucketHandler constructs a new http server.
func (*BucketHandler) Prefix ¶
func (h *BucketHandler) Prefix() string
type BucketSvc ¶
type BucketSvc struct {
// contains filtered or unexported fields
}
func NewBucketSvc ¶
func (*BucketSvc) CreateBucket ¶
CreateBucket creates a new bucket and sets b.ID with the new identifier.
func (*BucketSvc) DeleteBucket ¶
DeleteBucket removes a bucket by ID.
func (*BucketSvc) FindBucket ¶
func (s *BucketSvc) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
FindBucket returns the first bucket that matches filter.
func (*BucketSvc) FindBucketByID ¶
FindBucketByID returns a single bucket by ID.
func (*BucketSvc) FindBucketByName ¶
func (*BucketSvc) FindBuckets ¶
func (s *BucketSvc) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
FindBuckets returns a list of buckets that match filter and the total count of matching buckets. Additional options provide pagination & sorting.
type Service ¶
type Service struct { influxdb.UserService influxdb.PasswordsService influxdb.UserResourceMappingService influxdb.OrganizationService influxdb.BucketService // contains filtered or unexported fields }
type Store ¶
type Store struct { IDGen platform.IDGenerator OrgIDGen platform.IDGenerator BucketIDGen platform.IDGenerator // contains filtered or unexported fields }
func (*Store) CreateBucket ¶
func (*Store) DeleteBucket ¶
func (*Store) GetBucketByName ¶
func (*Store) ListBuckets ¶
func (*Store) UpdateBucket ¶
type StoreOption ¶
type StoreOption func(*Store)