Documentation ¶
Overview ¶
The tenant domain encapsulates all the storage critical metadata services: User Organization Bucket URM's
These services are the cornerstone of all other metadata services. The intent is to have a single location for all tenant related code. THis should facilitate faster bug resolution and allow us to make changes to this service without effecting any dependant services.
When a new request for the tenant service comes in it should follow this pattern: 1 http_server_resource - this is where the request is parsed and rejected if the client didn't send
the right information
2 middleware_resource_auth - We now confirm the user that generated the request has sufficient permission
to accomplish this task, in some cases we adjust the request if the user is without the correct permissions
3 middleware_resource_metrics - Track RED metrics for this request 4 middleware_resource_logging - add logging around request duration and status. 5 service_resource - When a request reaches the service we verify the content for compatibility with the existing dataset,
for instance if a resource has a "orgID" we will ensure the organization exists
6 storage_resource - Basic CRUD actions for the system.
This pattern of api -> middleware -> service -> basic crud helps us to break down the responsibilities into digestible chunks and allows us to swap in or out any pieces we need depending on the situation. Currently the storage layer is using a kv store but by breaking the crud actions into its own independent set of concerns we allow ourselves to move away from kv if the need arises without having to be concerned about messing up some other pieces of logic.
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 NewOnboardService(svc *Service, as influxdb.AuthorizationService, opts ...OnboardServiceOptionFn) influxdb.OnboardingService
- func NewOnboardingResponse(results *influxdb.OnboardingResults) *onboardingResponse
- func NewURMHandler(log *zap.Logger, rt influxdb.ResourceType, idLookupKey string, ...) http.Handler
- 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 AuthedBucketService
- func (s *AuthedBucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (s *AuthedBucketService) DeleteBucket(ctx context.Context, id platform.ID) error
- func (s *AuthedBucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
- func (s *AuthedBucketService) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
- func (s *AuthedBucketService) FindBucketByName(ctx context.Context, orgID platform.ID, n string) (*influxdb.Bucket, error)
- func (s *AuthedBucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
- func (s *AuthedBucketService) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- type AuthedOnboardSvc
- type AuthedOrgService
- func (s *AuthedOrgService) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
- func (s *AuthedOrgService) DeleteOrganization(ctx context.Context, id platform.ID) error
- func (s *AuthedOrgService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
- func (s *AuthedOrgService) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
- func (s *AuthedOrgService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) ([]*influxdb.Organization, int, error)
- func (s *AuthedOrgService) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- type AuthedPasswordService
- func (s *AuthedPasswordService) CompareAndSetPassword(ctx context.Context, userID platform.ID, old string, new string) error
- func (s *AuthedPasswordService) ComparePassword(ctx context.Context, userID platform.ID, password string) error
- func (s *AuthedPasswordService) SetPassword(ctx context.Context, userID platform.ID, password string) error
- type AuthedURMService
- func (s *AuthedURMService) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
- func (s *AuthedURMService) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error
- func (s *AuthedURMService) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- type AuthedUserService
- func (s *AuthedUserService) CreateUser(ctx context.Context, o *influxdb.User) error
- func (s *AuthedUserService) DeleteUser(ctx context.Context, id platform.ID) error
- func (s *AuthedUserService) FindPermissionForUser(ctx context.Context, id platform.ID) (influxdb.PermissionSet, error)
- func (s *AuthedUserService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
- func (s *AuthedUserService) FindUserByID(ctx context.Context, id platform.ID) (*influxdb.User, error)
- func (s *AuthedUserService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
- func (s *AuthedUserService) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
- type BucketClientService
- func (s *BucketClientService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (s *BucketClientService) DeleteBucket(ctx context.Context, id platform.ID) error
- func (s *BucketClientService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
- func (s *BucketClientService) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
- func (s *BucketClientService) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (*influxdb.Bucket, error)
- func (s *BucketClientService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
- func (s *BucketClientService) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- type BucketFilter
- type BucketHandler
- type BucketLogger
- func (l *BucketLogger) CreateBucket(ctx context.Context, u *influxdb.Bucket) (err error)
- func (l *BucketLogger) DeleteBucket(ctx context.Context, id platform.ID) (err error)
- func (l *BucketLogger) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (u *influxdb.Bucket, err error)
- func (l *BucketLogger) FindBucketByID(ctx context.Context, id platform.ID) (u *influxdb.Bucket, err error)
- func (l *BucketLogger) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (u *influxdb.Bucket, err error)
- func (l *BucketLogger) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) (buckets []*influxdb.Bucket, n int, err error)
- func (l *BucketLogger) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (u *influxdb.Bucket, err error)
- type BucketMetrics
- func (m *BucketMetrics) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (m *BucketMetrics) DeleteBucket(ctx context.Context, id platform.ID) error
- func (m *BucketMetrics) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
- func (m *BucketMetrics) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
- func (m *BucketMetrics) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (*influxdb.Bucket, error)
- func (m *BucketMetrics) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
- func (m *BucketMetrics) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- 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 OnboardClientService
- type OnboardHandler
- type OnboardService
- type OnboardServiceOptionFn
- type OnboardingLogger
- type OnboardingMetrics
- type OpLogService
- func (s *OpLogService) GetBucketOperationLog(ctx context.Context, id platform.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- func (s *OpLogService) GetOrganizationOperationLog(ctx context.Context, id platform.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- func (s *OpLogService) GetUserOperationLog(ctx context.Context, id platform.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- type OpLogStore
- type OrgClientService
- func (s *OrgClientService) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
- func (s *OrgClientService) DeleteOrganization(ctx context.Context, id platform.ID) error
- func (s *OrgClientService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
- func (s *OrgClientService) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
- func (s *OrgClientService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) ([]*influxdb.Organization, int, error)
- func (s *OrgClientService) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- type OrgHandler
- type OrgLogger
- func (l *OrgLogger) CreateOrganization(ctx context.Context, u *influxdb.Organization) (err error)
- func (l *OrgLogger) DeleteOrganization(ctx context.Context, id platform.ID) (err error)
- func (l *OrgLogger) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (u *influxdb.Organization, err error)
- func (l *OrgLogger) FindOrganizationByID(ctx context.Context, id platform.ID) (u *influxdb.Organization, err error)
- func (l *OrgLogger) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) (orgs []*influxdb.Organization, n int, err error)
- func (l *OrgLogger) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (u *influxdb.Organization, err error)
- type OrgMetrics
- func (m *OrgMetrics) CreateOrganization(ctx context.Context, b *influxdb.Organization) error
- func (m *OrgMetrics) DeleteOrganization(ctx context.Context, id platform.ID) error
- func (m *OrgMetrics) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
- func (m *OrgMetrics) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
- func (m *OrgMetrics) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) ([]*influxdb.Organization, int, error)
- func (m *OrgMetrics) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- type OrgSvc
- func (s *OrgSvc) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
- func (s *OrgSvc) DeleteOrganization(ctx context.Context, id platform.ID) error
- func (s *OrgSvc) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
- func (s *OrgSvc) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
- func (s *OrgSvc) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) ([]*influxdb.Organization, int, error)
- func (s *OrgSvc) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- type PasswordClientService
- func (s *PasswordClientService) CompareAndSetPassword(ctx context.Context, userID platform.ID, old string, new string) error
- func (s *PasswordClientService) ComparePassword(ctx context.Context, userID platform.ID, password string) error
- func (s *PasswordClientService) SetPassword(ctx context.Context, userID platform.ID, password string) error
- type PasswordLogger
- func (l *PasswordLogger) CompareAndSetPassword(ctx context.Context, userID platform.ID, old, new string) (err error)
- func (l *PasswordLogger) ComparePassword(ctx context.Context, userID platform.ID, password string) (err error)
- func (l *PasswordLogger) SetPassword(ctx context.Context, userID platform.ID, password string) (err error)
- type PasswordMetrics
- func (m *PasswordMetrics) CompareAndSetPassword(ctx context.Context, userID platform.ID, old, new string) error
- func (m *PasswordMetrics) ComparePassword(ctx context.Context, userID platform.ID, password string) error
- func (m *PasswordMetrics) SetPassword(ctx context.Context, userID platform.ID, password string) error
- type Service
- func (ts *Service) NewBucketHTTPHandler(log *zap.Logger, labelSvc influxdb.LabelService) *BucketHandler
- func (ts *Service) NewOrgHTTPHandler(log *zap.Logger, secretSvc influxdb.SecretService) *OrgHandler
- func (ts *Service) NewUserHTTPHandler(log *zap.Logger) *UserHandler
- func (s *Service) RLock()
- func (s *Service) RUnlock()
- type SpecificURMSvc
- func (s *SpecificURMSvc) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
- func (s *SpecificURMSvc) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error
- func (s *SpecificURMSvc) FindUserResourceMappings(ctx context.Context, f influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- type Store
- func (s *Store) CreateBucket(ctx context.Context, tx kv.Tx, bucket *influxdb.Bucket) (err error)
- func (s *Store) CreateOrg(ctx context.Context, tx kv.Tx, o *influxdb.Organization) (err error)
- func (s *Store) CreateURM(ctx context.Context, tx kv.Tx, urm *influxdb.UserResourceMapping) error
- func (s *Store) CreateUser(ctx context.Context, tx kv.Tx, u *influxdb.User) error
- func (s *Store) DeleteBucket(ctx context.Context, tx kv.Tx, id platform.ID) error
- func (s *Store) DeleteOrg(ctx context.Context, tx kv.Tx, id platform.ID) error
- func (s *Store) DeletePassword(ctx context.Context, tx kv.Tx, id platform.ID) error
- func (s *Store) DeleteURM(ctx context.Context, tx kv.Tx, resourceID, userID platform.ID) error
- func (s *Store) DeleteUser(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) GetOrg(ctx context.Context, tx kv.Tx, id platform.ID) (*influxdb.Organization, error)
- func (s *Store) GetOrgByName(ctx context.Context, tx kv.Tx, n string) (*influxdb.Organization, error)
- func (s *Store) GetPassword(ctx context.Context, tx kv.Tx, id platform.ID) (string, error)
- func (s *Store) GetURM(ctx context.Context, tx kv.Tx, resourceID, userID platform.ID) (*influxdb.UserResourceMapping, error)
- func (s *Store) GetUser(ctx context.Context, tx kv.Tx, id platform.ID) (*influxdb.User, error)
- func (s *Store) GetUserByName(ctx context.Context, tx kv.Tx, n string) (*influxdb.User, error)
- func (s *Store) ListBuckets(ctx context.Context, tx kv.Tx, filter BucketFilter, ...) ([]*influxdb.Bucket, error)
- func (s *Store) ListOrgs(ctx context.Context, tx kv.Tx, opt ...influxdb.FindOptions) ([]*influxdb.Organization, error)
- func (s *Store) ListURMs(ctx context.Context, tx kv.Tx, filter influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, error)
- func (s *Store) ListUsers(ctx context.Context, tx kv.Tx, opt ...influxdb.FindOptions) ([]*influxdb.User, error)
- func (s *Store) RLock()
- func (s *Store) RUnlock()
- func (s *Store) SetPassword(ctx context.Context, tx kv.Tx, id platform.ID, password string) error
- 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) UpdateOrg(ctx context.Context, tx kv.Tx, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- func (s *Store) UpdateUser(ctx context.Context, tx kv.Tx, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
- func (s *Store) View(ctx context.Context, fn func(kv.Tx) error) error
- type StoreOption
- type URMLogger
- func (l *URMLogger) CreateUserResourceMapping(ctx context.Context, u *influxdb.UserResourceMapping) (err error)
- func (l *URMLogger) DeleteUserResourceMapping(ctx context.Context, resourceID, userID platform.ID) (err error)
- func (l *URMLogger) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, ...) (urms []*influxdb.UserResourceMapping, n int, err error)
- type URMSvc
- func (s *URMSvc) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
- func (s *URMSvc) DeleteUserResourceMapping(ctx context.Context, resourceID, userID platform.ID) error
- func (s *URMSvc) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- type UrmMetrics
- func (m *UrmMetrics) CreateUserResourceMapping(ctx context.Context, urm *influxdb.UserResourceMapping) error
- func (m *UrmMetrics) DeleteUserResourceMapping(ctx context.Context, resourceID, userID platform.ID) error
- func (m *UrmMetrics) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- type UserClientService
- func (s *UserClientService) CreateUser(ctx context.Context, u *influxdb.User) error
- func (s *UserClientService) DeleteUser(ctx context.Context, id platform.ID) error
- func (s *UserClientService) FindMe(ctx context.Context, id platform.ID) (*influxdb.User, error)
- func (s *UserClientService) FindPermissionForUser(ctx context.Context, id platform.ID) (influxdb.PermissionSet, error)
- func (s *UserClientService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
- func (s *UserClientService) FindUserByID(ctx context.Context, id platform.ID) (*influxdb.User, error)
- func (s *UserClientService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
- func (s *UserClientService) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
- type UserHandler
- type UserLogger
- func (l *UserLogger) CreateUser(ctx context.Context, u *influxdb.User) (err error)
- func (l *UserLogger) DeleteUser(ctx context.Context, id platform.ID) (err error)
- func (l *UserLogger) FindPermissionForUser(ctx context.Context, id platform.ID) (ps influxdb.PermissionSet, err error)
- func (l *UserLogger) FindUser(ctx context.Context, filter influxdb.UserFilter) (u *influxdb.User, err error)
- func (l *UserLogger) FindUserByID(ctx context.Context, id platform.ID) (u *influxdb.User, err error)
- func (l *UserLogger) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) (users []*influxdb.User, n int, err error)
- func (l *UserLogger) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (u *influxdb.User, err error)
- type UserMetrics
- func (m *UserMetrics) CreateUser(ctx context.Context, u *influxdb.User) error
- func (m *UserMetrics) DeleteUser(ctx context.Context, id platform.ID) error
- func (m *UserMetrics) FindPermissionForUser(ctx context.Context, id platform.ID) (influxdb.PermissionSet, error)
- func (m *UserMetrics) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
- func (m *UserMetrics) FindUserByID(ctx context.Context, id platform.ID) (*influxdb.User, error)
- func (m *UserMetrics) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
- func (m *UserMetrics) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
- type UserResourceMappingClient
- func (s *UserResourceMappingClient) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
- func (s *UserResourceMappingClient) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error
- func (s *UserResourceMappingClient) FindUserResourceMappings(ctx context.Context, f influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- func (s *UserResourceMappingClient) SpecificURMSvc(rt influxdb.ResourceType, ut influxdb.UserType) *SpecificURMSvc
- type UserSvc
- func (s *UserSvc) CompareAndSetPassword(ctx context.Context, userID platform.ID, old, new string) error
- func (s *UserSvc) ComparePassword(ctx context.Context, userID platform.ID, password string) error
- func (s *UserSvc) CreateUser(ctx context.Context, u *influxdb.User) error
- func (s *UserSvc) DeleteUser(ctx context.Context, id platform.ID) error
- func (s *UserSvc) FindPermissionForUser(ctx context.Context, uid platform.ID) (influxdb.PermissionSet, error)
- func (s *UserSvc) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
- func (s *UserSvc) FindUserByID(ctx context.Context, id platform.ID) (*influxdb.User, error)
- func (s *UserSvc) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
- func (s *UserSvc) SetPassword(ctx context.Context, userID platform.ID, password string) error
- func (s *UserSvc) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
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 NewOnboardService ¶
func NewOnboardService(svc *Service, as influxdb.AuthorizationService, opts ...OnboardServiceOptionFn) influxdb.OnboardingService
func NewOnboardingResponse ¶
func NewOnboardingResponse(results *influxdb.OnboardingResults) *onboardingResponse
func NewURMHandler ¶
func NewURMHandler(log *zap.Logger, rt influxdb.ResourceType, idLookupKey string, uSvc influxdb.UserService, urmSvc influxdb.UserResourceMappingService) http.Handler
NewURMHandler generates a mountable handler for URMs. It needs to know how it will be looking up your resource id this system assumes you are using chi syntax for query string params `/orgs/{id}/` so it can use chi.URLParam().
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 ¶ added in v2.5.0
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 AuthedBucketService ¶
type AuthedBucketService struct {
// contains filtered or unexported fields
}
AuthedBucketService wraps a influxdb.BucketService and authorizes actions against it appropriately.
func NewAuthedBucketService ¶
func NewAuthedBucketService(s influxdb.BucketService) *AuthedBucketService
NewAuthedBucketService constructs an instance of an authorizing bucket service.
func (*AuthedBucketService) CreateBucket ¶
func (s *AuthedBucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
CreateBucket checks to see if the authorizer on context has write access to the global buckets resource.
func (*AuthedBucketService) DeleteBucket ¶
DeleteBucket checks to see if the authorizer on context has write access to the bucket provided.
func (*AuthedBucketService) FindBucket ¶
func (s *AuthedBucketService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
FindBucket retrieves the bucket and checks to see if the authorizer on context has read access to the bucket.
func (*AuthedBucketService) FindBucketByID ¶
func (s *AuthedBucketService) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
FindBucketByID checks to see if the authorizer on context has read access to the id provided.
func (*AuthedBucketService) FindBucketByName ¶
func (s *AuthedBucketService) FindBucketByName(ctx context.Context, orgID platform.ID, n string) (*influxdb.Bucket, error)
FindBucketByName returns a bucket by name for a particular organization.
func (*AuthedBucketService) FindBuckets ¶
func (s *AuthedBucketService) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) ([]*influxdb.Bucket, int, error)
FindBuckets retrieves all buckets that match the provided filter and then filters the list down to only the resources that are authorized.
func (*AuthedBucketService) UpdateBucket ¶
func (s *AuthedBucketService) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
UpdateBucket checks to see if the authorizer on context has write access to the bucket provided.
type AuthedOnboardSvc ¶
type AuthedOnboardSvc struct {
// contains filtered or unexported fields
}
AuthedOnboardSvc wraps a influxdb.OnboardingService and authorizes actions against it appropriately.
func NewAuthedOnboardSvc ¶
func NewAuthedOnboardSvc(s influxdb.OnboardingService) *AuthedOnboardSvc
NewAuthedOnboardSvc constructs an instance of an authorizing org service.
func (*AuthedOnboardSvc) IsOnboarding ¶
func (s *AuthedOnboardSvc) IsOnboarding(ctx context.Context) (bool, error)
IsOnboarding pass through. this is handled by the underlying service layer
func (*AuthedOnboardSvc) OnboardInitialUser ¶
func (s *AuthedOnboardSvc) OnboardInitialUser(ctx context.Context, req *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
OnboardInitialUser pass through. this is handled by the underlying service layer
type AuthedOrgService ¶
type AuthedOrgService struct {
// contains filtered or unexported fields
}
AuthedOrgService wraps a influxdb.OrganizationService and authorizes actions against it appropriately.
func NewAuthedOrgService ¶
func NewAuthedOrgService(s influxdb.OrganizationService) *AuthedOrgService
NewAuthedOrgService constructs an instance of an authorizing org service.
func (*AuthedOrgService) CreateOrganization ¶
func (s *AuthedOrgService) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
CreateOrganization checks to see if the authorizer on context has write access to the global orgs resource.
func (*AuthedOrgService) DeleteOrganization ¶
DeleteOrganization checks to see if the authorizer on context has write access to the organization provided.
func (*AuthedOrgService) FindOrganization ¶
func (s *AuthedOrgService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
FindOrganization retrieves the organization and checks to see if the authorizer on context has read access to the org.
func (*AuthedOrgService) FindOrganizationByID ¶
func (s *AuthedOrgService) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
FindOrganizationByID checks to see if the authorizer on context has read access to the id provided.
func (*AuthedOrgService) FindOrganizations ¶
func (s *AuthedOrgService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Organization, int, error)
FindOrganizations retrieves all organizations that match the provided filter and then filters the list down to only the resources that are authorized.
func (*AuthedOrgService) UpdateOrganization ¶
func (s *AuthedOrgService) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
UpdateOrganization checks to see if the authorizer on context has write access to the organization provided.
type AuthedPasswordService ¶
type AuthedPasswordService struct {
// contains filtered or unexported fields
}
AuthedPasswordService is a new authorization middleware for a password service.
func NewAuthedPasswordService ¶
func NewAuthedPasswordService(svc influxdb.PasswordsService) *AuthedPasswordService
NewAuthedPasswordService wraps an existing password service with auth middleware.
func (*AuthedPasswordService) CompareAndSetPassword ¶
func (s *AuthedPasswordService) CompareAndSetPassword(ctx context.Context, userID platform.ID, old string, new string) error
CompareAndSetPassword checks the password and if they match updates to the new password.
func (*AuthedPasswordService) ComparePassword ¶
func (s *AuthedPasswordService) ComparePassword(ctx context.Context, userID platform.ID, password string) error
ComparePassword checks if the password matches the password recorded. Passwords that do not match return errors.
func (*AuthedPasswordService) SetPassword ¶
func (s *AuthedPasswordService) SetPassword(ctx context.Context, userID platform.ID, password string) error
SetPassword overrides the password of a known user.
type AuthedURMService ¶
type AuthedURMService struct {
// contains filtered or unexported fields
}
func NewAuthedURMService ¶
func NewAuthedURMService(orgSvc influxdb.OrganizationService, s influxdb.UserResourceMappingService) *AuthedURMService
func (*AuthedURMService) CreateUserResourceMapping ¶
func (s *AuthedURMService) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
func (*AuthedURMService) DeleteUserResourceMapping ¶
func (*AuthedURMService) FindUserResourceMappings ¶
func (s *AuthedURMService) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
type AuthedUserService ¶
type AuthedUserService struct {
// contains filtered or unexported fields
}
AuthedUserService wraps a influxdb.UserService and authorizes actions against it appropriately.
func NewAuthedUserService ¶
func NewAuthedUserService(s influxdb.UserService) *AuthedUserService
NewAuthedUserService constructs an instance of an authorizing user service.
func (*AuthedUserService) CreateUser ¶
func (s *AuthedUserService) CreateUser(ctx context.Context, o *influxdb.User) error
CreateUser checks to see if the authorizer on context has write access to the global users resource.
func (*AuthedUserService) DeleteUser ¶
DeleteUser checks to see if the authorizer on context has write access to the user provided.
func (*AuthedUserService) FindPermissionForUser ¶
func (*AuthedUserService) FindUser ¶
func (s *AuthedUserService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
FindUser retrieves the user and checks to see if the authorizer on context has read access to the user.
func (*AuthedUserService) FindUserByID ¶
func (s *AuthedUserService) FindUserByID(ctx context.Context, id platform.ID) (*influxdb.User, error)
FindUserByID checks to see if the authorizer on context has read access to the id provided.
func (*AuthedUserService) FindUsers ¶
func (s *AuthedUserService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
FindUsers retrieves all users that match the provided filter and then filters the list down to only the resources that are authorized.
func (*AuthedUserService) UpdateUser ¶
func (s *AuthedUserService) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
UpdateUser checks to see if the authorizer on context has write access to the user provided.
type BucketClientService ¶
type BucketClientService struct { Client *httpc.Client // OpPrefix is an additional property for error // find bucket service, when finds nothing. OpPrefix string }
BucketClientService connects to Influx via HTTP using tokens to manage buckets
func (*BucketClientService) CreateBucket ¶
func (s *BucketClientService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
CreateBucket creates a new bucket and sets b.ID with the new identifier.
func (*BucketClientService) DeleteBucket ¶
DeleteBucket removes a bucket by ID.
func (*BucketClientService) FindBucket ¶
func (s *BucketClientService) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
FindBucket returns the first bucket that matches filter.
func (*BucketClientService) FindBucketByID ¶
func (s *BucketClientService) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
FindBucketByID returns a single bucket by ID.
func (*BucketClientService) FindBucketByName ¶
func (s *BucketClientService) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (*influxdb.Bucket, error)
FindBucketByName returns a single bucket by name
func (*BucketClientService) FindBuckets ¶
func (s *BucketClientService) 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.
func (*BucketClientService) UpdateBucket ¶
func (s *BucketClientService) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
UpdateBucket updates a single bucket with changeset. Returns the new bucket state after update.
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 BucketLogger ¶
type BucketLogger struct {
// contains filtered or unexported fields
}
func NewBucketLogger ¶
func NewBucketLogger(log *zap.Logger, s influxdb.BucketService) *BucketLogger
NewBucketLogger returns a logging service middleware for the Bucket Service.
func (*BucketLogger) CreateBucket ¶
func (l *BucketLogger) CreateBucket(ctx context.Context, u *influxdb.Bucket) (err error)
func (*BucketLogger) DeleteBucket ¶
func (*BucketLogger) FindBucket ¶
func (l *BucketLogger) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (u *influxdb.Bucket, err error)
func (*BucketLogger) FindBucketByID ¶
func (*BucketLogger) FindBucketByName ¶
func (*BucketLogger) FindBuckets ¶
func (l *BucketLogger) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opt ...influxdb.FindOptions) (buckets []*influxdb.Bucket, n int, err error)
func (*BucketLogger) UpdateBucket ¶
type BucketMetrics ¶
type BucketMetrics struct {
// contains filtered or unexported fields
}
func NewBucketMetrics ¶
func NewBucketMetrics(reg prometheus.Registerer, s influxdb.BucketService, opts ...metric.ClientOptFn) *BucketMetrics
NewBucketMetrics returns a metrics service middleware for the Bucket Service.
func (*BucketMetrics) CreateBucket ¶
func (m *BucketMetrics) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
Creates a new bucket and sets b.ID with the new identifier.
func (*BucketMetrics) DeleteBucket ¶
Removes a bucket by ID.
func (*BucketMetrics) FindBucket ¶
func (m *BucketMetrics) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
Returns the first bucket that matches filter.
func (*BucketMetrics) FindBucketByID ¶
func (m *BucketMetrics) FindBucketByID(ctx context.Context, id platform.ID) (*influxdb.Bucket, error)
Returns a single bucket by ID.
func (*BucketMetrics) FindBucketByName ¶
func (m *BucketMetrics) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (*influxdb.Bucket, error)
FindBucketByName finds a Bucket given its name and Organization ID
func (*BucketMetrics) FindBuckets ¶
func (m *BucketMetrics) 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.
func (*BucketMetrics) UpdateBucket ¶
func (m *BucketMetrics) UpdateBucket(ctx context.Context, id platform.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
Updates a single bucket with changeset and returns the new bucket state after update.
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 OnboardClientService ¶
OnboardClientService connects to Influx via HTTP to perform onboarding operations
func (*OnboardClientService) IsOnboarding ¶
func (s *OnboardClientService) IsOnboarding(ctx context.Context) (bool, error)
IsOnboarding determine if onboarding request is allowed.
func (*OnboardClientService) OnboardInitialUser ¶
func (s *OnboardClientService) OnboardInitialUser(ctx context.Context, or *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
OnboardInitialUser OnboardingResults.
type OnboardHandler ¶
OnboardHandler represents an HTTP API handler for users.
func NewHTTPOnboardHandler ¶
func NewHTTPOnboardHandler(log *zap.Logger, onboardSvc influxdb.OnboardingService) *OnboardHandler
NewHTTPOnboardHandler constructs a new http server.
func (*OnboardHandler) Prefix ¶
func (h *OnboardHandler) Prefix() string
type OnboardService ¶
type OnboardService struct {
// contains filtered or unexported fields
}
func (*OnboardService) IsOnboarding ¶
func (s *OnboardService) IsOnboarding(ctx context.Context) (bool, error)
IsOnboarding determine if onboarding request is allowed.
func (*OnboardService) OnboardInitialUser ¶
func (s *OnboardService) OnboardInitialUser(ctx context.Context, req *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
OnboardInitialUser allows us to onboard a new user if is onboarding is allowed
type OnboardServiceOptionFn ¶
type OnboardServiceOptionFn func(*OnboardService)
func WithAlwaysAllowInitialUser ¶
func WithAlwaysAllowInitialUser() OnboardServiceOptionFn
WithAlwaysAllowInitialUser configures the OnboardService to always return true for IsOnboarding to allow multiple initial onboard requests.
func WithOnboardingLogger ¶ added in v2.0.4
func WithOnboardingLogger(logger *zap.Logger) OnboardServiceOptionFn
type OnboardingLogger ¶
type OnboardingLogger struct {
// contains filtered or unexported fields
}
func NewOnboardingLogger ¶
func NewOnboardingLogger(log *zap.Logger, s influxdb.OnboardingService) *OnboardingLogger
NewOnboardingLogger returns a logging service middleware for the Bucket Service.
func (*OnboardingLogger) IsOnboarding ¶
func (l *OnboardingLogger) IsOnboarding(ctx context.Context) (available bool, err error)
func (*OnboardingLogger) OnboardInitialUser ¶
func (l *OnboardingLogger) OnboardInitialUser(ctx context.Context, req *influxdb.OnboardingRequest) (res *influxdb.OnboardingResults, err error)
type OnboardingMetrics ¶
type OnboardingMetrics struct {
// contains filtered or unexported fields
}
func NewOnboardingMetrics ¶
func NewOnboardingMetrics(reg prometheus.Registerer, s influxdb.OnboardingService, opts ...metric.ClientOptFn) *OnboardingMetrics
NewOnboardingMetrics returns a metrics service middleware for the User Service.
func (*OnboardingMetrics) IsOnboarding ¶
func (m *OnboardingMetrics) IsOnboarding(ctx context.Context) (bool, error)
func (*OnboardingMetrics) OnboardInitialUser ¶
func (m *OnboardingMetrics) OnboardInitialUser(ctx context.Context, req *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
type OpLogService ¶ added in v2.0.2
type OpLogService struct { TimeGenerator influxdb.TimeGenerator // contains filtered or unexported fields }
OpLogService is a type which stores operation logs for buckets, users and orgs.
func NewOpLogService ¶ added in v2.0.2
func NewOpLogService(store kv.Store, opLogStore OpLogStore) *OpLogService
NewOpLogService constructs and configures a new op log service.
func (*OpLogService) GetBucketOperationLog ¶ added in v2.0.2
func (s *OpLogService) GetBucketOperationLog(ctx context.Context, id platform.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetBucketOperationLog retrieves a buckets operation log.
func (*OpLogService) GetOrganizationOperationLog ¶ added in v2.0.2
func (s *OpLogService) GetOrganizationOperationLog(ctx context.Context, id platform.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetOrganizationOperationLog retrieves a organization operation log.
func (*OpLogService) GetUserOperationLog ¶ added in v2.0.2
func (s *OpLogService) GetUserOperationLog(ctx context.Context, id platform.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetUserOperationLog retrieves a user operation log.
type OpLogStore ¶ added in v2.0.2
type OpLogStore interface { AddLogEntryTx(ctx context.Context, tx kv.Tx, k, v []byte, t time.Time) error ForEachLogEntryTx(ctx context.Context, tx kv.Tx, k []byte, opts influxdb.FindOptions, fn func([]byte, time.Time) error) error }
OpLogStore is a type which persists and reports operation log entries on a backing kv store transaction.
type OrgClientService ¶
type OrgClientService struct { Client *httpc.Client // OpPrefix is for not found errors. OpPrefix string }
OrgClientService connects to Influx via HTTP using tokens to manage organizations
func (*OrgClientService) CreateOrganization ¶
func (s *OrgClientService) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
CreateOrganization creates an organization.
func (*OrgClientService) DeleteOrganization ¶
DeleteOrganization removes organization id over HTTP.
func (*OrgClientService) FindOrganization ¶
func (s *OrgClientService) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
FindOrganization gets a single organization matching the filter using HTTP.
func (*OrgClientService) FindOrganizationByID ¶
func (s *OrgClientService) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
FindOrganizationByID gets a single organization with a given id using HTTP.
func (*OrgClientService) FindOrganizations ¶
func (s *OrgClientService) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Organization, int, error)
FindOrganizations returns all organizations that match the filter via HTTP.
func (*OrgClientService) UpdateOrganization ¶
func (s *OrgClientService) UpdateOrganization(ctx context.Context, id platform.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
UpdateOrganization updates the organization over HTTP.
type OrgHandler ¶
OrgHandler represents an HTTP API handler for organizations.
func NewHTTPOrgHandler ¶
func NewHTTPOrgHandler(log *zap.Logger, orgService influxdb.OrganizationService, urm http.Handler, secretHandler http.Handler) *OrgHandler
NewHTTPOrgHandler constructs a new http server.
func (*OrgHandler) Prefix ¶
func (h *OrgHandler) Prefix() string
type OrgLogger ¶
type OrgLogger struct {
// contains filtered or unexported fields
}
func NewOrgLogger ¶
NewOrgLogger returns a logging service middleware for the Organization Service.
func (*OrgLogger) CreateOrganization ¶
func (*OrgLogger) DeleteOrganization ¶
func (*OrgLogger) FindOrganization ¶
func (*OrgLogger) FindOrganizationByID ¶
func (*OrgLogger) FindOrganizations ¶
type OrgMetrics ¶
type OrgMetrics struct {
// contains filtered or unexported fields
}
func NewOrgMetrics ¶
func NewOrgMetrics(reg prometheus.Registerer, s influxdb.OrganizationService, opts ...metric.ClientOptFn) *OrgMetrics
NewOrgMetrics returns a metrics service middleware for the Organization Service.
func (*OrgMetrics) CreateOrganization ¶
func (m *OrgMetrics) CreateOrganization(ctx context.Context, b *influxdb.Organization) error
func (*OrgMetrics) DeleteOrganization ¶
func (*OrgMetrics) FindOrganization ¶
func (m *OrgMetrics) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
func (*OrgMetrics) FindOrganizationByID ¶
func (*OrgMetrics) FindOrganizations ¶
func (m *OrgMetrics) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Organization, int, error)
func (*OrgMetrics) UpdateOrganization ¶
type OrgSvc ¶
type OrgSvc struct {
// contains filtered or unexported fields
}
func NewOrganizationSvc ¶
func (*OrgSvc) CreateOrganization ¶
Creates a new organization and sets b.ID with the new identifier.
func (*OrgSvc) DeleteOrganization ¶
DeleteOrganization removes a organization by ID and its dependent resources.
func (*OrgSvc) FindOrganization ¶
func (s *OrgSvc) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
Returns the first organization that matches filter.
func (*OrgSvc) FindOrganizationByID ¶
func (s *OrgSvc) FindOrganizationByID(ctx context.Context, id platform.ID) (*influxdb.Organization, error)
Returns a single organization by ID.
func (*OrgSvc) FindOrganizations ¶
func (s *OrgSvc) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.Organization, int, error)
Returns a list of organizations that match filter and the total count of matching organizations. Additional options provide pagination & sorting.
type PasswordClientService ¶
PasswordClientService is an http client to speak to the password service.
func (*PasswordClientService) CompareAndSetPassword ¶
func (s *PasswordClientService) CompareAndSetPassword(ctx context.Context, userID platform.ID, old string, new string) error
CompareAndSetPassword compares the old and new password and submits the new password if possible. Note: is not implemented.
func (*PasswordClientService) ComparePassword ¶
func (s *PasswordClientService) ComparePassword(ctx context.Context, userID platform.ID, password string) error
ComparePassword compares the user new password with existing. Note: is not implemented.
func (*PasswordClientService) SetPassword ¶
func (s *PasswordClientService) SetPassword(ctx context.Context, userID platform.ID, password string) error
SetPassword sets the user's password.
type PasswordLogger ¶
type PasswordLogger struct {
// contains filtered or unexported fields
}
func NewPasswordLogger ¶
func NewPasswordLogger(log *zap.Logger, s influxdb.PasswordsService) *PasswordLogger
NewPasswordLogger returns a logging service middleware for the Password Service.
func (*PasswordLogger) CompareAndSetPassword ¶
func (*PasswordLogger) ComparePassword ¶
func (*PasswordLogger) SetPassword ¶
type PasswordMetrics ¶
type PasswordMetrics struct {
// contains filtered or unexported fields
}
func NewPasswordMetrics ¶
func NewPasswordMetrics(reg prometheus.Registerer, s influxdb.PasswordsService, opts ...metric.ClientOptFn) *PasswordMetrics
NewPasswordMetrics returns a metrics service middleware for the Password Service.
func (*PasswordMetrics) CompareAndSetPassword ¶
func (*PasswordMetrics) ComparePassword ¶
func (*PasswordMetrics) SetPassword ¶
type Service ¶
type Service struct { influxdb.UserService influxdb.PasswordsService influxdb.UserResourceMappingService influxdb.OrganizationService influxdb.BucketService // contains filtered or unexported fields }
func NewSystem ¶
func NewSystem(store *Store, log *zap.Logger, reg prometheus.Registerer, metricOpts ...metric.ClientOptFn) *Service
creates a new Service with logging and metrics middleware wrappers.
func (*Service) NewBucketHTTPHandler ¶
func (ts *Service) NewBucketHTTPHandler(log *zap.Logger, labelSvc influxdb.LabelService) *BucketHandler
func (*Service) NewOrgHTTPHandler ¶
func (ts *Service) NewOrgHTTPHandler(log *zap.Logger, secretSvc influxdb.SecretService) *OrgHandler
func (*Service) NewUserHTTPHandler ¶
func (ts *Service) NewUserHTTPHandler(log *zap.Logger) *UserHandler
type SpecificURMSvc ¶
SpecificURMSvc is a URM client that speaks to a specific resource with a specified user type
func (*SpecificURMSvc) CreateUserResourceMapping ¶
func (s *SpecificURMSvc) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
CreateUserResourceMapping will create a user resource mapping
func (*SpecificURMSvc) DeleteUserResourceMapping ¶
func (s *SpecificURMSvc) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error
DeleteUserResourceMapping will delete user resource mapping based in criteria.
func (*SpecificURMSvc) FindUserResourceMappings ¶
func (s *SpecificURMSvc) FindUserResourceMappings(ctx context.Context, f influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
FindUserResourceMappings returns the user resource mappings
type Store ¶
type Store struct { IDGen platform.IDGenerator OrgIDGen platform.IDGenerator BucketIDGen platform.IDGenerator // contains filtered or unexported fields }
func (*Store) CreateBucket ¶
func (*Store) CreateURM ¶
NOTE(affo): On URM creation, we check that the user exists. We do not check that the resource it is pointing to exists. This decision takes into account that different resources could not be in the same store. To perform that kind of check, we must rely on the service layer. However, we do not want having the storage layer depend on the service layer above.
func (*Store) CreateUser ¶
func (*Store) DeleteBucket ¶
func (*Store) DeletePassword ¶
func (*Store) DeleteUser ¶
func (*Store) GetBucketByName ¶
func (*Store) GetOrgByName ¶
func (*Store) GetPassword ¶
func (*Store) GetUserByName ¶
func (*Store) ListBuckets ¶
func (*Store) SetPassword ¶
func (*Store) UpdateBucket ¶
func (*Store) UpdateUser ¶
type StoreOption ¶
type StoreOption func(*Store)
type URMLogger ¶
type URMLogger struct {
// contains filtered or unexported fields
}
func NewURMLogger ¶
NewUrmLogger returns a logging service middleware for the User Resource Mapping Service.
func (*URMLogger) CreateUserResourceMapping ¶
func (*URMLogger) DeleteUserResourceMapping ¶
type URMSvc ¶
type URMSvc struct {
// contains filtered or unexported fields
}
func (*URMSvc) CreateUserResourceMapping ¶
func (s *URMSvc) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
CreateUserResourceMapping creates a user resource mapping.
func (*URMSvc) DeleteUserResourceMapping ¶
func (s *URMSvc) DeleteUserResourceMapping(ctx context.Context, resourceID, userID platform.ID) error
DeleteUserResourceMapping deletes a user resource mapping.
func (*URMSvc) FindUserResourceMappings ¶
func (s *URMSvc) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
FindUserResourceMappings returns a list of UserResourceMappings that match filter and the total count of matching mappings.
type UrmMetrics ¶
type UrmMetrics struct {
// contains filtered or unexported fields
}
func NewUrmMetrics ¶
func NewUrmMetrics(reg prometheus.Registerer, s influxdb.UserResourceMappingService, opts ...metric.ClientOptFn) *UrmMetrics
NewUrmMetrics returns a metrics service middleware for the User Resource Mapping Service.
func (*UrmMetrics) CreateUserResourceMapping ¶
func (m *UrmMetrics) CreateUserResourceMapping(ctx context.Context, urm *influxdb.UserResourceMapping) error
func (*UrmMetrics) DeleteUserResourceMapping ¶
func (*UrmMetrics) FindUserResourceMappings ¶
func (m *UrmMetrics) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
type UserClientService ¶
type UserClientService struct { Client *httpc.Client // OpPrefix is the ops of not found error. OpPrefix string }
UserService connects to Influx via HTTP using tokens to manage users
func (*UserClientService) CreateUser ¶
func (s *UserClientService) CreateUser(ctx context.Context, u *influxdb.User) error
CreateUser creates a new user and sets u.ID with the new identifier.
func (*UserClientService) DeleteUser ¶
DeleteUser removes a user by ID.
func (*UserClientService) FindPermissionForUser ¶
func (s *UserClientService) FindPermissionForUser(ctx context.Context, id platform.ID) (influxdb.PermissionSet, error)
FindUserByID returns a single user by ID.
func (*UserClientService) FindUser ¶
func (s *UserClientService) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
FindUser returns the first user that matches filter.
func (*UserClientService) FindUserByID ¶
func (s *UserClientService) FindUserByID(ctx context.Context, id platform.ID) (*influxdb.User, error)
FindUserByID returns a single user by ID.
func (*UserClientService) FindUsers ¶
func (s *UserClientService) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
FindUsers returns a list of users that match filter and the total count of matching users. Additional options provide pagination & sorting.
func (*UserClientService) UpdateUser ¶
func (s *UserClientService) UpdateUser(ctx context.Context, id platform.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
UpdateUser updates a single user with changeset. Returns the new user state after update.
type UserHandler ¶
UserHandler represents an HTTP API handler for users.
func NewHTTPUserHandler ¶
func NewHTTPUserHandler(log *zap.Logger, userService influxdb.UserService, passwordService influxdb.PasswordsService) *UserHandler
NewHTTPUserHandler constructs a new http server.
func (*UserHandler) MeResourceHandler ¶
func (h *UserHandler) MeResourceHandler() *resourceHandler
func (*UserHandler) UserResourceHandler ¶
func (h *UserHandler) UserResourceHandler() *resourceHandler
type UserLogger ¶
type UserLogger struct {
// contains filtered or unexported fields
}
func NewUserLogger ¶
func NewUserLogger(log *zap.Logger, s influxdb.UserService) *UserLogger
NewUserLogger returns a logging service middleware for the User Service.
func (*UserLogger) CreateUser ¶
func (l *UserLogger) CreateUser(ctx context.Context, u *influxdb.User) (err error)
func (*UserLogger) DeleteUser ¶
func (*UserLogger) FindPermissionForUser ¶
func (*UserLogger) FindUser ¶
func (l *UserLogger) FindUser(ctx context.Context, filter influxdb.UserFilter) (u *influxdb.User, err error)
func (*UserLogger) FindUserByID ¶
func (*UserLogger) FindUsers ¶
func (l *UserLogger) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) (users []*influxdb.User, n int, err error)
func (*UserLogger) UpdateUser ¶
type UserMetrics ¶
type UserMetrics struct {
// contains filtered or unexported fields
}
func NewUserMetrics ¶
func NewUserMetrics(reg prometheus.Registerer, s influxdb.UserService, opts ...metric.ClientOptFn) *UserMetrics
NewUserMetrics returns a metrics service middleware for the User Service.
func (*UserMetrics) CreateUser ¶
func (m *UserMetrics) CreateUser(ctx context.Context, u *influxdb.User) error
func (*UserMetrics) DeleteUser ¶
func (*UserMetrics) FindPermissionForUser ¶
func (*UserMetrics) FindUser ¶
func (m *UserMetrics) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
func (*UserMetrics) FindUserByID ¶
func (*UserMetrics) FindUsers ¶
func (m *UserMetrics) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
func (*UserMetrics) UpdateUser ¶
type UserResourceMappingClient ¶
func (*UserResourceMappingClient) CreateUserResourceMapping ¶
func (s *UserResourceMappingClient) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
CreateUserResourceMapping will create a user resource mapping
func (*UserResourceMappingClient) DeleteUserResourceMapping ¶
func (s *UserResourceMappingClient) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error
DeleteUserResourceMapping will delete user resource mapping based in criteria.
func (*UserResourceMappingClient) FindUserResourceMappings ¶
func (s *UserResourceMappingClient) FindUserResourceMappings(ctx context.Context, f influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
FindUserResourceMappings returns the user resource mappings
func (*UserResourceMappingClient) SpecificURMSvc ¶
func (s *UserResourceMappingClient) SpecificURMSvc(rt influxdb.ResourceType, ut influxdb.UserType) *SpecificURMSvc
SpecificURMSvc returns a urm service with specific resource and user types. this will help us stay compatible with the existing service contract but also allow for urm deletes to go through the correct api
type UserSvc ¶
type UserSvc struct {
// contains filtered or unexported fields
}
func NewUserSvc ¶
func (*UserSvc) CompareAndSetPassword ¶
func (s *UserSvc) CompareAndSetPassword(ctx context.Context, userID platform.ID, old, new string) error
CompareAndSetPassword checks the password and if they match updates to the new password.
func (*UserSvc) ComparePassword ¶
ComparePassword checks if the password matches the password recorded. Passwords that do not match return errors.
func (*UserSvc) CreateUser ¶
Creates a new user and sets u.ID with the new identifier.
func (*UserSvc) DeleteUser ¶
Removes a user by ID.
func (*UserSvc) FindPermissionForUser ¶
func (s *UserSvc) FindPermissionForUser(ctx context.Context, uid platform.ID) (influxdb.PermissionSet, error)
FindPermissionForUser gets the full set of permission for a specified user id
func (*UserSvc) FindUserByID ¶
Returns a single user by ID.
func (*UserSvc) FindUsers ¶
func (s *UserSvc) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
Returns a list of users that match filter and the total count of matching users. Additional options provide pagination & sorting. {
func (*UserSvc) SetPassword ¶
SetPassword overrides the password of a known user.
Source Files ¶
- doc.go
- error.go
- error_bucket.go
- error_org.go
- error_urm.go
- error_user.go
- http_client_bucket.go
- http_client_onboarding.go
- http_client_org.go
- http_client_urm.go
- http_client_user.go
- http_handler_urm.go
- http_server_bucket.go
- http_server_onboarding.go
- http_server_org.go
- http_server_user.go
- middleware_bucket_auth.go
- middleware_bucket_logging.go
- middleware_bucket_metrics.go
- middleware_onboarding_auth.go
- middleware_onboarding_logging.go
- middleware_onboarding_metrics.go
- middleware_org_auth.go
- middleware_org_logging.go
- middleware_org_metrics.go
- middleware_urm_auth.go
- middleware_urm_logging.go
- middleware_urm_metrics.go
- middleware_user_auth.go
- middleware_user_logging.go
- middleware_user_metrics.go
- service.go
- service_bucket.go
- service_onboarding.go
- service_op_log.go
- service_org.go
- service_urm.go
- service_user.go
- storage.go
- storage_bucket.go
- storage_org.go
- storage_urm.go
- storage_user.go