Documentation ¶
Index ¶
- Constants
- Variables
- func GetRequest(ctx context.Context) *http.Request
- func NewMFAPasscode(secretKey string, t time.Time) (string, error)
- func NewMFARecoveryCode() (string, error)
- func NewMFASecretKey() (string, error)
- func NewMFAValidationOpts() totp.ValidateOpts
- func ValidateFullName(name string) error
- func ValidateMFAPasscode(passcode string, secretKey string, t time.Time) (bool, error)
- func ValidateNameAndDescription(name string, description string) error
- func ValidateNewPassword(pass string) error
- func WithRequest(ctx context.Context, req *http.Request) context.Context
- func WithUser(ctx context.Context, user *User) context.Context
- type APIKeyCursor
- type APIKeyInfo
- type APIKeyOrder
- type APIKeyPage
- type APIKeys
- type AccountActionStep
- type AccountActivationCodeEmail
- type AccountActivationEmail
- type AccountAlreadyExistsEmail
- type AccountDeletionSuccessEmail
- type AccountFreezeConfig
- type AccountFreezeEvent
- type AccountFreezeEventLimits
- type AccountFreezeEventType
- type AccountFreezeEvents
- type AccountFreezeService
- func (s *AccountFreezeService) BillingFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) BillingUnWarnUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) BillingUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) BillingWarnUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) BotFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) BotUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) DelayedBotFreezeUser(ctx context.Context, userID uuid.UUID, days *int) (err error)
- func (s *AccountFreezeService) EscalateFreezeEvent(ctx context.Context, userID uuid.UUID, event AccountFreezeEvent) (err error)
- func (s *AccountFreezeService) Get(ctx context.Context, userID uuid.UUID, freezeType AccountFreezeEventType) (event *AccountFreezeEvent, err error)
- func (s *AccountFreezeService) GetAll(ctx context.Context, userID uuid.UUID) (freezes *UserFreezeEvents, err error)
- func (s *AccountFreezeService) GetAllEvents(ctx context.Context, cursor FreezeEventsCursor) (events *FreezeEventsPage, err error)
- func (s *AccountFreezeService) GetAllEventsByType(ctx context.Context, cursor FreezeEventsCursor, ...) (events *FreezeEventsPage, err error)
- func (s *AccountFreezeService) GetDaysTillEscalation(event AccountFreezeEvent, now time.Time) *int
- func (s *AccountFreezeService) GetTrialExpirationFreezesToEscalate(ctx context.Context, limit int, cursor *FreezeEventsByEventAndUserStatusCursor) (events []AccountFreezeEvent, next *FreezeEventsByEventAndUserStatusCursor, ...)
- func (s *AccountFreezeService) IncrementNotificationsCount(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) error
- func (s *AccountFreezeService) IsUserBillingFrozen(ctx context.Context, userID uuid.UUID) (_ bool, err error)
- func (s *AccountFreezeService) IsUserFrozen(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) (_ bool, err error)
- func (s *AccountFreezeService) IsUserViolationFrozen(ctx context.Context, userID uuid.UUID) (_ bool, err error)
- func (s *AccountFreezeService) LegalFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) LegalUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) ShouldEscalateFreezeEvent(ctx context.Context, event AccountFreezeEvent, now time.Time) (shouldEscalate bool, err error)
- func (s *AccountFreezeService) TestChangeFreezeTracker(t analytics.FreezeTracker)
- func (s *AccountFreezeService) TestSetTrialExpirationFreezeGracePeriod(period time.Duration)
- func (s *AccountFreezeService) TrialExpirationFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) TrialExpirationUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) ViolationFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- func (s *AccountFreezeService) ViolationUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
- type ActivationLockAccountEmail
- type AuthUser
- type BandwidthLimitConfig
- type BillingFreezeNotificationEmail
- type BillingHistoryCursor
- type BillingHistoryItem
- type BillingHistoryItemType
- type BillingHistoryPage
- type BillingWarningEmail
- type BucketMetadata
- type CaptchaConfig
- type CaptchaHandler
- type CaptchaType
- type ChangeEmailSuccessEmail
- type Config
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CreateSsoUser
- type CreateUser
- type DB
- type DBTx
- type DefaultVersioning
- type DeleteAccountResponse
- type DeleteProjectInfo
- type EdgeURLOverrides
- type EmailAddressVerificationEmail
- type EmissionImpactResponse
- type ExistingUserProjectInvitationEmail
- type ForgotPasswordEmail
- type FreezeEventsByEventAndUserStatusCursor
- type FreezeEventsCursor
- type FreezeEventsPage
- type InvoiceTokenPaymentObserver
- type Limit
- type LimitKind
- type LimitRequestInfo
- type LockAccountActivityType
- type LoginLockAccountEmail
- type MultiCaptchaConfig
- type NewUserProjectInvitationEmail
- type NoticeDismissal
- type ObjectLockAndVersioningConfig
- type OrderDirection
- type PasswordChangedEmail
- type PaymentInfo
- type Payments
- func (payment Payments) AccountBalance(ctx context.Context) (balance payments.Balance, err error)
- func (payment Payments) AddCardByPaymentMethodID(ctx context.Context, pmID string) (card payments.CreditCard, err error)
- func (payment Payments) AddCreditCard(ctx context.Context, creditCardToken string) (card payments.CreditCard, err error)
- func (payment Payments) AddInvoiceReference(ctx context.Context, reference string) (_ *payments.BillingInformation, err error)
- func (payment Payments) AddTaxID(ctx context.Context, taxID payments.TaxID) (_ *payments.BillingInformation, err error)
- func (payment Payments) ApplyCoupon(ctx context.Context, couponID string) (coupon *payments.Coupon, err error)
- func (payment Payments) ApplyCouponCode(ctx context.Context, couponCode string) (coupon *payments.Coupon, err error)
- func (payment Payments) ApplyCredit(ctx context.Context, amount int64, desc string) (err error)
- func (payment Payments) ApplyFreeTierCoupon(ctx context.Context) (coupon *payments.Coupon, err error)
- func (payment Payments) AttemptPayOverdueInvoices(ctx context.Context) (err error)
- func (payment Payments) BillingHistory(ctx context.Context) (billingHistory []*BillingHistoryItem, err error)
- func (payment Payments) BlockExplorerURL(tx string, source string) string
- func (payment Payments) ChangeEmail(ctx context.Context, userID uuid.UUID, email string) (err error)
- func (payment Payments) ClaimWallet(ctx context.Context) (_ WalletInfo, err error)
- func (payment Payments) GetBillingInformation(ctx context.Context) (information *payments.BillingInformation, err error)
- func (payment Payments) GetCoupon(ctx context.Context) (coupon *payments.Coupon, err error)
- func (payment Payments) GetProjectUsagePriceModel(partner string) (_ *payments.ProjectUsagePriceModel)
- func (payment Payments) GetWallet(ctx context.Context) (_ WalletInfo, err error)
- func (payment Payments) InvoiceHistory(ctx context.Context, cursor payments.InvoiceCursor) (history *BillingHistoryPage, err error)
- func (payment Payments) ListCreditCards(ctx context.Context) (_ []payments.CreditCard, err error)
- func (payment Payments) MakeCreditCardDefault(ctx context.Context, cardID string) (err error)
- func (payment Payments) ProjectsCharges(ctx context.Context, since, before time.Time) (_ payments.ProjectChargesResponse, err error)
- func (payment Payments) Purchase(ctx context.Context, price int64, desc string, paymentMethodID string) (err error)
- func (payment Payments) RemoveCreditCard(ctx context.Context, cardID string) (err error)
- func (payment Payments) RemoveTaxID(ctx context.Context, id string) (_ *payments.BillingInformation, err error)
- func (payment Payments) SaveBillingAddress(ctx context.Context, address payments.BillingAddress) (_ *payments.BillingInformation, err error)
- func (payment Payments) SetupAccount(ctx context.Context) (_ payments.CouponType, err error)
- func (payment Payments) TestSwapDepositWallets(dw payments.DepositWallets)
- func (payment Payments) UpdatePackage(ctx context.Context, packagePlan string, purchaseTime time.Time) (err error)
- func (payment Payments) WalletPayments(ctx context.Context) (_ WalletPayments, err error)
- func (payment Payments) WalletPaymentsWithConfirmations(ctx context.Context) (paymentsWithConfirmations []payments.WalletPaymentWithConfirmations, err error)
- type Placement
- type PlacementEdgeURLOverrides
- type PlacementsConfig
- type Project
- type ProjectConfig
- type ProjectInfo
- type ProjectInfoPage
- type ProjectInvitation
- type ProjectInvitationOption
- type ProjectInvitationResponse
- type ProjectInvitations
- type ProjectLimitConfig
- type ProjectLimits
- type ProjectMember
- type ProjectMemberOrder
- type ProjectMemberRole
- type ProjectMembers
- type ProjectMembersCursor
- type ProjectMembersPage
- type ProjectStatus
- type ProjectUsageLimits
- type Projects
- type ProjectsCursor
- type ProjectsPage
- type RESTKeys
- type RegistrationSecret
- type RegistrationToken
- type RegistrationTokens
- type ResetPasswordSecret
- type ResetPasswordToken
- type ResetPasswordTokens
- type ResponseUser
- type SegmentLimitConfig
- type Service
- func (s *Service) ActivateAccount(ctx context.Context, activationToken string) (user *User, err error)
- func (s *Service) AddProjectMembers(ctx context.Context, projectID uuid.UUID, emails []string) (users []*User, err error)
- func (s *Service) ChangeEmail(ctx context.Context, step AccountActionStep, data string) (err error)
- func (s *Service) ChangePassword(ctx context.Context, pass, newPass string, sessionID *uuid.UUID) (err error)
- func (s *Service) CreateAPIKey(ctx context.Context, projectID uuid.UUID, name string, ...) (_ *APIKeyInfo, _ *macaroon.APIKey, err error)
- func (s *Service) CreateInviteToken(ctx context.Context, publicProjectID uuid.UUID, email string, ...) (_ string, err error)
- func (s *Service) CreateProject(ctx context.Context, projectInfo UpsertProjectInfo) (p *Project, err error)
- func (s *Service) CreateRESTKey(ctx context.Context, expiration time.Duration) (apiKey string, expiresAt time.Time, err error)
- func (s *Service) CreateRegToken(ctx context.Context, projLimit int) (_ *RegistrationToken, err error)
- func (s *Service) CreateSsoUser(ctx context.Context, user CreateSsoUser) (u *User, err error)
- func (s *Service) CreateUser(ctx context.Context, user CreateUser, tokenSecret RegistrationSecret) (u *User, err error)
- func (s *Service) DeleteAPIKeyByNameAndProjectID(ctx context.Context, name string, projectID uuid.UUID) (err error)
- func (s *Service) DeleteAPIKeys(ctx context.Context, ids []uuid.UUID) (err error)
- func (s *Service) DeleteAccount(ctx context.Context, step AccountActionStep, data string) (resp *DeleteAccountResponse, err error)
- func (s *Service) DeleteAllSessionsByUserIDExcept(ctx context.Context, userID uuid.UUID, sessionID uuid.UUID) (err error)
- func (s *Service) DeleteProject(ctx context.Context, projectID uuid.UUID, step AccountActionStep, data string) (info *DeleteProjectInfo, err error)
- func (s *Service) DeleteProjectMembersAndInvitations(ctx context.Context, projectID uuid.UUID, emails []string) (err error)
- func (s *Service) DeleteSession(ctx context.Context, sessionID uuid.UUID) (err error)
- func (s *Service) DisableUserMFA(ctx context.Context, passcode string, t time.Time, recoveryCode string) (err error)
- func (s *Service) EnableUserMFA(ctx context.Context, passcode string, t time.Time) (err error)
- func (s *Service) GenCreateAPIKey(ctx context.Context, requestInfo CreateAPIKeyRequest) (*CreateAPIKeyResponse, api.HTTPError)
- func (s *Service) GenCreateProject(ctx context.Context, projectInfo UpsertProjectInfo) (p *Project, httpError api.HTTPError)
- func (s *Service) GenDeleteAPIKey(ctx context.Context, keyID uuid.UUID) (httpError api.HTTPError)
- func (s *Service) GenDeleteProject(ctx context.Context, projectID uuid.UUID) (httpError api.HTTPError)
- func (s *Service) GenGetAPIKeys(ctx context.Context, projectID uuid.UUID, search string, limit, page uint, ...) (*APIKeyPage, api.HTTPError)
- func (s *Service) GenGetBucketUsageRollups(ctx context.Context, reqProjectID uuid.UUID, since, before time.Time) (rollups []accounting.BucketUsageRollup, httpError api.HTTPError)
- func (s *Service) GenGetSingleBucketUsageRollup(ctx context.Context, reqProjectID uuid.UUID, bucket string, ...) (rollup *accounting.BucketUsageRollup, httpError api.HTTPError)
- func (s *Service) GenGetUser(ctx context.Context) (*ResponseUser, api.HTTPError)
- func (s *Service) GenGetUsersProjects(ctx context.Context) (ps []Project, httpErr api.HTTPError)
- func (s *Service) GenUpdateProject(ctx context.Context, projectID uuid.UUID, projectInfo UpsertProjectInfo) (p *Project, httpError api.HTTPError)
- func (s *Service) GenerateActivationToken(ctx context.Context, id uuid.UUID, email string) (token string, err error)
- func (s *Service) GeneratePasswordRecoveryToken(ctx context.Context, user *User) (token string, err error)
- func (s *Service) GenerateSessionToken(ctx context.Context, userID uuid.UUID, email, ip, userAgent string, ...) (_ *TokenInfo, err error)
- func (s *Service) GetAPIKeyInfo(ctx context.Context, id uuid.UUID) (_ *APIKeyInfo, err error)
- func (s *Service) GetAPIKeyInfoByName(ctx context.Context, projectID uuid.UUID, name string) (_ *APIKeyInfo, err error)
- func (s *Service) GetAPIKeys(ctx context.Context, reqProjectID uuid.UUID, cursor APIKeyCursor) (page *APIKeyPage, err error)
- func (s *Service) GetAllAPIKeyNamesByProjectID(ctx context.Context, projectID uuid.UUID) (names []string, err error)
- func (s *Service) GetAllBucketNames(ctx context.Context, projectID uuid.UUID) (_ []string, err error)
- func (s *Service) GetBucketMetadata(ctx context.Context, projectID uuid.UUID) (list []BucketMetadata, err error)
- func (s *Service) GetBucketTotals(ctx context.Context, projectID uuid.UUID, cursor accounting.BucketUsageCursor, ...) (_ *accounting.BucketUsagePage, err error)
- func (s *Service) GetDailyProjectUsage(ctx context.Context, projectID uuid.UUID, from, to time.Time) (_ *accounting.ProjectDailyUsage, err error)
- func (s *Service) GetEmissionImpact(ctx context.Context, projectID uuid.UUID) (*EmissionImpactResponse, error)
- func (s *Service) GetInviteByToken(ctx context.Context, token string) (invite *ProjectInvitation, err error)
- func (s *Service) GetInviteLink(ctx context.Context, publicProjectID uuid.UUID, email string) (_ string, err error)
- func (s *Service) GetInvitesByEmail(ctx context.Context, email string) (invites []ProjectInvitation, err error)
- func (s *Service) GetLoginAttemptsWithoutPenalty() int
- func (s *Service) GetMinimalProject(project *Project) ProjectInfo
- func (s *Service) GetObjectLockUIEnabledByProject(project *Project) bool
- func (s *Service) GetObjectVersioningUIEnabledByProject(project *Project) (versioningUIEnabled bool, promptForVersioningBeta bool)
- func (s *Service) GetPagedActiveSessions(ctx context.Context, cursor consoleauth.WebappSessionsCursor) (page *consoleauth.WebappSessionsPage, err error)
- func (s *Service) GetProject(ctx context.Context, projectID uuid.UUID) (p *Project, err error)
- func (s *Service) GetProjectConfig(ctx context.Context, projectID uuid.UUID) (*ProjectConfig, error)
- func (s *Service) GetProjectMember(ctx context.Context, memberID, projectID uuid.UUID) (pm *ProjectMember, err error)
- func (s *Service) GetProjectMembersAndInvitations(ctx context.Context, projectID uuid.UUID, cursor ProjectMembersCursor) (pmp *ProjectMembersPage, err error)
- func (s *Service) GetProjectNoAuth(ctx context.Context, projectID uuid.UUID) (p *Project, err error)
- func (s *Service) GetProjectUsage(ctx context.Context, projectID uuid.UUID, since, before time.Time) (_ *accounting.ProjectUsage, err error)
- func (s *Service) GetProjectUsageLimits(ctx context.Context, projectID uuid.UUID) (_ *ProjectUsageLimits, err error)
- func (s *Service) GetSalt(ctx context.Context, projectID uuid.UUID) (salt []byte, err error)
- func (s *Service) GetSingleBucketTotals(ctx context.Context, projectID uuid.UUID, bucketName string, before time.Time) (_ *accounting.BucketUsage, err error)
- func (s *Service) GetTotalUsageLimits(ctx context.Context) (_ *ProjectUsageLimits, err error)
- func (s *Service) GetUsageReport(ctx context.Context, since, before time.Time, projectID uuid.UUID) ([]accounting.ProjectReportItem, error)
- func (s *Service) GetUser(ctx context.Context, id uuid.UUID) (u *User, err error)
- func (s *Service) GetUserByEmailWithUnverified(ctx context.Context, email string) (verified *User, unverified []User, err error)
- func (s *Service) GetUserByExternalID(ctx context.Context, externalID string) (user *User, err error)
- func (s *Service) GetUserForSsoAuth(ctx context.Context, claims sso.OidcSsoClaims, provider, ip, userAgent string) (user *User, err error)
- func (s *Service) GetUserHasVarPartner(ctx context.Context) (has bool, err error)
- func (s *Service) GetUserID(ctx context.Context) (id uuid.UUID, err error)
- func (s *Service) GetUserProjectInvitations(ctx context.Context) (_ []ProjectInvitation, err error)
- func (s *Service) GetUserSettings(ctx context.Context) (settings *UserSettings, err error)
- func (s *Service) GetUsersOwnedProjectsPage(ctx context.Context, cursor ProjectsCursor) (_ ProjectsPage, err error)
- func (s *Service) GetUsersProjects(ctx context.Context) (ps []Project, err error)
- func (s *Service) InvalidateSession(ctx context.Context, sessionID uuid.UUID) (err error)
- func (s *Service) InviteNewProjectMember(ctx context.Context, projectID uuid.UUID, email string) (invite *ProjectInvitation, err error)
- func (s *Service) IsProjectInvitationExpired(invite *ProjectInvitation) bool
- func (s *Service) KeyAuth(ctx context.Context, apikey string, authTime time.Time) (_ context.Context, err error)
- func (s *Service) ParseInviteToken(ctx context.Context, token string) (publicID uuid.UUID, email string, err error)
- func (s *Service) Payments() Payments
- func (s *Service) RefreshSession(ctx context.Context, sessionID uuid.UUID) (expiresAt time.Time, err error)
- func (s *Service) ReinviteProjectMembers(ctx context.Context, projectID uuid.UUID, emails []string) (invites []ProjectInvitation, err error)
- func (s *Service) RequestLimitIncrease(ctx context.Context, projectID uuid.UUID, info LimitRequestInfo) (err error)
- func (s *Service) RequestProjectLimitIncrease(ctx context.Context, limit string) (err error)
- func (s *Service) ResetAccountLock(ctx context.Context, user *User) (err error)
- func (s *Service) ResetMFARecoveryCodes(ctx context.Context, requireCode bool, passcode string, recoveryCode string) (codes []string, err error)
- func (s *Service) ResetMFASecretKey(ctx context.Context) (key string, err error)
- func (s *Service) ResetPassword(ctx context.Context, resetPasswordToken, password string, passcode string, ...) (err error)
- func (s *Service) RespondToProjectInvitation(ctx context.Context, projectID uuid.UUID, response ProjectInvitationResponse) (err error)
- func (s *Service) RevokeRESTKey(ctx context.Context, apiKey string) (err error)
- func (s *Service) RevokeResetPasswordToken(ctx context.Context, resetPasswordToken string) (err error)
- func (s *Service) SetAccountActive(ctx context.Context, user *User) (err error)
- func (s *Service) SetActivationCodeAndSignupID(ctx context.Context, user User) (_ User, err error)
- func (s *Service) SetUserSettings(ctx context.Context, request UpsertUserSettingsRequest) (settings *UserSettings, err error)
- func (s *Service) SetupAccount(ctx context.Context, requestData SetUpAccountRequest) (err error)
- func (s *Service) ShouldRequireSsoByUser(user *User) bool
- func (s *Service) TestSetNow(now func() time.Time)
- func (s *Service) TestSetObjectLockAndVersioningConfig(config ObjectLockAndVersioningConfig) error
- func (s *Service) TestSwapCaptchaHandler(h CaptchaHandler)
- func (s *Service) TestToggleSatelliteManagedEncryption(b bool)
- func (s *Service) TestToggleSsoEnabled(enabled bool, ssoService *sso.Service)
- func (s *Service) Token(ctx context.Context, request AuthUser) (response *TokenInfo, err error)
- func (s *Service) TokenAuth(ctx context.Context, token consoleauth.Token, authTime time.Time) (_ context.Context, err error)
- func (s *Service) TokenByAPIKey(ctx context.Context, userAgent string, ip string, apiKey string) (response *TokenInfo, err error)
- func (s *Service) UpdateAccount(ctx context.Context, fullName string, shortName string) (err error)
- func (s *Service) UpdateExternalID(ctx context.Context, user *User, externalID string) (err error)
- func (s *Service) UpdateProject(ctx context.Context, projectID uuid.UUID, updatedProject UpsertProjectInfo) (p *Project, err error)
- func (s *Service) UpdateProjectMemberRole(ctx context.Context, memberID, projectID uuid.UUID, newRole ProjectMemberRole) (pm *ProjectMember, err error)
- func (s *Service) UpdateUserOnSignup(ctx context.Context, inactiveUser *User, requestData CreateUser) (err error)
- func (s *Service) UpdateUserSpecifiedLimits(ctx context.Context, projectID uuid.UUID, updatedLimits UpdateLimitsInfo) (err error)
- func (s *Service) UpdateUsersFailedLoginState(ctx context.Context, user *User) (lockoutDuration time.Duration, err error)
- func (s *Service) UpdateVersioningOptInStatus(ctx context.Context, projectID uuid.UUID, optInStatus VersioningOptInStatus) error
- func (s *Service) VerifyForgotPasswordCaptcha(ctx context.Context, responseToken, userIP string) (valid bool, err error)
- func (s *Service) VerifyRegistrationCaptcha(ctx context.Context, captchaResp, userIP string) (valid bool, score *float64, err error)
- type SessionConfig
- type SetUpAccountRequest
- type SingleCaptchaConfig
- type StorageLimitConfig
- type TokenInfo
- type TrialExpirationEscalationReminderEmail
- type TrialExpirationReminderEmail
- type TrialExpiredEmail
- type TrialNotificationStatus
- type UnknownResetPasswordEmail
- type UnverifiedUserProjectInvitationEmail
- type UpdateLimitsInfo
- type UpdateUserRequest
- type UpgradeUserObserver
- type UpsertProjectInfo
- type UpsertUserSettingsRequest
- type UsageLimits
- type UsageLimitsConfig
- type User
- type UserCursor
- type UserFreezeEvents
- type UserInfo
- type UserSettings
- type UserStatus
- type Users
- type UsersPage
- type VersioningOptInStatus
- type WalletInfo
- type WalletPayments
Constants ¶
const ( // PasswordMinimumLength is the minimum allowed length for user account passwords, based on NIST guidelines for user-generated passwords. PasswordMinimumLength = 8 // PasswordMaximumLength is the maximum allowed length for user account passwords, based on NIST guidelines for user-generated passwords. PasswordMaximumLength = 64 )
const (
// MFARecoveryCodeCount specifies how many MFA recovery codes to generate.
MFARecoveryCodeCount = 10
)
const ( // TestPasswordCost is the hashing complexity to use for testing. TestPasswordCost = bcrypt.MinCost )
Variables ¶
var ( // ErrMFAMissing is error type that occurs when a request is incomplete // due to missing MFA passcode or recovery code. ErrMFAMissing = errs.Class("MFA credentials missing") // ErrMFAConflict is error type that occurs when both a passcode and recovery code are given. ErrMFAConflict = errs.Class("MFA conflict") // ErrMFAEnabled is error type that occurs when user tries to enable MFA when it's already enabled. ErrMFAEnabled = errs.Class("MFA already enabled") // ErrMFARecoveryCode is error type that represents usage of invalid MFA recovery code. ErrMFARecoveryCode = errs.Class("MFA recovery code") // ErrMFAPasscode is error type that represents usage of invalid MFA passcode. ErrMFAPasscode = errs.Class("MFA passcode") )
var ( // Error describes internal console error. Error = errs.Class("console service") ErrUnauthorized = errs.Class("unauthorized") // ErrNoMembership is error type of not belonging to a specific project. ErrNoMembership = errs.Class("no membership") // ErrTokenExpiration is error type of token reached expiration time. ErrTokenExpiration = errs.Class("token expiration") // ErrTokenInvalid is error type of tokens which are invalid. ErrTokenInvalid = errs.Class("invalid token") // ErrProjLimit is error type of project limit. ErrProjLimit = errs.Class("project limit") // ErrUsage is error type of project usage. ErrUsage = errs.Class("project usage") // ErrLoginCredentials occurs when provided invalid login credentials. ErrLoginCredentials = errs.Class("login credentials") // ErrSsoUserRestricted occurs when an SSO user attempts an action they are restricted from. ErrSsoUserRestricted = errs.Class("SSO user restricted") // ErrTooManyAttempts occurs when user tries to produce auth-related action too many times. ErrTooManyAttempts = errs.Class("too many attempts") // ErrActivationCode is error class for failed signup code activation. ErrActivationCode = errs.Class("activation code") // ErrChangePassword occurs when provided old password is incorrect. ErrChangePassword = errs.Class("change password") // ErrEmailUsed is error type that occurs on repeating auth attempts with email. ErrEmailUsed = errs.Class("email used") // ErrEmailNotFound occurs when no users have the specified email. ErrEmailNotFound = errs.Class("email not found") // ErrExternalIdNotFound occurs when no users have the specified external ID. ErrExternalIdNotFound = errs.Class("external ID not found") // ErrNoAPIKey is error type that occurs when there is no api key found. ErrNoAPIKey = errs.Class("no api key found") // ErrAPIKeyRequest is returned when there is an error parsing a request for api keys. ErrAPIKeyRequest = errs.Class("api key request") // ErrRegToken describes registration token errors. ErrRegToken = errs.Class("registration token") // ErrCaptcha describes captcha validation errors. ErrCaptcha = errs.Class("captcha validation") // ErrRecoveryToken describes account recovery token errors. ErrRecoveryToken = errs.Class("recovery token") // ErrProjName is error that occurs with reused project names. ErrProjName = errs.Class("project name") // ErrPurchaseDesc is error that occurs when something is wrong with Purchase description. ErrPurchaseDesc = errs.Class("purchase description") // ErrAlreadyHasPackage is error that occurs when a user tries to update package, but already has one. ErrAlreadyHasPackage = errs.Class("user already has package") // ErrAlreadyMember occurs when a user tries to reject an invitation to a project they're already a member of. ErrAlreadyMember = errs.Class("already a member") // ErrProjectInviteInvalid occurs when a user tries to act upon an invitation that doesn't exist // or has expired. ErrProjectInviteInvalid = errs.Class("invalid project invitation") // ErrConflict occurs when a user attempts an operation that conflicts with the current state. ErrConflict = errs.Class("conflict detected") // ErrSatelliteManagedEncryption occurs when a user attempts to create a satellite managed // encryption project when it is disabled. ErrSatelliteManagedEncryption = ErrConflict.New("satellite managed encryption is not enabled") // ErrForbidden occurs when a user attempts an operation without sufficient access rights. ErrForbidden = errs.Class("insufficient access rights") // ErrAlreadyInvited occurs when trying to invite a user who has already been invited. ErrAlreadyInvited = errs.Class("user is already invited") // ErrInvalidProjectLimit occurs when the requested project limit is not a non-negative integer and/or greater than the current project limit. ErrInvalidProjectLimit = errs.Class("requested project limit is invalid") // ErrNotPaidTier occurs when a user must be paid tier in order to complete an operation. ErrNotPaidTier = errs.Class("user is not paid tier") // ErrBotUser occurs when a user must be verified by admin first in order to complete operation. ErrBotUser = errs.Class("user has to be verified by admin first") // ErrLoginRestricted occurs when a user with PendingBotVerification or LegalHold status tries to log in. ErrLoginRestricted = errs.Class("user can't be authenticated") // ErrFailedToUpgrade occurs when a user can't be upgraded to paid tier. ErrFailedToUpgrade = errs.Class("failed to upgrade user to paid tier") )
var ErrAccountFreeze = errs.Class("account freeze service")
ErrAccountFreeze is the class for errors that occur during operation of the account freeze service.
var ErrNoFreezeStatus = errs.New("this freeze event does not exist for this user")
ErrNoFreezeStatus is the error for when a user doesn't have a particular freeze status.
var ErrValidation = errs.Class("validation")
ErrValidation validation related error class.
var ErrWalletNotClaimed = errs.Class("wallet is not claimed")
ErrWalletNotClaimed shows that no address is claimed by the user.
Functions ¶
func GetRequest ¶ added in v1.12.3
GetRequest gets *http.Request from context.
func NewMFAPasscode ¶ added in v1.36.1
NewMFAPasscode derives a TOTP passcode from a secret key using a timestamp.
func NewMFARecoveryCode ¶ added in v1.36.1
NewMFARecoveryCode returns a randomly generated MFA recovery code. Recovery codes are uppercase and alphanumeric. They are of the form XXXX-XXXX-XXXX.
func NewMFASecretKey ¶ added in v1.36.1
NewMFASecretKey generates a new TOTP secret key.
func NewMFAValidationOpts ¶ added in v1.36.1
func NewMFAValidationOpts() totp.ValidateOpts
NewMFAValidationOpts returns the options used to validate TOTP passcodes. These settings are also used to generate MFA secret keys for use in testing.
func ValidateFullName ¶ added in v0.27.0
ValidateFullName validates full name. It returns an plain error (not wrapped in a errs.Class) if name is invalid.
func ValidateMFAPasscode ¶ added in v1.36.1
ValidateMFAPasscode returns whether the TOTP passcode is valid for the secret key at the given time.
func ValidateNameAndDescription ¶ added in v1.13.1
ValidateNameAndDescription validates project name and description strings. Project name must have more than 0 and less than 21 symbols. Project description can't have more than hundred symbols.
func ValidateNewPassword ¶ added in v1.73.4
ValidateNewPassword validates password for creation. It returns an plain error (not wrapped in a errs.Class) if pass is invalid.
Password minimum length has previously been as short as 6, and maximum as long as 128. Therefore, this validation should only be applied to new passwords - old passwords may have previously been created outside of the 8-64 length range.
func WithRequest ¶ added in v1.12.3
WithRequest creates new context with *http.Request.
Types ¶
type APIKeyCursor ¶ added in v0.21.0
type APIKeyCursor struct { Search string `json:"search"` Limit uint `json:"limit"` Page uint `json:"page"` Order APIKeyOrder `json:"order"` OrderDirection OrderDirection `json:"orderDirection"` }
APIKeyCursor holds info for api keys cursor pagination.
type APIKeyInfo ¶
type APIKeyInfo struct { ID uuid.UUID `json:"id"` ProjectID uuid.UUID `json:"projectId"` ProjectPublicID uuid.UUID `json:"projectPublicId"` CreatedBy uuid.UUID `json:"createdBy"` UserAgent []byte `json:"userAgent"` Name string `json:"name"` Head []byte `json:"-"` Secret []byte `json:"-"` CreatedAt time.Time `json:"createdAt"` Version macaroon.APIKeyVersion `json:"version"` // TODO move this closer to metainfo ProjectRateLimit *int `json:"-"` ProjectBurstLimit *int `json:"-"` ProjectRateLimitHead *int `json:"-"` ProjectBurstLimitHead *int `json:"-"` ProjectRateLimitGet *int `json:"-"` ProjectBurstLimitGet *int `json:"-"` ProjectRateLimitPut *int `json:"-"` ProjectBurstLimitPut *int `json:"-"` ProjectRateLimitList *int `json:"-"` ProjectBurstLimitList *int `json:"-"` ProjectRateLimitDelete *int `json:"-"` ProjectBurstLimitDelete *int `json:"-"` ProjectStorageLimit *int64 `json:"-"` ProjectSegmentsLimit *int64 `json:"-"` ProjectBandwidthLimit *int64 `json:"-"` }
APIKeyInfo describing api key model in the database.
type APIKeyOrder ¶ added in v0.21.0
type APIKeyOrder uint8
APIKeyOrder is used for querying api keys in specified order.
const ( // KeyName indicates that we should order by key name. KeyName APIKeyOrder = 1 // CreationDate indicates that we should order by creation date. CreationDate APIKeyOrder = 2 )
type APIKeyPage ¶ added in v0.21.0
type APIKeyPage struct { APIKeys []APIKeyInfo `json:"apiKeys"` Search string `json:"search"` Limit uint `json:"limit"` Order APIKeyOrder `json:"order"` OrderDirection OrderDirection `json:"orderDirection"` Offset uint64 `json:"offset"` PageCount uint `json:"pageCount"` CurrentPage uint `json:"currentPage"` TotalCount uint64 `json:"totalCount"` }
APIKeyPage represent api key page result.
type APIKeys ¶
type APIKeys interface { // GetPagedByProjectID is a method for querying API keys from the database by projectID and cursor. GetPagedByProjectID(ctx context.Context, projectID uuid.UUID, cursor APIKeyCursor, ignoredNamePrefix string) (akp *APIKeyPage, err error) // Get retrieves APIKeyInfo with given ID. Get(ctx context.Context, id uuid.UUID) (*APIKeyInfo, error) // GetByHead retrieves APIKeyInfo for given key head. GetByHead(ctx context.Context, head []byte) (*APIKeyInfo, error) // GetByNameAndProjectID retrieves APIKeyInfo for given key name and projectID. GetByNameAndProjectID(ctx context.Context, name string, projectID uuid.UUID) (*APIKeyInfo, error) // GetAllNamesByProjectID retrieves all API key names for given projectID. GetAllNamesByProjectID(ctx context.Context, projectID uuid.UUID) ([]string, error) // Create creates and stores new APIKeyInfo. Create(ctx context.Context, head []byte, info APIKeyInfo) (*APIKeyInfo, error) // Update updates APIKeyInfo in store. Update(ctx context.Context, key APIKeyInfo) error // Delete deletes APIKeyInfo from store. Delete(ctx context.Context, id uuid.UUID) error // DeleteMultiple deletes multiple APIKeyInfo from store. DeleteMultiple(ctx context.Context, ids []uuid.UUID) error // DeleteAllByProjectID deletes all APIKeyInfos from store by given projectID. DeleteAllByProjectID(ctx context.Context, id uuid.UUID) error // DeleteExpiredByNamePrefix deletes expired APIKeyInfo from store by key name prefix. DeleteExpiredByNamePrefix(ctx context.Context, lifetime time.Duration, prefix string, asOfSystemTimeInterval time.Duration, pageSize int) error }
APIKeys is interface for working with api keys store.
architecture: Database
type AccountActionStep ¶ added in v1.107.1
type AccountActionStep = int
AccountActionStep stands for each explicit change email flow step.
const ( // DeleteAccountInit is the initial step of account deletion where we check the user // has met all account deletion requirements before then verifying password etc. DeleteAccountInit AccountActionStep = 0 // DeleteProjectInit is the initial step of project deletion where we check the user // has met all project deletion requirements before then verifying password etc. DeleteProjectInit AccountActionStep = 0 // VerifyAccountPasswordStep stands for the first step of the change email/account delete flow // where user has to provide an account password. VerifyAccountPasswordStep AccountActionStep = 1 // VerifyAccountMfaStep stands for the second step of the change email/account delete flow // where user has to provide a 2fa passcode. VerifyAccountMfaStep AccountActionStep = 2 // VerifyAccountEmailStep stands for the third step of the change email/account delete flow // where user has to provide an OTP code sent to their current email address. VerifyAccountEmailStep AccountActionStep = 3 // DeleteAccountStep stands for the last step of the delete account flow // where user has to approve the intention to delete account. DeleteAccountStep AccountActionStep = 4 // DeleteProjectStep stands for the last step of the delete project flow // where user has to approve the intention to delete project. DeleteProjectStep AccountActionStep = 4 // ChangeAccountEmailStep stands for the fourth step of the change email flow // where user has to provide a new email address. ChangeAccountEmailStep AccountActionStep = 4 // VerifyNewAccountEmailStep stands for the fifth step of the change email flow // where user has to provide an OTP code sent to their new email address. VerifyNewAccountEmailStep AccountActionStep = 5 )
type AccountActivationCodeEmail ¶ added in v1.94.1
type AccountActivationCodeEmail struct {
ActivationCode string
}
AccountActivationCodeEmail is mailservice template with activation code.
func (*AccountActivationCodeEmail) Subject ¶ added in v1.94.1
func (*AccountActivationCodeEmail) Subject() string
Subject gets email subject.
func (*AccountActivationCodeEmail) Template ¶ added in v1.94.1
func (*AccountActivationCodeEmail) Template() string
Template returns email template name.
type AccountActivationEmail ¶ added in v1.62.1
type AccountActivationEmail struct { Origin string ActivationLink string ContactInfoURL string TermsAndConditionsURL string }
AccountActivationEmail is mailservice template with activation data.
func (*AccountActivationEmail) Subject ¶ added in v1.62.1
func (*AccountActivationEmail) Subject() string
Subject gets email subject.
func (*AccountActivationEmail) Template ¶ added in v1.62.1
func (*AccountActivationEmail) Template() string
Template returns email template name.
type AccountAlreadyExistsEmail ¶ added in v1.62.1
type AccountAlreadyExistsEmail struct { Origin string SatelliteName string SignInLink string ResetPasswordLink string CreateAccountLink string }
AccountAlreadyExistsEmail is mailservice template for email where user tries to create account, but one already exists.
func (*AccountAlreadyExistsEmail) Subject ¶ added in v1.62.1
func (*AccountAlreadyExistsEmail) Subject() string
Subject gets email subject.
func (*AccountAlreadyExistsEmail) Template ¶ added in v1.62.1
func (*AccountAlreadyExistsEmail) Template() string
Template returns email template name.
type AccountDeletionSuccessEmail ¶ added in v1.116.3
type AccountDeletionSuccessEmail struct{}
AccountDeletionSuccessEmail is mailservice template to notify user about successful account deletion.
func (*AccountDeletionSuccessEmail) Subject ¶ added in v1.116.3
func (*AccountDeletionSuccessEmail) Subject() string
Subject gets email subject.
func (*AccountDeletionSuccessEmail) Template ¶ added in v1.116.3
func (*AccountDeletionSuccessEmail) Template() string
Template returns email template name.
type AccountFreezeConfig ¶ added in v1.91.2
type AccountFreezeConfig struct { BillingWarnGracePeriod time.Duration `help:"How long to wait between a billing warning event and billing freezing an account." default:"360h"` BillingFreezeGracePeriod time.Duration `help:"How long to wait between a billing freeze event and setting pending deletion account status." default:"1440h"` TrialExpirationFreezeGracePeriod time.Duration `` /* 180-byte string literal not displayed */ TrialExpirationRateLimits int64 `` /* 130-byte string literal not displayed */ }
AccountFreezeConfig contains configurable values for account freeze service.
type AccountFreezeEvent ¶ added in v1.70.1
type AccountFreezeEvent struct { UserID uuid.UUID Type AccountFreezeEventType Limits *AccountFreezeEventLimits DaysTillEscalation *int NotificationsCount int CreatedAt time.Time }
AccountFreezeEvent represents an event related to account freezing.
type AccountFreezeEventLimits ¶ added in v1.70.1
type AccountFreezeEventLimits struct { User UsageLimits `json:"user"` Projects map[uuid.UUID]UsageLimits `json:"projects"` }
AccountFreezeEventLimits represents the usage limits for a user's account and projects before they were frozen.
type AccountFreezeEventType ¶ added in v1.70.1
type AccountFreezeEventType int
AccountFreezeEventType is used to indicate the account freeze event's type.
const ( // BillingFreeze signifies that the user has been frozen due to nonpayment of invoices. BillingFreeze AccountFreezeEventType = 0 // BillingWarning signifies that the user has been warned that they may be frozen soon // due to nonpayment of invoices. BillingWarning AccountFreezeEventType = 1 // ViolationFreeze signifies that the user has been frozen due to ToS violation. ViolationFreeze AccountFreezeEventType = 2 // LegalFreeze signifies that the user has been frozen for legal review. LegalFreeze AccountFreezeEventType = 3 // DelayedBotFreeze signifies that the user has to be set to be verified by an admin after some delay. DelayedBotFreeze AccountFreezeEventType = 4 // BotFreeze signifies that the user has been set to be verified by an admin. BotFreeze AccountFreezeEventType = 5 // TrialExpirationFreeze signifies that the user has been frozen because their free trial has expired. TrialExpirationFreeze AccountFreezeEventType = 6 )
func (AccountFreezeEventType) String ¶ added in v1.87.2
func (et AccountFreezeEventType) String() string
String returns a string representation of this event.
type AccountFreezeEvents ¶ added in v1.70.1
type AccountFreezeEvents interface { // Upsert is a method for updating an account freeze event if it exists and inserting it otherwise. Upsert(ctx context.Context, event *AccountFreezeEvent) (*AccountFreezeEvent, error) // Get is a method for querying account freeze event from the database by user ID and event type. Get(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) (*AccountFreezeEvent, error) // GetAllEvents is a method for querying all account freeze events from the database. GetAllEvents(ctx context.Context, cursor FreezeEventsCursor, optionalEventTypes []AccountFreezeEventType) (events *FreezeEventsPage, err error) // GetTrialExpirationFreezesToEscalate is a method that gets free trial expiration freezes that correspond to users // that are not pending deletion (have not been escalated). GetTrialExpirationFreezesToEscalate(ctx context.Context, limit int, cursor *FreezeEventsByEventAndUserStatusCursor) ([]AccountFreezeEvent, *FreezeEventsByEventAndUserStatusCursor, error) // GetAll is a method for querying all account freeze events from the database by user ID. GetAll(ctx context.Context, userID uuid.UUID) (freezes *UserFreezeEvents, err error) // DeleteAllByUserID is a method for deleting all account freeze events from the database by user ID. DeleteAllByUserID(ctx context.Context, userID uuid.UUID) error // DeleteByUserIDAndEvent is a method for deleting all account `eventType` events from the database by user ID. DeleteByUserIDAndEvent(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) error // IncrementNotificationsCount is a method for incrementing the notification count for a user's account freeze event. IncrementNotificationsCount(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) error }
AccountFreezeEvents exposes methods to manage the account freeze events table in database.
architecture: Database
type AccountFreezeService ¶ added in v1.70.1
type AccountFreezeService struct {
// contains filtered or unexported fields
}
AccountFreezeService encapsulates operations concerning account freezes.
func NewAccountFreezeService ¶ added in v1.70.1
func NewAccountFreezeService(db DB, tracker analytics.FreezeTracker, config AccountFreezeConfig) *AccountFreezeService
NewAccountFreezeService creates a new account freeze service.
func (*AccountFreezeService) BillingFreezeUser ¶ added in v1.90.1
BillingFreezeUser freezes the user specified by the given ID due to nonpayment of invoices.
func (*AccountFreezeService) BillingUnWarnUser ¶ added in v1.90.1
BillingUnWarnUser reverses the warning placed on the user specified by the given ID.
func (*AccountFreezeService) BillingUnfreezeUser ¶ added in v1.90.1
func (s *AccountFreezeService) BillingUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
BillingUnfreezeUser reverses the billing freeze placed on the user specified by the given ID.
func (*AccountFreezeService) BillingWarnUser ¶ added in v1.90.1
BillingWarnUser adds a billing warning event to the freeze events table.
func (*AccountFreezeService) BotFreezeUser ¶ added in v1.95.1
BotFreezeUser freezes the user specified by the given ID for bot review.
func (*AccountFreezeService) BotUnfreezeUser ¶ added in v1.95.1
BotUnfreezeUser reverses the bot freeze placed on the user specified by the given ID.
func (*AccountFreezeService) DelayedBotFreezeUser ¶ added in v1.95.1
func (s *AccountFreezeService) DelayedBotFreezeUser(ctx context.Context, userID uuid.UUID, days *int) (err error)
DelayedBotFreezeUser sets the user specified by the given ID for bot review with some delay.
func (*AccountFreezeService) EscalateFreezeEvent ¶ added in v1.113.1
func (s *AccountFreezeService) EscalateFreezeEvent(ctx context.Context, userID uuid.UUID, event AccountFreezeEvent) (err error)
EscalateFreezeEvent deactivates escalation for this freeze event and sets the user status to pending deletion.
func (*AccountFreezeService) Get ¶ added in v1.100.2
func (s *AccountFreezeService) Get(ctx context.Context, userID uuid.UUID, freezeType AccountFreezeEventType) (event *AccountFreezeEvent, err error)
Get returns an event of a specific type for a user.
func (*AccountFreezeService) GetAll ¶ added in v1.74.1
func (s *AccountFreezeService) GetAll(ctx context.Context, userID uuid.UUID) (freezes *UserFreezeEvents, err error)
GetAll returns all events for a user.
func (*AccountFreezeService) GetAllEvents ¶ added in v1.85.1
func (s *AccountFreezeService) GetAllEvents(ctx context.Context, cursor FreezeEventsCursor) (events *FreezeEventsPage, err error)
GetAllEvents returns all events.
func (*AccountFreezeService) GetAllEventsByType ¶ added in v1.95.1
func (s *AccountFreezeService) GetAllEventsByType(ctx context.Context, cursor FreezeEventsCursor, eventTypes []AccountFreezeEventType) (events *FreezeEventsPage, err error)
GetAllEventsByType returns all events by event type.
func (*AccountFreezeService) GetDaysTillEscalation ¶ added in v1.113.1
func (s *AccountFreezeService) GetDaysTillEscalation(event AccountFreezeEvent, now time.Time) *int
GetDaysTillEscalation returns the number of days until escalation for a freeze event.
func (*AccountFreezeService) GetTrialExpirationFreezesToEscalate ¶ added in v1.113.1
func (s *AccountFreezeService) GetTrialExpirationFreezesToEscalate(ctx context.Context, limit int, cursor *FreezeEventsByEventAndUserStatusCursor) (events []AccountFreezeEvent, next *FreezeEventsByEventAndUserStatusCursor, err error)
GetTrialExpirationFreezesToEscalate returns trial expiration freezes that need to be escalated.
func (*AccountFreezeService) IncrementNotificationsCount ¶ added in v1.105.2
func (s *AccountFreezeService) IncrementNotificationsCount(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) error
IncrementNotificationsCount is a method for incrementing the notification count for a user's account freeze event.
func (*AccountFreezeService) IsUserBillingFrozen ¶ added in v1.90.1
func (s *AccountFreezeService) IsUserBillingFrozen(ctx context.Context, userID uuid.UUID) (_ bool, err error)
IsUserBillingFrozen returns whether the user specified by the given ID is frozen due to nonpayment of invoices.
func (*AccountFreezeService) IsUserFrozen ¶ added in v1.70.1
func (s *AccountFreezeService) IsUserFrozen(ctx context.Context, userID uuid.UUID, eventType AccountFreezeEventType) (_ bool, err error)
IsUserFrozen returns whether the user specified by the given ID has an eventType freeze.
func (*AccountFreezeService) IsUserViolationFrozen ¶ added in v1.90.1
func (s *AccountFreezeService) IsUserViolationFrozen(ctx context.Context, userID uuid.UUID) (_ bool, err error)
IsUserViolationFrozen returns whether the user specified by the given ID is frozen.
func (*AccountFreezeService) LegalFreezeUser ¶ added in v1.93.1
LegalFreezeUser freezes the user specified by the given ID for legal review.
func (*AccountFreezeService) LegalUnfreezeUser ¶ added in v1.93.1
LegalUnfreezeUser reverses the legal freeze placed on the user specified by the given ID.
func (*AccountFreezeService) ShouldEscalateFreezeEvent ¶ added in v1.113.1
func (s *AccountFreezeService) ShouldEscalateFreezeEvent(ctx context.Context, event AccountFreezeEvent, now time.Time) (shouldEscalate bool, err error)
ShouldEscalateFreezeEvent checks whether an event's escalation period has elapsed.
func (*AccountFreezeService) TestChangeFreezeTracker ¶ added in v1.78.1
func (s *AccountFreezeService) TestChangeFreezeTracker(t analytics.FreezeTracker)
TestChangeFreezeTracker changes the freeze tracker service for tests.
func (*AccountFreezeService) TestSetTrialExpirationFreezeGracePeriod ¶ added in v1.113.1
func (s *AccountFreezeService) TestSetTrialExpirationFreezeGracePeriod(period time.Duration)
TestSetTrialExpirationFreezeGracePeriod changes the trial expiration freeze grace period for tests.
func (*AccountFreezeService) TrialExpirationFreezeUser ¶ added in v1.100.2
func (s *AccountFreezeService) TrialExpirationFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
TrialExpirationFreezeUser freezes the user specified by the given ID due to expired free trial.
func (*AccountFreezeService) TrialExpirationUnfreezeUser ¶ added in v1.100.2
func (s *AccountFreezeService) TrialExpirationUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
TrialExpirationUnfreezeUser reverses the trial expiration freeze placed on the user specified by the given ID. It potentially upgrades a user, setting new limits.
func (*AccountFreezeService) ViolationFreezeUser ¶ added in v1.90.1
func (s *AccountFreezeService) ViolationFreezeUser(ctx context.Context, userID uuid.UUID) (err error)
ViolationFreezeUser freezes the user specified by the given ID due to ToS violation.
func (*AccountFreezeService) ViolationUnfreezeUser ¶ added in v1.90.1
func (s *AccountFreezeService) ViolationUnfreezeUser(ctx context.Context, userID uuid.UUID) (err error)
ViolationUnfreezeUser reverses the violation freeze placed on the user specified by the given ID.
type ActivationLockAccountEmail ¶ added in v1.101.1
ActivationLockAccountEmail is mailservice template with activation lock account data.
func (*ActivationLockAccountEmail) Subject ¶ added in v1.101.1
func (*ActivationLockAccountEmail) Subject() string
Subject gets email subject.
func (*ActivationLockAccountEmail) Template ¶ added in v1.101.1
func (*ActivationLockAccountEmail) Template() string
Template returns email template name.
type AuthUser ¶ added in v1.36.1
type AuthUser struct { Email string `json:"email"` Password string `json:"password"` MFAPasscode string `json:"mfaPasscode"` MFARecoveryCode string `json:"mfaRecoveryCode"` CaptchaResponse string `json:"captchaResponse"` RememberForOneWeek bool `json:"rememberForOneWeek"` IP string `json:"-"` UserAgent string `json:"-"` }
AuthUser holds info for user authentication token requests.
type BandwidthLimitConfig ¶ added in v1.34.1
type BandwidthLimitConfig struct { Free memory.Size `help:"the default free-tier bandwidth usage limit" default:"25.00GB" testDefault:"25.00 GB"` Paid memory.Size `help:"the default paid-tier bandwidth usage limit" default:"150.00TB" testDefault:"25.00 GB"` }
BandwidthLimitConfig is a configuration struct for default bandwidth per-project usage limits.
type BillingFreezeNotificationEmail ¶ added in v1.105.2
type BillingFreezeNotificationEmail struct { EmailNumber int Days int SignInLink string SupportLink string }
BillingFreezeNotificationEmail is an email sent to notify users of account freeze event.
func (*BillingFreezeNotificationEmail) Subject ¶ added in v1.105.2
func (b *BillingFreezeNotificationEmail) Subject() string
Subject gets email subject.
func (*BillingFreezeNotificationEmail) Template ¶ added in v1.105.2
func (*BillingFreezeNotificationEmail) Template() string
Template returns email template name.
type BillingHistoryCursor ¶ added in v1.87.1
type BillingHistoryCursor struct { Limit int // StartingAfter is the last ID of the previous page. // The next page will start after this ID. StartingAfter string // EndingBefore is the id before which a page should end. EndingBefore string }
BillingHistoryCursor holds info for billing history cursor pagination.
type BillingHistoryItem ¶ added in v0.25.0
type BillingHistoryItem struct { ID string `json:"id"` Description string `json:"description"` Amount int64 `json:"amount"` Remaining int64 `json:"remaining"` Received int64 `json:"received"` Status string `json:"status"` Link string `json:"link"` Start time.Time `json:"start"` End time.Time `json:"end"` Type BillingHistoryItemType `json:"type"` }
BillingHistoryItem holds all public information about billing history line.
type BillingHistoryItemType ¶ added in v0.25.0
type BillingHistoryItemType int
BillingHistoryItemType indicates type of billing history item.
const ( // Invoice is a Stripe invoice billing item. Invoice BillingHistoryItemType = 0 // Transaction is a Coinpayments transaction billing item. Transaction BillingHistoryItemType = 1 // Charge is a credit card charge billing item. Charge BillingHistoryItemType = 2 // Coupon is an entity that adds some funds to Accounts balance for some fixed period. Coupon BillingHistoryItemType = 3 // DepositBonus is an entity that adds some funds to Accounts balance after deposit with storj coins. DepositBonus BillingHistoryItemType = 4 )
type BillingHistoryPage ¶ added in v1.87.1
type BillingHistoryPage struct { Items []BillingHistoryItem `json:"items"` // Next indicates whether there are more events to retrieve. Next bool `json:"next"` // Previous indicates whether there are previous items. Previous bool `json:"previous"` }
BillingHistoryPage returns paginated billing history items.
type BillingWarningEmail ¶ added in v1.105.2
BillingWarningEmail is an email sent to notify users of billing warning event.
func (*BillingWarningEmail) Subject ¶ added in v1.105.2
func (*BillingWarningEmail) Subject() string
Subject gets email subject.
func (*BillingWarningEmail) Template ¶ added in v1.105.2
func (*BillingWarningEmail) Template() string
Template returns email template name.
type BucketMetadata ¶ added in v1.101.1
type BucketMetadata struct { Name string `json:"name"` Versioning buckets.Versioning `json:"versioning"` Placement Placement `json:"placement"` ObjectLockEnabled bool `json:"objectLockEnabled"` }
BucketMetadata contains bucket name, versioning and placement info.
type CaptchaConfig ¶ added in v1.62.1
type CaptchaConfig struct { FlagBotsEnabled bool `help:"indicates if flagging bot accounts is enabled" default:"false" json:"-"` ScoreCutoffThreshold float64 `help:"bad captcha score threshold which is used to prevent bot user activity" default:"0.8" json:"-"` MinFlagBotDelay int `help:"min number of days before flagging a bot account" default:"1" json:"-"` MaxFlagBotDelay int `help:"max number of days before flagging a bot account" default:"7" json:"-"` Login MultiCaptchaConfig `json:"login"` Registration MultiCaptchaConfig `json:"registration"` }
CaptchaConfig contains configurations for login/registration captcha system.
type CaptchaHandler ¶ added in v1.56.1
type CaptchaHandler interface {
Verify(ctx context.Context, responseToken string, userIP string) (bool, *float64, error)
}
CaptchaHandler is responsible for contacting a captcha API and returning whether the user response characterized by the given response token and IP is valid.
func NewDefaultCaptcha ¶ added in v1.56.1
func NewDefaultCaptcha(kind CaptchaType, secretKey string) CaptchaHandler
NewDefaultCaptcha returns a captcha handler that contacts a reCAPTCHA or hCaptcha API.
type CaptchaType ¶ added in v1.56.1
type CaptchaType int
CaptchaType is a type of captcha.
const ( // Recaptcha is the type for reCAPTCHA. Recaptcha CaptchaType = iota // Hcaptcha is the type for hCaptcha. Hcaptcha )
type ChangeEmailSuccessEmail ¶ added in v1.107.1
type ChangeEmailSuccessEmail struct{}
ChangeEmailSuccessEmail is mailservice template to notify user about successful email change.
func (*ChangeEmailSuccessEmail) Subject ¶ added in v1.107.1
func (*ChangeEmailSuccessEmail) Subject() string
Subject gets email subject.
func (*ChangeEmailSuccessEmail) Template ¶ added in v1.107.1
func (*ChangeEmailSuccessEmail) Template() string
Template returns email template name.
type Config ¶ added in v0.34.8
type Config struct { PasswordCost int `help:"password hashing cost (0=automatic)" testDefault:"4" default:"0"` OpenRegistrationEnabled bool `help:"enable open registration" default:"false" testDefault:"true"` DefaultProjectLimit int `help:"default project limits for users" default:"1" testDefault:"5"` AsOfSystemTimeDuration time.Duration `help:"default duration for AS OF SYSTEM TIME" devDefault:"-5m" releaseDefault:"-5m" testDefault:"0"` LoginAttemptsWithoutPenalty int `help:"number of times user can try to login without penalty" default:"3"` FailedLoginPenalty float64 `help:"incremental duration of penalty for failed login attempts in minutes" default:"2.0"` ProjectInvitationExpiration time.Duration `help:"duration that project member invitations are valid for" default:"168h"` UnregisteredInviteEmailsEnabled bool `help:"indicates whether invitation emails can be sent to unregistered email addresses" default:"true"` UserBalanceForUpgrade int64 `help:"amount of base units of US micro dollars needed to upgrade user's tier status" default:"10000000"` PlacementEdgeURLOverrides PlacementEdgeURLOverrides `` /* 201-byte string literal not displayed */ BlockExplorerURL string `help:"url of the transaction block explorer" default:"https://etherscan.io/"` ZkSyncBlockExplorerURL string `help:"url of the zkSync transaction block explorer" default:"https://explorer.zksync.io/"` BillingFeaturesEnabled bool `help:"indicates if billing features should be enabled" default:"true"` StripePaymentElementEnabled bool `help:"indicates whether the stripe payment element should be used to collect card info" default:"true"` SignupActivationCodeEnabled bool `` /* 139-byte string literal not displayed */ FreeTrialDuration time.Duration `help:"duration for which users can access the system free of charge, 0 = unlimited time trial" default:"0"` VarPartners []string `help:"list of partners whose users will not see billing UI." default:""` ObjectBrowserKeyNamePrefix string `help:"prefix for object browser API key names" default:".storj-web-file-browser-api-key-"` ObjectBrowserKeyLifetime time.Duration `help:"duration for which the object browser API key remains valid" default:"72h"` MaxNameCharacters int `help:"defines the maximum number of characters allowed for names, e.g. user first/last names and company names" default:"100"` BillingInformationTabEnabled bool `help:"indicates if billing information tab should be enabled" default:"false"` SatelliteManagedEncryptionEnabled bool `help:"indicates whether satellite managed encryption projects can be created." default:"false"` EmailChangeFlowEnabled bool `help:"whether change user email flow is enabled" default:"false"` DeleteProjectEnabled bool `help:"whether project deletion from satellite UI is enabled" default:"false"` SelfServeAccountDeleteEnabled bool `help:"whether self-serve account delete flow is enabled" default:"false"` Placement PlacementsConfig UsageLimits UsageLimitsConfig Captcha CaptchaConfig Session SessionConfig AccountFreeze AccountFreezeConfig }
Config keeps track of core console service configuration parameters.
type CreateAPIKeyRequest ¶ added in v1.57.1
CreateAPIKeyRequest holds create API key info.
type CreateAPIKeyResponse ¶ added in v1.57.1
type CreateAPIKeyResponse struct { Key string `json:"key"` KeyInfo *APIKeyInfo `json:"keyInfo"` }
CreateAPIKeyResponse holds macaroon.APIKey and APIKeyInfo.
type CreateSsoUser ¶ added in v1.116.3
type CreateSsoUser struct { ExternalId string FullName string Email string UserAgent []byte IP string }
CreateSsoUser struct holds info for SSO User creation.
type CreateUser ¶
type CreateUser struct { ExternalId *string `json:"-"` FullName string `json:"fullName"` ShortName string `json:"shortName"` Email string `json:"email"` UserAgent []byte `json:"userAgent"` Password string `json:"password"` IsProfessional bool `json:"isProfessional"` Position string `json:"position"` CompanyName string `json:"companyName"` WorkingOn string `json:"workingOn"` EmployeeCount string `json:"employeeCount"` HaveSalesContact bool `json:"haveSalesContact"` CaptchaResponse string `json:"captchaResponse"` IP string `json:"ip"` SignupPromoCode string `json:"signupPromoCode"` ActivationCode string `json:"-"` SignupId string `json:"-"` AllowNoName bool `json:"-"` PaidTier bool `json:"-"` }
CreateUser struct holds info for User creation.
func (*CreateUser) IsValid ¶
func (user *CreateUser) IsValid(allowNoName bool) error
IsValid checks CreateUser validity and returns error describing whats wrong. The returned error has the class ErrValiation.
type DB ¶
type DB interface { // Users is a getter for Users repository. Users() Users // Projects is a getter for Projects repository. Projects() Projects // ProjectMembers is a getter for ProjectMembers repository. ProjectMembers() ProjectMembers // ProjectInvitations is a getter for ProjectInvitations repository. ProjectInvitations() ProjectInvitations // APIKeys is a getter for APIKeys repository. APIKeys() APIKeys // RegistrationTokens is a getter for RegistrationTokens repository. RegistrationTokens() RegistrationTokens // ResetPasswordTokens is a getter for ResetPasswordTokens repository. ResetPasswordTokens() ResetPasswordTokens // WebappSessions is a getter for WebappSessions repository. WebappSessions() consoleauth.WebappSessions // AccountFreezeEvents is a getter for AccountFreezeEvents repository. AccountFreezeEvents() AccountFreezeEvents // WithTx is a method for executing transactions with retrying as necessary. WithTx(ctx context.Context, fn func(ctx context.Context, tx DBTx) error) error }
DB contains access to different satellite databases.
architecture: Database
type DBTx ¶
type DBTx interface { DB // Commit is a method for committing and closing transaction. Commit() error // Rollback is a method for rollback and closing transaction. Rollback() error }
DBTx extends Database with transaction scope.
type DefaultVersioning ¶ added in v1.95.1
type DefaultVersioning int
DefaultVersioning represents the default versioning state of a new bucket in the project.
const ( // VersioningUnsupported - versioning for created buckets is not supported. VersioningUnsupported DefaultVersioning = 0 // Unversioned - versioning for created buckets is supported but not enabled. Unversioned DefaultVersioning = 1 // VersioningEnabled - versioning for created buckets is supported and enabled. VersioningEnabled DefaultVersioning = 2 )
type DeleteAccountResponse ¶ added in v1.112.2
type DeleteAccountResponse struct { OwnedProjects int `json:"ownedProjects"` Buckets int `json:"buckets"` ApiKeys int `json:"apiKeys"` UnpaidInvoices int `json:"unpaidInvoices"` AmountOwed int64 `json:"amountOwed"` CurrentUsage bool `json:"currentUsage"` InvoicingIncomplete bool `json:"invoicingIncomplete"` Success bool `json:"success"` }
DeleteAccountResponse holds data for account deletion UI flow.
type DeleteProjectInfo ¶ added in v1.113.1
type DeleteProjectInfo struct { Buckets int `json:"buckets"` APIKeys int `json:"apiKeys"` CurrentUsage bool `json:"currentUsage"` InvoicingIncomplete bool `json:"invoicingIncomplete"` }
DeleteProjectInfo holds data for project deletion UI flow.
type EdgeURLOverrides ¶ added in v1.88.2
type EdgeURLOverrides struct { AuthService string `json:"authService,omitempty"` PublicLinksharing string `json:"publicLinksharing,omitempty"` InternalLinksharing string `json:"internalLinksharing,omitempty"` }
EdgeURLOverrides contains edge service URL overrides.
type EmailAddressVerificationEmail ¶ added in v1.107.1
EmailAddressVerificationEmail is mailservice template with a verification code.
func (*EmailAddressVerificationEmail) Subject ¶ added in v1.107.1
func (*EmailAddressVerificationEmail) Subject() string
Subject gets email subject.
func (*EmailAddressVerificationEmail) Template ¶ added in v1.107.1
func (*EmailAddressVerificationEmail) Template() string
Template returns email template name.
type EmissionImpactResponse ¶ added in v1.99.1
type EmissionImpactResponse struct { StorjImpact float64 `json:"storjImpact"` HyperscalerImpact float64 `json:"hyperscalerImpact"` SavedTrees int64 `json:"savedTrees"` }
EmissionImpactResponse represents emission impact response to be returned to client.
type ExistingUserProjectInvitationEmail ¶ added in v1.81.2
type ExistingUserProjectInvitationEmail struct { InviterEmail string Region string SignInLink string }
ExistingUserProjectInvitationEmail is mailservice template for project invitation email for existing users.
func (*ExistingUserProjectInvitationEmail) Subject ¶ added in v1.81.2
func (email *ExistingUserProjectInvitationEmail) Subject() string
Subject gets email subject.
func (*ExistingUserProjectInvitationEmail) Template ¶ added in v1.81.2
func (*ExistingUserProjectInvitationEmail) Template() string
Template returns email template name.
type ForgotPasswordEmail ¶ added in v1.62.1
type ForgotPasswordEmail struct { Origin string ResetLink string CancelPasswordRecoveryLink string LetUsKnowURL string ContactInfoURL string TermsAndConditionsURL string }
ForgotPasswordEmail is mailservice template with reset password data.
func (*ForgotPasswordEmail) Subject ¶ added in v1.62.1
func (*ForgotPasswordEmail) Subject() string
Subject gets email subject.
func (*ForgotPasswordEmail) Template ¶ added in v1.62.1
func (*ForgotPasswordEmail) Template() string
Template returns email template name.
type FreezeEventsByEventAndUserStatusCursor ¶ added in v1.113.1
type FreezeEventsByEventAndUserStatusCursor = dbx.Paged_AccountFreezeEvent_By_User_Status_Not_And_AccountFreezeEvent_Event_Continuation
FreezeEventsByEventAndUserStatusCursor is a cursor for getting freeze events by event and user status.
type FreezeEventsCursor ¶ added in v1.85.1
type FreezeEventsCursor struct { Limit int // StartingAfter is the last user ID of the previous page. // The next page will start after this user ID. StartingAfter *uuid.UUID }
FreezeEventsCursor holds info for freeze events cursor pagination.
type FreezeEventsPage ¶ added in v1.85.1
type FreezeEventsPage struct { Events []AccountFreezeEvent // Next indicates whether there are more events to retrieve. Next bool }
FreezeEventsPage returns paginated freeze events.
type InvoiceTokenPaymentObserver ¶ added in v1.87.2
type InvoiceTokenPaymentObserver struct {
// contains filtered or unexported fields
}
InvoiceTokenPaymentObserver used to pay pending payments with STORJ tokens.
func NewInvoiceTokenPaymentObserver ¶ added in v1.87.2
func NewInvoiceTokenPaymentObserver(consoleDB DB, invoices payments.Invoices, freezeService *AccountFreezeService) *InvoiceTokenPaymentObserver
NewInvoiceTokenPaymentObserver creates new observer instance.
func (*InvoiceTokenPaymentObserver) Process ¶ added in v1.87.2
func (o *InvoiceTokenPaymentObserver) Process(ctx context.Context, transaction billing.Transaction) (err error)
Process attempts to pay user's pending payments with tokens.
func (*InvoiceTokenPaymentObserver) TestSetNow ¶ added in v1.99.1
func (o *InvoiceTokenPaymentObserver) TestSetNow(nowFn func() time.Time)
TestSetNow allows tests to have the observer act as if the current time is whatever they want.
type LimitKind ¶ added in v1.107.1
type LimitKind int
LimitKind is a generic enum type for kinds of limits.
const ( // StorageLimit is the amount of data that can be stored in a project. StorageLimit LimitKind = 0 // BandwidthLimit is the amount of egress usage allowed for a project. BandwidthLimit LimitKind = 1 // UserSetStorageLimit is an optional custom storage limit that the user can specify. UserSetStorageLimit LimitKind = 2 // UserSetBandwidthLimit is an optional custom egress limit that the user can specify. UserSetBandwidthLimit LimitKind = 3 // SegmentLimit is the number of segments allowed in a project. SegmentLimit LimitKind = 4 // BucketsLimit is the number of buckets allowed in a project. BucketsLimit LimitKind = 5 // RateLimit is the catch-all rate of requests allowed in a project. RateLimit LimitKind = 6 // BurstLimit is the catch-all "rate limit burst" for requests in a project. BurstLimit LimitKind = 7 // RateLimitHead overrides RateLimit for "head" requests. RateLimitHead LimitKind = 8 // BurstLimitHead overrides BurstLimit for "head" requests. BurstLimitHead LimitKind = 9 // RateLimitGet overrides RateLimit for "get" requests. RateLimitGet LimitKind = 10 // BurstLimitGet overrides BurstLimit for "get" requests. BurstLimitGet LimitKind = 11 // RateLimitPut overrides RateLimit for "put" requests. RateLimitPut LimitKind = 12 // BurstLimitPut overrides BurstLimit for "put" requests. BurstLimitPut LimitKind = 13 // RateLimitList overrides RateLimit for "list" requests. RateLimitList LimitKind = 14 // BurstLimitList overrides BurstLimit for "list" requests. BurstLimitList LimitKind = 15 // RateLimitDelete overrides RateLimit for "delete" requests. RateLimitDelete LimitKind = 16 // BurstLimitDelete overrides BurstLimit for "delete" requests. BurstLimitDelete LimitKind = 18 // RateLimitPutNoError overrides RateLimit for "put" requests but no error when limit is reached. RateLimitPutNoError LimitKind = 19 )
type LimitRequestInfo ¶ added in v1.88.2
type LimitRequestInfo struct { LimitType string `json:"limitType"` CurrentLimit memory.Size `json:"currentLimit"` DesiredLimit memory.Size `json:"desiredLimit"` }
LimitRequestInfo holds data needed to request limit increase.
type LockAccountActivityType ¶ added in v1.103.2
type LockAccountActivityType = string
LockAccountActivityType is an auth activity type which led to account lock.
const ( // LoginAccountLock represents an account lock activity type triggered by multiple failed login attempts. LoginAccountLock LockAccountActivityType = "login" // MfaAccountLock stands for "2fa check" and represents an account lock activity type triggered by multiple failed two-factor authentication attempts. MfaAccountLock LockAccountActivityType = "2fa check" // ChangeEmailLock stands for "change email" and represents an account lock activity type triggered by multiple failed change email actions. ChangeEmailLock LockAccountActivityType = "change email" // DeleteProjectLock stands for "delete project" and represents an account lock activity type triggered by multiple failed delete project actions. DeleteProjectLock LockAccountActivityType = "delete project" // DeleteAccountLock stands for "delete project" and represents an account lock activity type triggered by multiple failed delete account actions. DeleteAccountLock LockAccountActivityType = "delete account" )
type LoginLockAccountEmail ¶ added in v1.101.1
type LoginLockAccountEmail struct { LockoutDuration time.Duration ResetPasswordLink string ActivityType LockAccountActivityType }
LoginLockAccountEmail is mailservice template with login lock account data.
func (*LoginLockAccountEmail) Subject ¶ added in v1.101.1
func (*LoginLockAccountEmail) Subject() string
Subject gets email subject.
func (*LoginLockAccountEmail) Template ¶ added in v1.101.1
func (*LoginLockAccountEmail) Template() string
Template returns email template name.
type MultiCaptchaConfig ¶ added in v1.62.1
type MultiCaptchaConfig struct { Recaptcha SingleCaptchaConfig `json:"recaptcha"` Hcaptcha SingleCaptchaConfig `json:"hcaptcha"` }
MultiCaptchaConfig contains configurations for Recaptcha and Hcaptcha systems.
type NewUserProjectInvitationEmail ¶ added in v1.81.2
NewUserProjectInvitationEmail is mailservice template for project invitation email for new users.
func (*NewUserProjectInvitationEmail) Subject ¶ added in v1.81.2
func (email *NewUserProjectInvitationEmail) Subject() string
Subject gets email subject.
func (*NewUserProjectInvitationEmail) Template ¶ added in v1.81.2
func (*NewUserProjectInvitationEmail) Template() string
Template returns email template name.
type NoticeDismissal ¶ added in v1.96.4
type NoticeDismissal struct { FileGuide bool `json:"fileGuide"` ServerSideEncryption bool `json:"serverSideEncryption"` PartnerUpgradeBanner bool `json:"partnerUpgradeBanner"` ProjectMembersPassphrase bool `json:"projectMembersPassphrase"` UploadOverwriteWarning bool `json:"uploadOverwriteWarning"` VersioningBetaBanner bool `json:"versioningBetaBanner"` CunoFSBetaJoined bool `json:"cunoFSBetaJoined"` }
NoticeDismissal contains whether notices should be shown to a user.
type ObjectLockAndVersioningConfig ¶ added in v1.113.1
type ObjectLockAndVersioningConfig struct { ObjectLockEnabled bool UseBucketLevelObjectVersioning bool UseBucketLevelObjectVersioningProjects []string // contains filtered or unexported fields }
ObjectLockAndVersioningConfig contains configurations for object versioning.
type OrderDirection ¶ added in v0.21.0
type OrderDirection uint8
OrderDirection is used for members in specific order direction.
const ( // Ascending indicates that we should order ascending. Ascending OrderDirection = 1 // Descending indicates that we should order descending. Descending OrderDirection = 2 )
type PasswordChangedEmail ¶ added in v1.108.1
type PasswordChangedEmail struct {
ResetPasswordLink string
}
PasswordChangedEmail is mailservice template with password changed data.
func (*PasswordChangedEmail) Subject ¶ added in v1.108.1
func (*PasswordChangedEmail) Subject() string
Subject gets email subject.
func (*PasswordChangedEmail) Template ¶ added in v1.108.1
func (*PasswordChangedEmail) Template() string
Template returns email template name.
type PaymentInfo ¶ added in v1.62.1
type PaymentInfo struct { ID string Type string Wallet string Amount currency.Amount Received currency.Amount Status string Link string Timestamp time.Time }
PaymentInfo includes token payment information required by GUI.
type Payments ¶ added in v1.57.1
type Payments struct {
// contains filtered or unexported fields
}
Payments separates all payment related functionality.
func (Payments) AccountBalance ¶ added in v1.57.1
AccountBalance return account balance.
func (Payments) AddCardByPaymentMethodID ¶ added in v1.92.1
func (payment Payments) AddCardByPaymentMethodID(ctx context.Context, pmID string) (card payments.CreditCard, err error)
AddCardByPaymentMethodID is used to save new credit card and attach it to payment account.
func (Payments) AddCreditCard ¶ added in v1.57.1
func (payment Payments) AddCreditCard(ctx context.Context, creditCardToken string) (card payments.CreditCard, err error)
AddCreditCard is used to save new credit card and attach it to payment account.
func (Payments) AddInvoiceReference ¶ added in v1.115.1
func (payment Payments) AddInvoiceReference(ctx context.Context, reference string) (_ *payments.BillingInformation, err error)
AddInvoiceReference adds a new default invoice reference to be displayed on each invoice and returns the updated billing information.
func (Payments) AddTaxID ¶ added in v1.104.1
func (payment Payments) AddTaxID(ctx context.Context, taxID payments.TaxID) (_ *payments.BillingInformation, err error)
AddTaxID adds a new tax ID for a user and returns the updated billing information.
func (Payments) ApplyCoupon ¶ added in v1.74.1
func (payment Payments) ApplyCoupon(ctx context.Context, couponID string) (coupon *payments.Coupon, err error)
ApplyCoupon applies a coupon to an account based on couponID.
func (Payments) ApplyCouponCode ¶ added in v1.57.1
func (payment Payments) ApplyCouponCode(ctx context.Context, couponCode string) (coupon *payments.Coupon, err error)
ApplyCouponCode applies a coupon code to a Stripe customer and returns the coupon corresponding to the code.
func (Payments) ApplyCredit ¶ added in v1.76.2
ApplyCredit applies a credit of `amount` with description of `desc` to the user's balance. `amount` is in cents USD. If a credit with `desc` already exists, another one will not be created.
func (Payments) ApplyFreeTierCoupon ¶ added in v1.74.1
func (payment Payments) ApplyFreeTierCoupon(ctx context.Context) (coupon *payments.Coupon, err error)
ApplyFreeTierCoupon applies the default free tier coupon to an account.
func (Payments) AttemptPayOverdueInvoices ¶ added in v1.70.1
AttemptPayOverdueInvoices attempts to pay a user's open, overdue invoices.
func (Payments) BillingHistory ¶ added in v1.57.1
func (payment Payments) BillingHistory(ctx context.Context) (billingHistory []*BillingHistoryItem, err error)
BillingHistory returns a list of billing history items for payment account.
func (Payments) BlockExplorerURL ¶ added in v1.101.2
BlockExplorerURL creates zkSync/etherscan transaction URI based on source.
func (Payments) ChangeEmail ¶ added in v1.107.1
func (payment Payments) ChangeEmail(ctx context.Context, userID uuid.UUID, email string) (err error)
ChangeEmail changes payment account's email address.
func (Payments) ClaimWallet ¶ added in v1.57.1
func (payment Payments) ClaimWallet(ctx context.Context) (_ WalletInfo, err error)
ClaimWallet requests a new wallet for the users to be used for payments. If wallet is already claimed, it will return with the info without error.
func (Payments) GetBillingInformation ¶ added in v1.104.1
func (payment Payments) GetBillingInformation(ctx context.Context) (information *payments.BillingInformation, err error)
GetBillingInformation updates a user's billing information.
func (Payments) GetCoupon ¶ added in v1.57.1
GetCoupon returns the coupon applied to the user's account.
func (Payments) GetProjectUsagePriceModel ¶ added in v1.71.1
func (payment Payments) GetProjectUsagePriceModel(partner string) (_ *payments.ProjectUsagePriceModel)
GetProjectUsagePriceModel returns the project usage price model for the partner.
func (Payments) GetWallet ¶ added in v1.57.1
func (payment Payments) GetWallet(ctx context.Context) (_ WalletInfo, err error)
GetWallet returns with the assigned wallet, or with ErrWalletNotClaimed if not yet claimed.
func (Payments) InvoiceHistory ¶ added in v1.87.1
func (payment Payments) InvoiceHistory(ctx context.Context, cursor payments.InvoiceCursor) (history *BillingHistoryPage, err error)
InvoiceHistory returns a paged list of invoices for payment account.
func (Payments) ListCreditCards ¶ added in v1.57.1
ListCreditCards returns a list of credit cards for a given payment account.
func (Payments) MakeCreditCardDefault ¶ added in v1.57.1
MakeCreditCardDefault makes a credit card default payment method.
func (Payments) ProjectsCharges ¶ added in v1.57.1
func (payment Payments) ProjectsCharges(ctx context.Context, since, before time.Time) (_ payments.ProjectChargesResponse, err error)
ProjectsCharges returns how much money current user will be charged for each project which he owns.
func (Payments) Purchase ¶ added in v1.74.1
func (payment Payments) Purchase(ctx context.Context, price int64, desc string, paymentMethodID string) (err error)
Purchase makes a purchase of `price` amount with description of `desc` and payment method with id of `paymentMethodID`. If a paid invoice with the same description exists, then we assume this is a retried request and don't create and pay another invoice.
func (Payments) RemoveCreditCard ¶ added in v1.57.1
RemoveCreditCard is used to detach a credit card from payment account.
func (Payments) RemoveTaxID ¶ added in v1.104.1
func (payment Payments) RemoveTaxID(ctx context.Context, id string) (_ *payments.BillingInformation, err error)
RemoveTaxID removes a tax ID from a user and returns the updated billing information.
func (Payments) SaveBillingAddress ¶ added in v1.104.1
func (payment Payments) SaveBillingAddress(ctx context.Context, address payments.BillingAddress) (_ *payments.BillingInformation, err error)
SaveBillingAddress saves billing address for a user and returns the updated billing information.
func (Payments) SetupAccount ¶ added in v1.57.1
SetupAccount creates payment account for authorized user.
func (Payments) TestSwapDepositWallets ¶ added in v1.84.1
func (payment Payments) TestSwapDepositWallets(dw payments.DepositWallets)
TestSwapDepositWallets replaces the existing handler for deposit wallets with the one specified for use in testing.
func (Payments) UpdatePackage ¶ added in v1.76.2
func (payment Payments) UpdatePackage(ctx context.Context, packagePlan string, purchaseTime time.Time) (err error)
UpdatePackage updates a user's package information unless they already have a package.
func (Payments) WalletPayments ¶ added in v1.62.1
func (payment Payments) WalletPayments(ctx context.Context) (_ WalletPayments, err error)
WalletPayments returns with all the native blockchain payments for a user's wallet.
func (Payments) WalletPaymentsWithConfirmations ¶ added in v1.84.1
func (payment Payments) WalletPaymentsWithConfirmations(ctx context.Context) (paymentsWithConfirmations []payments.WalletPaymentWithConfirmations, err error)
WalletPaymentsWithConfirmations returns with all the native blockchain payments (including pending) for a user's wallet.
type Placement ¶ added in v1.98.1
type Placement struct { DefaultPlacement storj.PlacementConstraint `json:"defaultPlacement"` Location string `json:"location"` }
Placement contains placement info.
type PlacementEdgeURLOverrides ¶ added in v1.88.2
type PlacementEdgeURLOverrides struct {
// contains filtered or unexported fields
}
PlacementEdgeURLOverrides represents a mapping between placement IDs and edge service URL overrides.
func (*PlacementEdgeURLOverrides) Get ¶ added in v1.88.2
func (ov *PlacementEdgeURLOverrides) Get(placement storj.PlacementConstraint) (overrides EdgeURLOverrides, ok bool)
Get returns the edge service URL overrides for the given placement ID.
func (*PlacementEdgeURLOverrides) Set ¶ added in v1.88.2
func (ov *PlacementEdgeURLOverrides) Set(s string) error
Set implements pflag.Value.
func (*PlacementEdgeURLOverrides) String ¶ added in v1.88.2
func (ov *PlacementEdgeURLOverrides) String() string
String implements pflag.Value.
func (PlacementEdgeURLOverrides) Type ¶ added in v1.88.2
func (PlacementEdgeURLOverrides) Type() string
Type implements pflag.Value.
type PlacementsConfig ¶ added in v1.118.4
type PlacementsConfig struct { SelfServeEnabled bool `help:"whether self-serve placement selection feature is enabled" default:"false"` SelfServeNames []string `help:"list of placements names allowed for self-serve selection" default:""` }
PlacementsConfig contains configurations for self-serve placement logic.
type Project ¶
type Project struct { ID uuid.UUID `json:"id"` PublicID uuid.UUID `json:"publicId"` Name string `json:"name"` Description string `json:"description"` UserAgent []byte `json:"userAgent"` OwnerID uuid.UUID `json:"ownerId"` MaxBuckets *int `json:"maxBuckets"` CreatedAt time.Time `json:"createdAt"` MemberCount int `json:"memberCount"` Status *ProjectStatus `json:"status"` StorageLimit *memory.Size `json:"storageLimit"` StorageUsed int64 `json:"-"` BandwidthLimit *memory.Size `json:"bandwidthLimit"` BandwidthUsed int64 `json:"-"` UserSpecifiedStorageLimit *memory.Size `json:"userSpecifiedStorageLimit"` UserSpecifiedBandwidthLimit *memory.Size `json:"userSpecifiedBandwidthLimit"` SegmentLimit *int64 `json:"segmentLimit"` RateLimit *int `json:"rateLimit"` BurstLimit *int `json:"burstLimit"` RateLimitHead *int `json:"rateLimitHead,omitempty"` BurstLimitHead *int `json:"burstLimitHead,omitempty"` RateLimitGet *int `json:"rateLimitGet,omitempty"` BurstLimitGet *int `json:"burstLimitGet,omitempty"` RateLimitPut *int `json:"rateLimitPut,omitempty"` BurstLimitPut *int `json:"burstLimitPut,omitempty"` RateLimitList *int `json:"rateLimitList,omitempty"` BurstLimitList *int `json:"burstLimitList,omitempty"` RateLimitDelete *int `json:"rateLimitDelete,omitempty"` BurstLimitDelete *int `json:"burstLimitDelete,omitempty"` DefaultPlacement storj.PlacementConstraint `json:"defaultPlacement"` DefaultVersioning DefaultVersioning `json:"defaultVersioning"` PromptedForVersioningBeta bool `json:"-"` PassphraseEnc []byte `json:"-"` PassphraseEncKeyID *int `json:"-"` PathEncryption *bool `json:"-"` }
Project is a database object that describes Project entity.
type ProjectConfig ¶ added in v1.100.2
type ProjectConfig struct { VersioningUIEnabled bool `json:"versioningUIEnabled"` ObjectLockUIEnabled bool `json:"objectLockUIEnabled"` PromptForVersioningBeta bool `json:"promptForVersioningBeta"` // HasManagedPassphrase is a failsafe to prevent user-managed-encryption behavior in the UI if // managed encryption is enabled for a project, but the satellite is unable to decrypt the passphrase. HasManagedPassphrase bool `json:"hasManagedPassphrase"` Passphrase string `json:"passphrase,omitempty"` IsOwnerPaidTier bool `json:"isOwnerPaidTier"` Role ProjectMemberRole `json:"role"` }
ProjectConfig holds config for available "features" for a project.
type ProjectInfo ¶
type ProjectInfo struct { ID uuid.UUID `json:"id"` Name string `json:"name"` OwnerID uuid.UUID `json:"ownerId"` Description string `json:"description"` MemberCount int `json:"memberCount"` CreatedAt time.Time `json:"createdAt"` EdgeURLOverrides *EdgeURLOverrides `json:"edgeURLOverrides,omitempty"` StorageUsed int64 `json:"storageUsed"` BandwidthUsed int64 `json:"bandwidthUsed"` Versioning DefaultVersioning `json:"versioning"` }
ProjectInfo holds data sent via user facing http endpoints.
type ProjectInfoPage ¶ added in v1.86.1
type ProjectInfoPage struct { Projects []ProjectInfo `json:"projects"` Limit int `json:"limit"` Offset int64 `json:"offset"` PageCount int `json:"pageCount"` CurrentPage int `json:"currentPage"` TotalCount int64 `json:"totalCount"` }
ProjectInfoPage is similar to ProjectsPage except the Projects field is ProjectInfo and is sent over HTTP API.
type ProjectInvitation ¶ added in v1.79.1
type ProjectInvitation struct { ProjectID uuid.UUID Email string InviterID *uuid.UUID CreatedAt time.Time }
ProjectInvitation represents a pending project member invitation.
type ProjectInvitationOption ¶ added in v1.91.2
type ProjectInvitationOption int
ProjectInvitationOption represents whether a project invitation request is for inviting new members (creating records) or resending existing invitations (updating records).
const ( // ProjectInvitationCreate indicates to insert new project member records. ProjectInvitationCreate ProjectInvitationOption = iota // ProjectInvitationResend indicates to update existing project member records. ProjectInvitationResend )
type ProjectInvitationResponse ¶ added in v1.81.2
type ProjectInvitationResponse int
ProjectInvitationResponse represents a response to a project member invitation.
const ( // ProjectInvitationDecline represents rejection of a project member invitation. ProjectInvitationDecline ProjectInvitationResponse = iota // ProjectInvitationAccept represents acceptance of a project member invitation. ProjectInvitationAccept )
type ProjectInvitations ¶ added in v1.79.1
type ProjectInvitations interface { // Upsert updates a project member invitation if it exists and inserts it otherwise. Upsert(ctx context.Context, invite *ProjectInvitation) (*ProjectInvitation, error) // Get returns a project member invitation from the database. Get(ctx context.Context, projectID uuid.UUID, email string) (*ProjectInvitation, error) // GetByProjectID returns all the project member invitations for the project specified by the given ID. GetByProjectID(ctx context.Context, projectID uuid.UUID) ([]ProjectInvitation, error) // GetByEmail returns all the project member invitations for the specified email address. GetByEmail(ctx context.Context, email string) ([]ProjectInvitation, error) // GetForActiveProjectsByEmail returns all project member invitations associated with active projects for the specified email address. GetForActiveProjectsByEmail(ctx context.Context, email string) ([]ProjectInvitation, error) // Delete removes a project member invitation from the database. Delete(ctx context.Context, projectID uuid.UUID, email string) error }
ProjectInvitations exposes methods to manage pending project member invitations in the database.
architecture: Database
type ProjectLimitConfig ¶ added in v1.51.1
type ProjectLimitConfig struct { Free int `help:"the default free-tier project limit" default:"1"` Paid int `help:"the default paid-tier project limit" default:"3"` }
ProjectLimitConfig is a configuration struct for default project limits.
type ProjectLimits ¶ added in v1.43.1
type ProjectLimits struct { ProjectBandwidthLimit memory.Size `json:"projectBandwidthLimit"` ProjectStorageLimit memory.Size `json:"projectStorageLimit"` ProjectSegmentLimit int64 `json:"projectSegmentLimit"` }
ProjectLimits holds info for a users bandwidth and storage limits for new projects.
type ProjectMember ¶
type ProjectMember struct { // FK on Users table. MemberID uuid.UUID // FK on Projects table. ProjectID uuid.UUID Role ProjectMemberRole CreatedAt time.Time }
ProjectMember is a database object that describes ProjectMember entity.
type ProjectMemberOrder ¶
type ProjectMemberOrder int8
ProjectMemberOrder is used for querying project members in specified order.
const ( // Name indicates that we should order by full name. Name ProjectMemberOrder = 1 // Email indicates that we should order by email. Email ProjectMemberOrder = 2 // Created indicates that we should order by created date. Created ProjectMemberOrder = 3 )
type ProjectMemberRole ¶ added in v1.104.1
type ProjectMemberRole int
ProjectMemberRole is used to indicate project member's role in the project.
const ( // RoleAdmin indicates that the member has admin rights. RoleAdmin ProjectMemberRole = 0 // RoleMember indicates that the member has regular member rights. RoleMember ProjectMemberRole = 1 )
type ProjectMembers ¶
type ProjectMembers interface { // GetByMemberID is a method for querying project members from the database by memberID. GetByMemberID(ctx context.Context, memberID uuid.UUID) ([]ProjectMember, error) // GetByMemberIDAndProjectID is a method for querying project member from the database by memberID and projectID. GetByMemberIDAndProjectID(ctx context.Context, memberID, projectID uuid.UUID) (*ProjectMember, error) // GetPagedWithInvitationsByProjectID is a method for querying project members and invitations from the database by projectID and cursor. GetPagedWithInvitationsByProjectID(ctx context.Context, projectID uuid.UUID, cursor ProjectMembersCursor) (*ProjectMembersPage, error) // UpdateRole is a method for updating project member role in the database. UpdateRole(ctx context.Context, memberID, projectID uuid.UUID, newRole ProjectMemberRole) (*ProjectMember, error) // Insert is a method for inserting project member into the database. Insert(ctx context.Context, memberID, projectID uuid.UUID, role ProjectMemberRole) (*ProjectMember, error) // Delete is a method for deleting project member by memberID and projectID from the database. Delete(ctx context.Context, memberID, projectID uuid.UUID) error }
ProjectMembers exposes methods to manage ProjectMembers table in database.
architecture: Database
type ProjectMembersCursor ¶ added in v0.17.0
type ProjectMembersCursor struct { Search string Limit uint Page uint Order ProjectMemberOrder OrderDirection OrderDirection }
ProjectMembersCursor holds info for project members cursor pagination.
type ProjectMembersPage ¶ added in v0.17.0
type ProjectMembersPage struct { ProjectMembers []ProjectMember ProjectInvitations []ProjectInvitation Search string Limit uint Order ProjectMemberOrder OrderDirection OrderDirection Offset uint64 PageCount uint CurrentPage uint TotalCount uint64 }
ProjectMembersPage represents a page of project members and invitations.
type ProjectStatus ¶ added in v1.118.4
type ProjectStatus int
ProjectStatus - is used to indicate status of the user's project.
const ( // ProjectDisabled is a status that project receives after deleting/disabling by the user. ProjectDisabled ProjectStatus = 0 // ProjectActive is a status that project receives after creation. ProjectActive ProjectStatus = 1 )
type ProjectUsageLimits ¶ added in v0.28.0
type ProjectUsageLimits struct { StorageLimit int64 `json:"storageLimit"` UserSetStorageLimit *int64 `json:"userSetStorageLimit"` BandwidthLimit int64 `json:"bandwidthLimit"` UserSetBandwidthLimit *int64 `json:"userSetBandwidthLimit"` StorageUsed int64 `json:"storageUsed"` BandwidthUsed int64 `json:"bandwidthUsed"` ObjectCount int64 `json:"objectCount"` SegmentCount int64 `json:"segmentCount"` RateLimit int64 `json:"rateLimit"` SegmentLimit int64 `json:"segmentLimit"` RateUsed int64 `json:"rateUsed"` SegmentUsed int64 `json:"segmentUsed"` BucketsUsed int64 `json:"bucketsUsed"` BucketsLimit int64 `json:"bucketsLimit"` }
ProjectUsageLimits holds project usage limits and current usage.
type Projects ¶
type Projects interface { // GetAll is a method for querying all projects from the database. GetAll(ctx context.Context) ([]Project, error) // GetCreatedBefore retrieves all projects created before provided date. GetCreatedBefore(ctx context.Context, before time.Time) ([]Project, error) // GetByUserID returns a list of projects (including disabled) where user is a project member. GetByUserID(ctx context.Context, userID uuid.UUID) ([]Project, error) // GetActiveByUserID returns a list of active projects where user is a project member. GetActiveByUserID(ctx context.Context, userID uuid.UUID) ([]Project, error) // GetOwn returns a list of projects (including disabled) where user is an owner. GetOwn(ctx context.Context, userID uuid.UUID) ([]Project, error) // GetOwnActive returns a list of active projects where user is an owner. GetOwnActive(ctx context.Context, userID uuid.UUID) ([]Project, error) // Get is a method for querying project from the database by id. Get(ctx context.Context, id uuid.UUID) (*Project, error) // GetSalt returns the project's salt. GetSalt(ctx context.Context, id uuid.UUID) ([]byte, error) // GetEncryptedPassphrase gets the encrypted passphrase of this project. // NB: projects that don't have satellite managed encryption will not have this. GetEncryptedPassphrase(ctx context.Context, id uuid.UUID) ([]byte, *int, error) // GetByPublicID is a method for querying project from the database by public_id. GetByPublicID(ctx context.Context, publicID uuid.UUID) (*Project, error) // Insert is a method for inserting project into the database. Insert(ctx context.Context, project *Project) (*Project, error) // Delete is a method for deleting project by Id from the database. Delete(ctx context.Context, id uuid.UUID) error // Update is a method for updating project entity. Update(ctx context.Context, project *Project) error // List returns paginated projects, created before provided timestamp. List(ctx context.Context, offset int64, limit int, before time.Time) (ProjectsPage, error) // ListByOwnerID is a method for querying all projects (including disabled) from the database by ownerID. It also includes the number of members for each project. ListByOwnerID(ctx context.Context, userID uuid.UUID, cursor ProjectsCursor) (ProjectsPage, error) // ListActiveByOwnerID is a method for querying only active projects from the database by ownerID. It also includes the number of members for each project. ListActiveByOwnerID(ctx context.Context, userID uuid.UUID, cursor ProjectsCursor) (ProjectsPage, error) // UpdateRateLimit is a method for updating projects rate limit. UpdateRateLimit(ctx context.Context, id uuid.UUID, newLimit *int) error // UpdateBurstLimit is a method for updating projects burst limit. UpdateBurstLimit(ctx context.Context, id uuid.UUID, newLimit *int) error // GetMaxBuckets is a method to get the maximum number of buckets allowed for the project GetMaxBuckets(ctx context.Context, id uuid.UUID) (*int, error) // GetDefaultVersioning is a method to get the default versioning state of a new bucket in the project. GetDefaultVersioning(ctx context.Context, id uuid.UUID) (DefaultVersioning, error) // UpdateDefaultVersioning is a method to update the default versioning state of a new bucket in the project. UpdateDefaultVersioning(ctx context.Context, id uuid.UUID, versioning DefaultVersioning) error // UpdateBucketLimit is a method for updating projects bucket limit. UpdateBucketLimit(ctx context.Context, id uuid.UUID, newLimit *int) error // UpdateUsageLimits is a method for updating project's usage limits. UpdateUsageLimits(ctx context.Context, id uuid.UUID, limits UsageLimits) error // UpdateAllLimits is a method for updating max buckets, storage, bandwidth, segment, rate, and burst limits. UpdateAllLimits(ctx context.Context, id uuid.UUID, storage, bandwidth, segment *int64, buckets, rate, burst *int) error // UpdateLimitsGeneric is a method for updating any or all types of limits on a project. // ALL limits passed in to the request will be updated i.e. if a limit type is passed in with a null value, that limit will be updated to null. UpdateLimitsGeneric(ctx context.Context, id uuid.UUID, toUpdate []Limit) error // UpdateUserAgent is a method for updating projects user agent. UpdateUserAgent(ctx context.Context, id uuid.UUID, userAgent []byte) error // UpdateStatus is a method for updating projects status. UpdateStatus(ctx context.Context, id uuid.UUID, status ProjectStatus) error // UpdateDefaultPlacement is a method to update the project's default placement for new segments. UpdateDefaultPlacement(ctx context.Context, id uuid.UUID, placement storj.PlacementConstraint) error }
Projects exposes methods to manage Project table in database.
architecture: Database
type ProjectsCursor ¶ added in v1.21.1
ProjectsCursor holds info for project cursor pagination.
type ProjectsPage ¶ added in v0.25.0
type ProjectsPage struct { Projects []Project Next bool NextOffset int64 Limit int Offset int64 PageCount int CurrentPage int TotalCount int64 }
ProjectsPage returns paginated projects, providing next offset if there are more projects to retrieve.
type RESTKeys ¶ added in v1.54.1
type RESTKeys interface { Create(ctx context.Context, userID uuid.UUID, expiration time.Duration) (apiKey string, expiresAt time.Time, err error) GetUserAndExpirationFromKey(ctx context.Context, apiKey string) (userID uuid.UUID, exp time.Time, err error) Revoke(ctx context.Context, apiKey string) (err error) }
RESTKeys is an interface for rest key operations.
type RegistrationSecret ¶
type RegistrationSecret [32]byte
RegistrationSecret stores secret of registration token.
func NewRegistrationSecret ¶
func NewRegistrationSecret() (RegistrationSecret, error)
NewRegistrationSecret creates new registration secret.
func RegistrationSecretFromBase64 ¶
func RegistrationSecretFromBase64(s string) (RegistrationSecret, error)
RegistrationSecretFromBase64 creates new registration secret from base64 string.
func (RegistrationSecret) IsZero ¶ added in v0.34.8
func (secret RegistrationSecret) IsZero() bool
IsZero returns if the RegistrationSecret is not set.
func (RegistrationSecret) String ¶
func (secret RegistrationSecret) String() string
String implements Stringer.
type RegistrationToken ¶
type RegistrationToken struct { // Secret is PK of the table and keeps unique value forRegToken Secret RegistrationSecret // OwnerID stores current token owner ID OwnerID *uuid.UUID // ProjectLimit defines how many projects user is able to create ProjectLimit int `json:"projectLimit"` CreatedAt time.Time `json:"createdAt"` }
RegistrationToken describing api key model in the database.
type RegistrationTokens ¶
type RegistrationTokens interface { // Create creates new registration token Create(ctx context.Context, projectLimit int) (*RegistrationToken, error) // GetBySecret retrieves RegTokenInfo with given Secret GetBySecret(ctx context.Context, secret RegistrationSecret) (*RegistrationToken, error) // GetByOwnerID retrieves RegTokenInfo by ownerID GetByOwnerID(ctx context.Context, ownerID uuid.UUID) (*RegistrationToken, error) // UpdateOwner updates registration token's owner UpdateOwner(ctx context.Context, secret RegistrationSecret, ownerID uuid.UUID) error }
RegistrationTokens is interface for working with registration tokens.
architecture: Database
type ResetPasswordSecret ¶ added in v0.12.0
type ResetPasswordSecret [32]byte
ResetPasswordSecret stores secret of registration token.
func NewResetPasswordSecret ¶ added in v0.12.0
func NewResetPasswordSecret() (ResetPasswordSecret, error)
NewResetPasswordSecret creates new reset password secret.
func ResetPasswordSecretFromBase64 ¶ added in v0.12.0
func ResetPasswordSecretFromBase64(s string) (ResetPasswordSecret, error)
ResetPasswordSecretFromBase64 creates new reset password secret from base64 string.
func (ResetPasswordSecret) String ¶ added in v0.12.0
func (secret ResetPasswordSecret) String() string
String implements Stringer.
type ResetPasswordToken ¶ added in v0.12.0
type ResetPasswordToken struct { // Secret is PK of the table and keeps unique value for reset password token Secret ResetPasswordSecret // OwnerID stores current token owner ID OwnerID *uuid.UUID CreatedAt time.Time `json:"createdAt"` }
ResetPasswordToken describing reset password model in the database.
type ResetPasswordTokens ¶ added in v0.12.0
type ResetPasswordTokens interface { // Create creates new reset password token Create(ctx context.Context, ownerID uuid.UUID) (*ResetPasswordToken, error) // GetBySecret retrieves ResetPasswordToken with given secret GetBySecret(ctx context.Context, secret ResetPasswordSecret) (*ResetPasswordToken, error) // GetByOwnerID retrieves ResetPasswordToken by ownerID GetByOwnerID(ctx context.Context, ownerID uuid.UUID) (*ResetPasswordToken, error) // Delete deletes ResetPasswordToken by ResetPasswordSecret Delete(ctx context.Context, secret ResetPasswordSecret) error }
ResetPasswordTokens is interface for working with reset password tokens.
architecture: Database
type ResponseUser ¶ added in v1.57.1
type ResponseUser struct { ID uuid.UUID `json:"id"` FullName string `json:"fullName"` ShortName string `json:"shortName"` Email string `json:"email"` UserAgent []byte `json:"userAgent"` ProjectLimit int `json:"projectLimit"` IsProfessional bool `json:"isProfessional"` Position string `json:"position"` CompanyName string `json:"companyName"` EmployeeCount string `json:"employeeCount"` HaveSalesContact bool `json:"haveSalesContact"` PaidTier bool `json:"paidTier"` MFAEnabled bool `json:"isMFAEnabled"` MFARecoveryCodeCount int `json:"mfaRecoveryCodeCount"` }
ResponseUser is an entity which describes db User and can be sent in response.
type SegmentLimitConfig ¶ added in v1.46.3
type SegmentLimitConfig struct { Free int64 `help:"the default free-tier segment usage limit" default:"10000"` Paid int64 `help:"the default paid-tier segment usage limit" default:"100000000"` }
SegmentLimitConfig is a configuration struct for default segments per-project usage limits.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is handling accounts related logic.
architecture: Service
func NewService ¶
func NewService(log *zap.Logger, store DB, restKeys RESTKeys, projectAccounting accounting.ProjectAccounting, projectUsage *accounting.Service, buckets buckets.DB, accounts payments.Accounts, depositWallets payments.DepositWallets, billingDb billing.TransactionsDB, analytics *analytics.Service, tokens *consoleauth.Service, mailService *mailservice.Service, accountFreezeService *AccountFreezeService, emission *emission.Service, kmsService *kms.Service, ssoService *sso.Service, satelliteAddress string, satelliteName string, maxProjectBuckets int, ssoEnabled bool, placements nodeselection.PlacementDefinitions, objectLockAndVersioningConfig ObjectLockAndVersioningConfig, config Config) (*Service, error)
NewService returns new instance of Service.
func (*Service) ActivateAccount ¶
func (s *Service) ActivateAccount(ctx context.Context, activationToken string) (user *User, err error)
ActivateAccount - is a method for activating user account after registration.
func (*Service) AddProjectMembers ¶
func (s *Service) AddProjectMembers(ctx context.Context, projectID uuid.UUID, emails []string) (users []*User, err error)
AddProjectMembers adds users by email to given project. Email addresses not belonging to a user are ignored. projectID here may be project.PublicID or project.ID.
func (*Service) ChangeEmail ¶ added in v1.17.1
ChangeEmail handles change user's email actions.
func (*Service) ChangePassword ¶
func (s *Service) ChangePassword(ctx context.Context, pass, newPass string, sessionID *uuid.UUID) (err error)
ChangePassword updates password for a given user.
func (*Service) CreateAPIKey ¶
func (s *Service) CreateAPIKey(ctx context.Context, projectID uuid.UUID, name string, version macaroon.APIKeyVersion) (_ *APIKeyInfo, _ *macaroon.APIKey, err error)
CreateAPIKey creates new api key. projectID here may be project.PublicID or project.ID.
func (*Service) CreateInviteToken ¶ added in v1.82.1
func (s *Service) CreateInviteToken(ctx context.Context, publicProjectID uuid.UUID, email string, inviteDate time.Time) (_ string, err error)
CreateInviteToken creates a token for project invite links. Internal use only, since it doesn't check if the project is valid or the user is a member of the project.
func (*Service) CreateProject ¶
func (s *Service) CreateProject(ctx context.Context, projectInfo UpsertProjectInfo) (p *Project, err error)
CreateProject is a method for creating new project.
func (*Service) CreateRESTKey ¶ added in v1.54.1
func (s *Service) CreateRESTKey(ctx context.Context, expiration time.Duration) (apiKey string, expiresAt time.Time, err error)
CreateRESTKey creates a satellite rest key.
func (*Service) CreateRegToken ¶
func (s *Service) CreateRegToken(ctx context.Context, projLimit int) (_ *RegistrationToken, err error)
CreateRegToken creates new registration token. Needed for testing.
func (*Service) CreateSsoUser ¶ added in v1.116.3
CreateSsoUser creates a user that has been authenticated by SSO provider.
func (*Service) CreateUser ¶
func (s *Service) CreateUser(ctx context.Context, user CreateUser, tokenSecret RegistrationSecret) (u *User, err error)
CreateUser gets password hash value and creates new inactive User.
func (*Service) DeleteAPIKeyByNameAndProjectID ¶ added in v1.26.2
func (s *Service) DeleteAPIKeyByNameAndProjectID(ctx context.Context, name string, projectID uuid.UUID) (err error)
DeleteAPIKeyByNameAndProjectID deletes api key by name and project ID. ID here may be project.publicID or project.ID.
func (*Service) DeleteAPIKeys ¶
DeleteAPIKeys deletes api key by id.
func (*Service) DeleteAccount ¶
func (s *Service) DeleteAccount(ctx context.Context, step AccountActionStep, data string) (resp *DeleteAccountResponse, err error)
DeleteAccount handles self-serve account delete actions.
func (*Service) DeleteAllSessionsByUserIDExcept ¶ added in v1.70.1
func (s *Service) DeleteAllSessionsByUserIDExcept(ctx context.Context, userID uuid.UUID, sessionID uuid.UUID) (err error)
DeleteAllSessionsByUserIDExcept removes all sessions except the specified session from the database.
func (*Service) DeleteProject ¶
func (s *Service) DeleteProject(ctx context.Context, projectID uuid.UUID, step AccountActionStep, data string) (info *DeleteProjectInfo, err error)
DeleteProject is a method for deleting project by id.
func (*Service) DeleteProjectMembersAndInvitations ¶ added in v1.82.1
func (s *Service) DeleteProjectMembersAndInvitations(ctx context.Context, projectID uuid.UUID, emails []string) (err error)
DeleteProjectMembersAndInvitations removes users and invitations by email from given project. projectID here may be project.PublicID or project.ID.
func (*Service) DeleteSession ¶ added in v1.63.1
DeleteSession removes the session from the database.
func (*Service) DisableUserMFA ¶ added in v1.36.1
func (s *Service) DisableUserMFA(ctx context.Context, passcode string, t time.Time, recoveryCode string) (err error)
DisableUserMFA disables multi-factor authentication for the user if the given secret key and password are valid.
func (*Service) EnableUserMFA ¶ added in v1.36.1
EnableUserMFA enables multi-factor authentication for the user if the given secret key and password are valid.
func (*Service) GenCreateAPIKey ¶ added in v1.57.1
func (s *Service) GenCreateAPIKey(ctx context.Context, requestInfo CreateAPIKeyRequest) (*CreateAPIKeyResponse, api.HTTPError)
GenCreateAPIKey creates new api key for generated api.
func (*Service) GenCreateProject ¶ added in v1.53.1
func (s *Service) GenCreateProject(ctx context.Context, projectInfo UpsertProjectInfo) (p *Project, httpError api.HTTPError)
GenCreateProject is a method for creating new project for generated api.
func (*Service) GenDeleteAPIKey ¶ added in v1.64.1
GenDeleteAPIKey deletes api key for generated api.
func (*Service) GenDeleteProject ¶ added in v1.57.1
func (s *Service) GenDeleteProject(ctx context.Context, projectID uuid.UUID) (httpError api.HTTPError)
GenDeleteProject is a method for deleting project by id for generated API.
func (*Service) GenGetAPIKeys ¶ added in v1.64.1
func (s *Service) GenGetAPIKeys(ctx context.Context, projectID uuid.UUID, search string, limit, page uint, order APIKeyOrder, orderDirection OrderDirection) (*APIKeyPage, api.HTTPError)
GenGetAPIKeys returns api keys belonging to a project for generated api.
func (*Service) GenGetBucketUsageRollups ¶ added in v1.52.1
func (s *Service) GenGetBucketUsageRollups(ctx context.Context, reqProjectID uuid.UUID, since, before time.Time) (rollups []accounting.BucketUsageRollup, httpError api.HTTPError)
GenGetBucketUsageRollups retrieves summed usage rollups for every bucket of particular project for a given period for generated api.
func (*Service) GenGetSingleBucketUsageRollup ¶ added in v1.51.1
func (s *Service) GenGetSingleBucketUsageRollup(ctx context.Context, reqProjectID uuid.UUID, bucket string, since, before time.Time) (rollup *accounting.BucketUsageRollup, httpError api.HTTPError)
GenGetSingleBucketUsageRollup retrieves usage rollup for single bucket of particular project for a given period for generated api.
func (*Service) GenGetUser ¶ added in v1.57.1
GenGetUser returns ResponseUser by request context for generated api.
func (*Service) GenGetUsersProjects ¶ added in v1.51.1
GenGetUsersProjects is a method for querying all projects for generated api.
func (*Service) GenUpdateProject ¶ added in v1.54.1
func (s *Service) GenUpdateProject(ctx context.Context, projectID uuid.UUID, projectInfo UpsertProjectInfo) (p *Project, httpError api.HTTPError)
GenUpdateProject is a method for updating project name and description by id for generated api.
func (*Service) GenerateActivationToken ¶
func (s *Service) GenerateActivationToken(ctx context.Context, id uuid.UUID, email string) (token string, err error)
GenerateActivationToken - is a method for generating activation token.
func (*Service) GeneratePasswordRecoveryToken ¶ added in v0.10.0
func (s *Service) GeneratePasswordRecoveryToken(ctx context.Context, user *User) (token string, err error)
GeneratePasswordRecoveryToken - is a method for generating password recovery token.
func (*Service) GenerateSessionToken ¶ added in v1.58.1
func (s *Service) GenerateSessionToken(ctx context.Context, userID uuid.UUID, email, ip, userAgent string, customDuration *time.Duration) (_ *TokenInfo, err error)
GenerateSessionToken creates a new session and returns the string representation of its token.
func (*Service) GetAPIKeyInfo ¶
GetAPIKeyInfo retrieves api key by id.
func (*Service) GetAPIKeyInfoByName ¶ added in v1.51.1
func (s *Service) GetAPIKeyInfoByName(ctx context.Context, projectID uuid.UUID, name string) (_ *APIKeyInfo, err error)
GetAPIKeyInfoByName retrieves an api key by its name and project id.
func (*Service) GetAPIKeys ¶ added in v0.21.0
func (s *Service) GetAPIKeys(ctx context.Context, reqProjectID uuid.UUID, cursor APIKeyCursor) (page *APIKeyPage, err error)
GetAPIKeys returns paged api key list for given Project.
func (*Service) GetAllAPIKeyNamesByProjectID ¶ added in v1.82.1
func (s *Service) GetAllAPIKeyNamesByProjectID(ctx context.Context, projectID uuid.UUID) (names []string, err error)
GetAllAPIKeyNamesByProjectID returns all api key names by project ID.
func (*Service) GetAllBucketNames ¶ added in v1.18.1
func (s *Service) GetAllBucketNames(ctx context.Context, projectID uuid.UUID) (_ []string, err error)
GetAllBucketNames retrieves all bucket names of a specific project. projectID here may be Project.ID or Project.PublicID.
func (*Service) GetBucketMetadata ¶ added in v1.101.1
func (s *Service) GetBucketMetadata(ctx context.Context, projectID uuid.UUID) (list []BucketMetadata, err error)
GetBucketMetadata retrieves all bucket names of a specific project and related metadata, e.g. placement and versioning. projectID here may be Project.ID or Project.PublicID.
func (*Service) GetBucketTotals ¶ added in v0.12.0
func (s *Service) GetBucketTotals(ctx context.Context, projectID uuid.UUID, cursor accounting.BucketUsageCursor, before time.Time) (_ *accounting.BucketUsagePage, err error)
GetBucketTotals retrieves paged bucket total usages since project creation.
func (*Service) GetDailyProjectUsage ¶ added in v1.48.1
func (s *Service) GetDailyProjectUsage(ctx context.Context, projectID uuid.UUID, from, to time.Time) (_ *accounting.ProjectDailyUsage, err error)
GetDailyProjectUsage returns daily usage by project ID. ID here may be project.ID or project.PublicID.
func (*Service) GetEmissionImpact ¶ added in v1.98.1
func (s *Service) GetEmissionImpact(ctx context.Context, projectID uuid.UUID) (*EmissionImpactResponse, error)
GetEmissionImpact is a method for querying project emission impact by id.
func (*Service) GetInviteByToken ¶ added in v1.82.1
func (s *Service) GetInviteByToken(ctx context.Context, token string) (invite *ProjectInvitation, err error)
GetInviteByToken returns a project invite given an invite token.
func (*Service) GetInviteLink ¶ added in v1.82.1
func (s *Service) GetInviteLink(ctx context.Context, publicProjectID uuid.UUID, email string) (_ string, err error)
GetInviteLink returns a link for project invites.
func (*Service) GetInvitesByEmail ¶ added in v1.89.2
func (s *Service) GetInvitesByEmail(ctx context.Context, email string) (invites []ProjectInvitation, err error)
GetInvitesByEmail returns project invites by email.
func (*Service) GetLoginAttemptsWithoutPenalty ¶ added in v1.101.1
GetLoginAttemptsWithoutPenalty returns LoginAttemptsWithoutPenalty config value.
func (*Service) GetMinimalProject ¶ added in v1.88.2
func (s *Service) GetMinimalProject(project *Project) ProjectInfo
GetMinimalProject returns a ProjectInfo copy of a project.
func (*Service) GetObjectLockUIEnabledByProject ¶ added in v1.113.1
GetObjectLockUIEnabledByProject returns whether object lock is enabled for the project.
func (*Service) GetObjectVersioningUIEnabledByProject ¶ added in v1.113.1
func (s *Service) GetObjectVersioningUIEnabledByProject(project *Project) (versioningUIEnabled bool, promptForVersioningBeta bool)
GetObjectVersioningUIEnabledByProject returns whether object versioning is enabled for the project.
func (*Service) GetPagedActiveSessions ¶ added in v1.111.4
func (s *Service) GetPagedActiveSessions(ctx context.Context, cursor consoleauth.WebappSessionsCursor) (page *consoleauth.WebappSessionsPage, err error)
GetPagedActiveSessions returns paged active webapp sessions list for given User.
func (*Service) GetProject ¶
GetProject is a method for querying project by internal or public ID.
func (*Service) GetProjectConfig ¶ added in v1.100.2
func (s *Service) GetProjectConfig(ctx context.Context, projectID uuid.UUID) (*ProjectConfig, error)
GetProjectConfig is a method for querying project config.
func (*Service) GetProjectMember ¶ added in v1.105.2
func (s *Service) GetProjectMember(ctx context.Context, memberID, projectID uuid.UUID) (pm *ProjectMember, err error)
GetProjectMember queries and returns project member by given project and member IDs.
func (*Service) GetProjectMembersAndInvitations ¶ added in v1.82.1
func (s *Service) GetProjectMembersAndInvitations(ctx context.Context, projectID uuid.UUID, cursor ProjectMembersCursor) (pmp *ProjectMembersPage, err error)
GetProjectMembersAndInvitations returns the project members and invitations for a given project.
func (*Service) GetProjectNoAuth ¶ added in v1.81.2
func (s *Service) GetProjectNoAuth(ctx context.Context, projectID uuid.UUID) (p *Project, err error)
GetProjectNoAuth is a method for querying project by ID or public ID. This is for internal use only as it ignores whether a user is authorized to perform this action. If authorization checking is required, use GetProject.
func (*Service) GetProjectUsage ¶ added in v0.9.0
func (s *Service) GetProjectUsage(ctx context.Context, projectID uuid.UUID, since, before time.Time) (_ *accounting.ProjectUsage, err error)
GetProjectUsage retrieves project usage for a given period.
func (*Service) GetProjectUsageLimits ¶ added in v0.28.0
func (s *Service) GetProjectUsageLimits(ctx context.Context, projectID uuid.UUID) (_ *ProjectUsageLimits, err error)
GetProjectUsageLimits returns project limits and current usage.
Among others,it can return one of the following errors returned by storj.io/storj/satellite/accounting.Service, wrapped Error.
func (*Service) GetSalt ¶ added in v1.65.1
GetSalt is a method for querying project salt by id. id may be project.ID or project.PublicID.
func (*Service) GetSingleBucketTotals ¶ added in v1.115.1
func (s *Service) GetSingleBucketTotals(ctx context.Context, projectID uuid.UUID, bucketName string, before time.Time) (_ *accounting.BucketUsage, err error)
GetSingleBucketTotals retrieves a single bucket total usages since project creation.
func (*Service) GetTotalUsageLimits ¶ added in v1.34.1
func (s *Service) GetTotalUsageLimits(ctx context.Context) (_ *ProjectUsageLimits, err error)
GetTotalUsageLimits returns total limits and current usage for all the projects.
func (*Service) GetUsageReport ¶ added in v1.92.1
func (s *Service) GetUsageReport(ctx context.Context, since, before time.Time, projectID uuid.UUID) ([]accounting.ProjectReportItem, error)
GetUsageReport retrieves usage rollups for every bucket of a single or all the user owned projects for a given period.
func (*Service) GetUserByEmailWithUnverified ¶ added in v1.46.3
func (s *Service) GetUserByEmailWithUnverified(ctx context.Context, email string) (verified *User, unverified []User, err error)
GetUserByEmailWithUnverified returns Users by email.
func (*Service) GetUserByExternalID ¶ added in v1.116.3
func (s *Service) GetUserByExternalID(ctx context.Context, externalID string) (user *User, err error)
GetUserByExternalID returns a user with specified external ID.
func (*Service) GetUserForSsoAuth ¶ added in v1.116.3
func (s *Service) GetUserForSsoAuth(ctx context.Context, claims sso.OidcSsoClaims, provider, ip, userAgent string) (user *User, err error)
GetUserForSsoAuth returns a user based on the SSO claims, creating one if necessary.
func (*Service) GetUserHasVarPartner ¶ added in v1.100.2
GetUserHasVarPartner returns whether the user in context is associated with a VAR partner.
func (*Service) GetUserProjectInvitations ¶ added in v1.81.2
func (s *Service) GetUserProjectInvitations(ctx context.Context) (_ []ProjectInvitation, err error)
GetUserProjectInvitations returns a user's pending project member invitations.
func (*Service) GetUserSettings ¶ added in v1.76.1
func (s *Service) GetUserSettings(ctx context.Context) (settings *UserSettings, err error)
GetUserSettings fetches a user's settings. It creates default settings if none exists.
func (*Service) GetUsersOwnedProjectsPage ¶ added in v1.22.1
func (s *Service) GetUsersOwnedProjectsPage(ctx context.Context, cursor ProjectsCursor) (_ ProjectsPage, err error)
GetUsersOwnedProjectsPage is a method for querying paged projects.
func (*Service) GetUsersProjects ¶
GetUsersProjects is a method for querying all projects.
func (*Service) InvalidateSession ¶ added in v1.111.4
InvalidateSession invalidates the session by ID.
func (*Service) InviteNewProjectMember ¶ added in v1.91.2
func (s *Service) InviteNewProjectMember(ctx context.Context, projectID uuid.UUID, email string) (invite *ProjectInvitation, err error)
InviteNewProjectMember invites a user by email to the project specified by the given ID, which may be its public or internal ID.
func (*Service) IsProjectInvitationExpired ¶ added in v1.82.1
func (s *Service) IsProjectInvitationExpired(invite *ProjectInvitation) bool
IsProjectInvitationExpired returns whether the project member invitation has expired.
func (*Service) KeyAuth ¶ added in v1.58.1
func (s *Service) KeyAuth(ctx context.Context, apikey string, authTime time.Time) (_ context.Context, err error)
KeyAuth returns an authenticated context by api key.
func (*Service) ParseInviteToken ¶ added in v1.82.1
func (s *Service) ParseInviteToken(ctx context.Context, token string) (publicID uuid.UUID, email string, err error)
ParseInviteToken parses a token from project invite links.
func (*Service) RefreshSession ¶ added in v1.63.1
func (s *Service) RefreshSession(ctx context.Context, sessionID uuid.UUID) (expiresAt time.Time, err error)
RefreshSession resets the expiration time of the session.
func (*Service) ReinviteProjectMembers ¶ added in v1.91.2
func (s *Service) ReinviteProjectMembers(ctx context.Context, projectID uuid.UUID, emails []string) (invites []ProjectInvitation, err error)
ReinviteProjectMembers resends project invitations to the users specified by the given email slice. The provided project ID may be the public or internal ID.
func (*Service) RequestLimitIncrease ¶ added in v1.88.2
func (s *Service) RequestLimitIncrease(ctx context.Context, projectID uuid.UUID, info LimitRequestInfo) (err error)
RequestLimitIncrease is a method for requesting limit increase for a project.
func (*Service) RequestProjectLimitIncrease ¶ added in v1.90.1
RequestProjectLimitIncrease is a method for requesting to increase max number of projects for a user.
func (*Service) ResetAccountLock ¶ added in v1.101.1
ResetAccountLock resets a user's failed login count and lockout duration.
func (*Service) ResetMFARecoveryCodes ¶ added in v1.36.1
func (s *Service) ResetMFARecoveryCodes(ctx context.Context, requireCode bool, passcode string, recoveryCode string) (codes []string, err error)
ResetMFARecoveryCodes creates a new set of MFA recovery codes for the user.
func (*Service) ResetMFASecretKey ¶ added in v1.36.1
ResetMFASecretKey creates a new TOTP secret key for the user.
func (*Service) ResetPassword ¶ added in v0.10.0
func (s *Service) ResetPassword(ctx context.Context, resetPasswordToken, password string, passcode string, recoveryCode string, t time.Time) (err error)
ResetPassword - is a method for resetting user password.
func (*Service) RespondToProjectInvitation ¶ added in v1.81.2
func (s *Service) RespondToProjectInvitation(ctx context.Context, projectID uuid.UUID, response ProjectInvitationResponse) (err error)
RespondToProjectInvitation handles accepting or declining a user's project member invitation. The given project ID may be the internal or public ID.
func (*Service) RevokeRESTKey ¶ added in v1.54.1
RevokeRESTKey revokes a satellite REST key.
func (*Service) RevokeResetPasswordToken ¶ added in v0.12.0
func (s *Service) RevokeResetPasswordToken(ctx context.Context, resetPasswordToken string) (err error)
RevokeResetPasswordToken - is a method to revoke reset password token.
func (*Service) SetAccountActive ¶ added in v1.94.1
SetAccountActive - is a method for setting user account status to Active and sending event to hubspot.
func (*Service) SetActivationCodeAndSignupID ¶ added in v1.94.1
SetActivationCodeAndSignupID - generates and updates a new code for user's signup verification. It updates the request ID associated with the signup as well.
func (*Service) SetUserSettings ¶ added in v1.76.1
func (s *Service) SetUserSettings(ctx context.Context, request UpsertUserSettingsRequest) (settings *UserSettings, err error)
SetUserSettings updates a user's settings.
func (*Service) SetupAccount ¶ added in v1.94.1
func (s *Service) SetupAccount(ctx context.Context, requestData SetUpAccountRequest) (err error)
SetupAccount completes User's information.
func (*Service) ShouldRequireSsoByUser ¶ added in v1.118.4
ShouldRequireSsoByUser returns whether SSO should be required of a user.
func (*Service) TestSetNow ¶ added in v1.85.1
TestSetNow allows tests to have the Service act as if the current time is whatever they want.
func (*Service) TestSetObjectLockAndVersioningConfig ¶ added in v1.113.1
func (s *Service) TestSetObjectLockAndVersioningConfig(config ObjectLockAndVersioningConfig) error
TestSetObjectLockAndVersioningConfig allows tests to switch the versioning config.
func (*Service) TestSwapCaptchaHandler ¶ added in v1.56.1
func (s *Service) TestSwapCaptchaHandler(h CaptchaHandler)
TestSwapCaptchaHandler replaces the existing handler for captchas with the one specified for use in testing.
func (*Service) TestToggleSatelliteManagedEncryption ¶ added in v1.108.1
TestToggleSatelliteManagedEncryption toggles the satellite managed encryption config for tests.
func (*Service) TestToggleSsoEnabled ¶ added in v1.117.3
TestToggleSsoEnabled is used in tests to toggle SSO.
func (*Service) TokenAuth ¶ added in v1.58.1
func (s *Service) TokenAuth(ctx context.Context, token consoleauth.Token, authTime time.Time) (_ context.Context, err error)
TokenAuth returns an authenticated context by session token.
func (*Service) TokenByAPIKey ¶ added in v1.80.3
func (s *Service) TokenByAPIKey(ctx context.Context, userAgent string, ip string, apiKey string) (response *TokenInfo, err error)
TokenByAPIKey authenticates User by API Key and returns session token.
func (*Service) UpdateAccount ¶
UpdateAccount updates User.
func (*Service) UpdateExternalID ¶ added in v1.116.3
UpdateExternalID updates the external (SSO) ID of a user, activating them if they're not already.
func (*Service) UpdateProject ¶
func (s *Service) UpdateProject(ctx context.Context, projectID uuid.UUID, updatedProject UpsertProjectInfo) (p *Project, err error)
UpdateProject is a method for updating project name and description by id. projectID here may be project.PublicID or project.ID.
func (*Service) UpdateProjectMemberRole ¶ added in v1.104.1
func (s *Service) UpdateProjectMemberRole(ctx context.Context, memberID, projectID uuid.UUID, newRole ProjectMemberRole) (pm *ProjectMember, err error)
UpdateProjectMemberRole updates project member's role and returns an updated one.
func (*Service) UpdateUserOnSignup ¶ added in v1.117.3
func (s *Service) UpdateUserOnSignup(ctx context.Context, inactiveUser *User, requestData CreateUser) (err error)
UpdateUserOnSignup gets new password hash value and updates old inactive User.
func (*Service) UpdateUserSpecifiedLimits ¶ added in v1.107.1
func (s *Service) UpdateUserSpecifiedLimits(ctx context.Context, projectID uuid.UUID, updatedLimits UpdateLimitsInfo) (err error)
UpdateUserSpecifiedLimits is a method for updating project user specified limits.
func (*Service) UpdateUsersFailedLoginState ¶ added in v1.55.1
func (s *Service) UpdateUsersFailedLoginState(ctx context.Context, user *User) (lockoutDuration time.Duration, err error)
UpdateUsersFailedLoginState updates User's failed login state.
func (*Service) UpdateVersioningOptInStatus ¶ added in v1.102.2
func (s *Service) UpdateVersioningOptInStatus(ctx context.Context, projectID uuid.UUID, optInStatus VersioningOptInStatus) error
UpdateVersioningOptInStatus updates the default versioning of a project. It is intended to be used to opt projects into versioning beta i.e.: console.VersioningUnsupported = opt out console.Unversioned or console.VersioningEnabled = opt in.
func (*Service) VerifyForgotPasswordCaptcha ¶ added in v1.65.1
func (s *Service) VerifyForgotPasswordCaptcha(ctx context.Context, responseToken, userIP string) (valid bool, err error)
VerifyForgotPasswordCaptcha returns whether the given captcha response for the forgot password page is valid. It will return true without error if the captcha handler has not been set.
type SessionConfig ¶ added in v1.63.1
type SessionConfig struct { InactivityTimerEnabled bool `help:"indicates if session can be timed out due inactivity" default:"true"` InactivityTimerDuration int `help:"inactivity timer delay in seconds" default:"1800"` // 1800s=30m InactivityTimerViewerEnabled bool `help:"indicates whether remaining session time is shown for debugging" default:"false"` Duration time.Duration `help:"duration a session is valid for (superseded by inactivity timer delay if inactivity timer is enabled)" default:"168h"` }
SessionConfig contains configurations for session management.
type SetUpAccountRequest ¶ added in v1.94.1
type SetUpAccountRequest struct { IsProfessional bool `json:"isProfessional"` FirstName *string `json:"firstName"` LastName *string `json:"lastName"` FullName *string `json:"fullName"` Position *string `json:"position"` CompanyName *string `json:"companyName"` EmployeeCount *string `json:"employeeCount"` StorageNeeds *string `json:"storageNeeds"` StorageUseCase *string `json:"storageUseCase"` OtherUseCase *string `json:"otherUseCase"` FunctionalArea *string `json:"functionalArea"` HaveSalesContact bool `json:"haveSalesContact"` InterestedInPartnering bool `json:"interestedInPartnering"` }
SetUpAccountRequest holds data for completing account setup.
type SingleCaptchaConfig ¶ added in v1.62.1
type SingleCaptchaConfig struct { Enabled bool `help:"whether or not captcha is enabled" default:"false" json:"enabled"` SiteKey string `help:"captcha site key" json:"siteKey"` SecretKey string `help:"captcha secret key" json:"-"` }
SingleCaptchaConfig contains configurations abstract captcha system.
type StorageLimitConfig ¶ added in v1.34.1
type StorageLimitConfig struct { Free memory.Size `help:"the default free-tier storage usage limit" default:"25.00GB" testDefault:"25.00 GB"` Paid memory.Size `help:"the default paid-tier storage usage limit" default:"100.00TB" testDefault:"25.00 GB"` }
StorageLimitConfig is a configuration struct for default storage per-project usage limits.
type TokenInfo ¶ added in v1.63.1
type TokenInfo struct { consoleauth.Token `json:"token"` ExpiresAt time.Time `json:"expiresAt"` }
TokenInfo holds info for user authentication token responses.
type TrialExpirationEscalationReminderEmail ¶ added in v1.113.1
type TrialExpirationEscalationReminderEmail struct {
SupportLink string
}
TrialExpirationEscalationReminderEmail is mailservice template with trial expiration escalation reminder data.
func (*TrialExpirationEscalationReminderEmail) Subject ¶ added in v1.113.1
func (*TrialExpirationEscalationReminderEmail) Subject() string
Subject gets email subject.
func (*TrialExpirationEscalationReminderEmail) Template ¶ added in v1.113.1
func (*TrialExpirationEscalationReminderEmail) Template() string
Template returns email template name.
type TrialExpirationReminderEmail ¶ added in v1.101.1
type TrialExpirationReminderEmail struct { Origin string SignInLink string ContactInfoURL string ScheduleMeetingLink string }
TrialExpirationReminderEmail is mailservice template with trial expiration reminder data.
func (*TrialExpirationReminderEmail) Subject ¶ added in v1.101.1
func (*TrialExpirationReminderEmail) Subject() string
Subject gets email subject.
func (*TrialExpirationReminderEmail) Template ¶ added in v1.101.1
func (*TrialExpirationReminderEmail) Template() string
Template returns email template name.
type TrialExpiredEmail ¶ added in v1.101.1
type TrialExpiredEmail struct { Origin string SignInLink string ContactInfoURL string ScheduleMeetingLink string }
TrialExpiredEmail is mailservice template with trial expiration data.
func (*TrialExpiredEmail) Subject ¶ added in v1.101.1
func (*TrialExpiredEmail) Subject() string
Subject gets email subject.
func (*TrialExpiredEmail) Template ¶ added in v1.101.1
func (*TrialExpiredEmail) Template() string
Template returns email template name.
type TrialNotificationStatus ¶ added in v1.101.1
type TrialNotificationStatus int
TrialNotificationStatus is an enum representing a type of trial notification.
const ( // NoTrialNotification represents the default state of no email notification sent. NoTrialNotification TrialNotificationStatus = iota // TrialExpirationReminder represents trial expiration reminder has been sent. TrialExpirationReminder // TrialExpired represents trial expired notification has been sent. TrialExpired )
type UnknownResetPasswordEmail ¶ added in v1.62.1
type UnknownResetPasswordEmail struct { Satellite string Email string DoubleCheckLink string ResetPasswordLink string CreateAnAccountLink string SupportTeamLink string }
UnknownResetPasswordEmail is mailservice template with unknown password reset data.
func (*UnknownResetPasswordEmail) Subject ¶ added in v1.62.1
func (*UnknownResetPasswordEmail) Subject() string
Subject gets email subject.
func (*UnknownResetPasswordEmail) Template ¶ added in v1.62.1
func (*UnknownResetPasswordEmail) Template() string
Template returns email template name.
type UnverifiedUserProjectInvitationEmail ¶ added in v1.87.1
type UnverifiedUserProjectInvitationEmail struct { InviterEmail string Region string ActivationLink string }
UnverifiedUserProjectInvitationEmail is mailservice template for project invitation email for unverified users.
func (*UnverifiedUserProjectInvitationEmail) Subject ¶ added in v1.87.1
func (email *UnverifiedUserProjectInvitationEmail) Subject() string
Subject gets email subject.
func (*UnverifiedUserProjectInvitationEmail) Template ¶ added in v1.87.1
func (*UnverifiedUserProjectInvitationEmail) Template() string
Template returns email template name.
type UpdateLimitsInfo ¶ added in v1.107.1
type UpdateLimitsInfo struct { StorageLimit *memory.Size `json:"storageLimit"` BandwidthLimit *memory.Size `json:"bandwidthLimit"` }
UpdateLimitsInfo holds data needed to update project limits.
type UpdateUserRequest ¶ added in v1.58.1
type UpdateUserRequest struct { ExternalID *string FullName *string ShortName **string Position *string CompanyName *string WorkingOn *string IsProfessional *bool HaveSalesContact *bool EmployeeCount *string Email *string PasswordHash []byte Status *UserStatus StatusUpdatedAt *time.Time ProjectLimit *int ProjectStorageLimit *int64 ProjectBandwidthLimit *int64 ProjectSegmentLimit *int64 PaidTier *bool MFAEnabled *bool MFASecretKey **string MFARecoveryCodes *[]string // failed_login_count is nullable, but we don't really have a reason // to set it to NULL, so it doesn't need to be a double pointer here. FailedLoginCount *int FinalInvoiceGenerated *bool LoginLockoutExpiration **time.Time DefaultPlacement storj.PlacementConstraint ActivationCode *string SignupId *string SignupPromoCode *string UserAgent []byte TrialExpiration **time.Time TrialNotifications *TrialNotificationStatus UpgradeTime *time.Time NewUnverifiedEmail **string EmailChangeVerificationStep *int }
UpdateUserRequest contains all columns which are optionally updatable by users.Update.
type UpgradeUserObserver ¶ added in v1.84.1
type UpgradeUserObserver struct {
// contains filtered or unexported fields
}
UpgradeUserObserver used to upgrade user if their balance is more than $10 after confirmed token transaction.
func NewUpgradeUserObserver ¶ added in v1.84.1
func NewUpgradeUserObserver(consoleDB DB, transactionsDB billing.TransactionsDB, usageLimitsConfig UsageLimitsConfig, userBalanceForUpgrade int64, freezeService *AccountFreezeService, analyticsService *analytics.Service) *UpgradeUserObserver
NewUpgradeUserObserver creates new observer instance.
func (*UpgradeUserObserver) Process ¶ added in v1.84.1
func (o *UpgradeUserObserver) Process(ctx context.Context, transaction billing.Transaction) (err error)
Process puts user into the paid tier and converts projects to upgraded limits.
func (*UpgradeUserObserver) TestSetNow ¶ added in v1.99.1
func (o *UpgradeUserObserver) TestSetNow(nowFn func() time.Time)
TestSetNow allows tests to have the observer act as if the current time is whatever they want.
type UpsertProjectInfo ¶ added in v1.86.1
type UpsertProjectInfo struct { Name string `json:"name"` Description string `json:"description"` StorageLimit *memory.Size `json:"storageLimit"` BandwidthLimit *memory.Size `json:"bandwidthLimit"` // these fields are only used for inserts and ignored for updates CreatedAt time.Time `json:"createdAt"` ManagePassphrase bool `json:"managePassphrase"` }
UpsertProjectInfo holds data needed to create/update Project.
type UpsertUserSettingsRequest ¶ added in v1.73.4
type UpsertUserSettingsRequest struct { // The DB stores this value with minute granularity. Finer time units are ignored. SessionDuration **time.Duration OnboardingStart *bool OnboardingEnd *bool PassphrasePrompt *bool OnboardingStep *string NoticeDismissal *NoticeDismissal }
UpsertUserSettingsRequest contains all user settings which are configurable via Users.UpsertSettings.
type UsageLimits ¶ added in v1.70.1
type UsageLimits struct { Storage int64 `json:"storage"` UserSetStorageLimit *int64 `json:"userSetStorageLimit"` Bandwidth int64 `json:"bandwidth"` UserSetBandwidthLimit *int64 `json:"userSetBandwidthLimit"` Segment int64 `json:"segment"` RateLimit *int `json:"rateLimit"` BurstLimit *int `json:"burstLimit"` RateLimitHead *int `json:"rateLimitHead"` RateLimitList *int `json:"rateLimitList"` RateLimitGet *int `json:"rateLimitGet"` RateLimitPut *int `json:"rateLimitPut"` RateLimitDelete *int `json:"rateLimitDelete"` BurstLimitHead *int `json:"burstLimitHead"` BurstLimitList *int `json:"burstLimitList"` BurstLimitGet *int `json:"burstLimitGet"` BurstLimitPut *int `json:"burstLimitPut"` BurstLimitDelete *int `json:"burstLimitDelete"` }
UsageLimits represents storage, bandwidth, and segment limits imposed on an entity.
type UsageLimitsConfig ¶ added in v1.26.2
type UsageLimitsConfig struct { Storage StorageLimitConfig Bandwidth BandwidthLimitConfig Segment SegmentLimitConfig Project ProjectLimitConfig }
UsageLimitsConfig is a configuration struct for default per-project usage limits.
type User ¶
type User struct { ID uuid.UUID `json:"id"` ExternalID *string `json:"-"` FullName string `json:"fullName"` ShortName string `json:"shortName"` Email string `json:"email"` PasswordHash []byte `json:"-"` Status UserStatus `json:"status"` StatusUpdatedAt *time.Time `json:"-"` UserAgent []byte `json:"userAgent"` CreatedAt time.Time `json:"createdAt"` ProjectLimit int `json:"projectLimit"` ProjectStorageLimit int64 `json:"projectStorageLimit"` ProjectBandwidthLimit int64 `json:"projectBandwidthLimit"` ProjectSegmentLimit int64 `json:"projectSegmentLimit"` PaidTier bool `json:"paidTier"` IsProfessional bool `json:"isProfessional"` Position string `json:"position"` CompanyName string `json:"companyName"` CompanySize int `json:"companySize"` WorkingOn string `json:"workingOn"` EmployeeCount string `json:"employeeCount"` HaveSalesContact bool `json:"haveSalesContact"` FinalInvoiceGenerated bool `json:"-"` MFAEnabled bool `json:"mfaEnabled"` MFASecretKey string `json:"-"` MFARecoveryCodes []string `json:"-"` SignupPromoCode string `json:"signupPromoCode"` VerificationReminders int `json:"verificationReminders"` TrialNotifications int `json:"trialNotifications"` FailedLoginCount int `json:"failedLoginCount"` LoginLockoutExpiration time.Time `json:"loginLockoutExpiration"` SignupCaptcha *float64 `json:"-"` DefaultPlacement storj.PlacementConstraint `json:"defaultPlacement"` ActivationCode string `json:"-"` SignupId string `json:"-"` TrialExpiration *time.Time `json:"trialExpiration"` UpgradeTime *time.Time `json:"upgradeTime"` NewUnverifiedEmail *string `json:"-"` EmailChangeVerificationStep int `json:"-"` }
User is a database object that describes User entity.
type UserCursor ¶ added in v1.92.1
UserCursor holds info for user info cursor pagination.
type UserFreezeEvents ¶ added in v1.90.1
type UserFreezeEvents struct {
BillingFreeze, BillingWarning, ViolationFreeze, LegalFreeze, DelayedBotFreeze, BotFreeze, TrialExpirationFreeze *AccountFreezeEvent
}
UserFreezeEvents holds the freeze events for a user.
type UserSettings ¶ added in v1.73.4
type UserSettings struct { SessionDuration *time.Duration `json:"sessionDuration"` OnboardingStart bool `json:"onboardingStart"` OnboardingEnd bool `json:"onboardingEnd"` PassphrasePrompt bool `json:"passphrasePrompt"` OnboardingStep *string `json:"onboardingStep"` NoticeDismissal NoticeDismissal `json:"noticeDismissal"` }
UserSettings contains configurations for a user.
type UserStatus ¶
type UserStatus int
UserStatus - is used to indicate status of the users account.
const ( // Inactive is a status that user receives after registration. Inactive UserStatus = 0 // Active is a status that user receives after account activation. Active UserStatus = 1 // Deleted is a status that user receives after deleting account. Deleted UserStatus = 2 // PendingDeletion is a status that user receives before deleting account. PendingDeletion UserStatus = 3 // LegalHold is a status that user receives for legal reasons. LegalHold UserStatus = 4 // PendingBotVerification is a status that user receives after account activation but with high captcha score. PendingBotVerification UserStatus = 5 // UserRequestedDeletion is a status that user receives after account owner completed delete account flow. UserRequestedDeletion UserStatus = 6 )
func (UserStatus) String ¶ added in v1.94.1
func (s UserStatus) String() string
String returns a string representation of the user status.
type Users ¶
type Users interface { // Get is a method for querying user from the database by id. Get(ctx context.Context, id uuid.UUID) (*User, error) // GetExpiredFreeTrialsAfter is a method for querying users that are in free trial from the database with trial expiry (after) // AND have not been frozen. GetExpiredFreeTrialsAfter(ctx context.Context, after time.Time, limit int) ([]User, error) // GetExpiresBeforeWithStatus returns users with a particular trial notification status and whose trial expires before 'expiresBefore'. GetExpiresBeforeWithStatus(ctx context.Context, notificationStatus TrialNotificationStatus, expiresBefore time.Time) ([]*User, error) // GetUnverifiedNeedingReminder gets unverified users needing a reminder to verify their email. GetUnverifiedNeedingReminder(ctx context.Context, firstReminder, secondReminder, cutoff time.Time) ([]*User, error) // GetEmailsForDeletion is a method for querying user account emails which were requested for deletion by the user and can be deleted. GetEmailsForDeletion(ctx context.Context, statusUpdatedBefore time.Time) ([]string, error) // UpdateVerificationReminders increments verification_reminders. UpdateVerificationReminders(ctx context.Context, id uuid.UUID) error // UpdateFailedLoginCountAndExpiration increments failed_login_count and sets login_lockout_expiration appropriately. UpdateFailedLoginCountAndExpiration(ctx context.Context, failedLoginPenalty *float64, id uuid.UUID, now time.Time) error // GetByEmailWithUnverified is a method for querying users by email from the database. GetByEmailWithUnverified(ctx context.Context, email string) (verified *User, unverified []User, err error) // GetByExternalID is a method for querying user by external ID from the database. GetByExternalID(ctx context.Context, externalID string) (user *User, err error) // GetByStatus is a method for querying user by status from the database. GetByStatus(ctx context.Context, status UserStatus, cursor UserCursor) (*UsersPage, error) // GetUserInfoByProjectID gets the user info of the project (id) owner. GetUserInfoByProjectID(ctx context.Context, id uuid.UUID) (*UserInfo, error) // GetByEmail is a method for querying user by verified email from the database. GetByEmail(ctx context.Context, email string) (*User, error) // Insert is a method for inserting user into the database. Insert(ctx context.Context, user *User) (*User, error) // Delete is a method for deleting user by ID from the database. Delete(ctx context.Context, id uuid.UUID) error // DeleteUnverifiedBefore deletes unverified users created prior to some time from the database. DeleteUnverifiedBefore(ctx context.Context, before time.Time, asOfSystemTimeInterval time.Duration, pageSize int) error // Update is a method for updating user entity. Update(ctx context.Context, userID uuid.UUID, request UpdateUserRequest) error // UpdatePaidTier sets whether the user is in the paid tier. UpdatePaidTier(ctx context.Context, id uuid.UUID, paidTier bool, projectBandwidthLimit, projectStorageLimit memory.Size, projectSegmentLimit int64, projectLimit int, upgradeTime *time.Time) error // UpdateUserAgent is a method to update the user's user agent. UpdateUserAgent(ctx context.Context, id uuid.UUID, userAgent []byte) error // UpdateUserProjectLimits is a method to update the user's usage limits for new projects. UpdateUserProjectLimits(ctx context.Context, id uuid.UUID, limits UsageLimits) error // UpdateDefaultPlacement is a method to update the user's default placement for new projects. UpdateDefaultPlacement(ctx context.Context, id uuid.UUID, placement storj.PlacementConstraint) error // GetProjectLimit is a method to get the users project limit GetProjectLimit(ctx context.Context, id uuid.UUID) (limit int, err error) // GetUserProjectLimits is a method to get the users storage and bandwidth limits for new projects. GetUserProjectLimits(ctx context.Context, id uuid.UUID) (limit *ProjectLimits, err error) // GetUserPaidTier is a method to gather whether the specified user is on the Paid Tier or not. GetUserPaidTier(ctx context.Context, id uuid.UUID) (isPaid bool, err error) // GetSettings is a method for returning a user's set of configurations. GetSettings(ctx context.Context, userID uuid.UUID) (*UserSettings, error) // GetUpgradeTime is a method for returning a user's upgrade time. GetUpgradeTime(ctx context.Context, userID uuid.UUID) (*time.Time, error) // UpsertSettings is a method for updating a user's set of configurations if it exists and inserting it otherwise. UpsertSettings(ctx context.Context, userID uuid.UUID, settings UpsertUserSettingsRequest) error }
Users exposes methods to manage User table in database.
architecture: Database
type UsersPage ¶ added in v1.92.1
type UsersPage struct { Users []User `json:"users"` Limit uint `json:"limit"` Offset uint64 `json:"offset"` PageCount uint `json:"pageCount"` CurrentPage uint `json:"currentPage"` TotalCount uint64 `json:"totalCount"` }
UsersPage represent user info page result.
type VersioningOptInStatus ¶ added in v1.102.2
type VersioningOptInStatus string
VersioningOptInStatus is a type for versioning beta opt in status.
const ( // VersioningOptIn is a status for opting in. VersioningOptIn VersioningOptInStatus = "in" // VersioningOptOut is a status for opting out. VersioningOptOut VersioningOptInStatus = "out" )
type WalletInfo ¶ added in v1.56.1
type WalletInfo struct { Address blockchain.Address `json:"address"` Balance currency.Amount `json:"balance"` }
WalletInfo contains all the information about a destination wallet assigned to a user.
type WalletPayments ¶ added in v1.62.1
type WalletPayments struct {
Payments []PaymentInfo `json:"payments"`
}
WalletPayments represents the list of ERC-20 token payments.
Source Files ¶
- accountfreezes.go
- apikeys.go
- billinghistoryitem.go
- bucketmetadata.go
- captcha.go
- config.go
- database.go
- mail.go
- mfa.go
- observerpayinvoicewithtokens.go
- observerupgradeuser.go
- projectinvitations.go
- projectmembers.go
- projects.go
- projectusagelimits.go
- registrationtoken.go
- request.go
- resetpasswordtoken.go
- service.go
- sortdirection.go
- users.go
- validation.go