Documentation
¶
Index ¶
- Constants
- Variables
- func MakeVerificationNonce() string
- type AdminAPIDefaultDomainService
- type AdminAPIService
- func (s *AdminAPIService) Director(ctx context.Context, appID string, p string, actorUserID string, usage Usage) (director func(*http.Request), err error)
- func (s *AdminAPIService) ResolveConfig(ctx context.Context, appID string) (cfg *config.Config, err error)
- func (s *AdminAPIService) ResolveEndpoint(appID string) (*url.URL, error)
- func (s *AdminAPIService) SelfDirector(ctx context.Context, actorUserID string, usage Usage) (director func(*http.Request), err error)
- type AppAuthzService
- type AppConfigService
- type AppConfigSourceStore
- type AppDefaultDomainService
- type AppPlanService
- type AppResourceManagerFactory
- type AppSecretVisitTokenStore
- type AppService
- func (s *AppService) Create(ctx context.Context, userID string, id string) (*model.App, error)
- func (s *AppService) GenerateSecretVisitToken(ctx context.Context, app *model.App, sessionInfo *apimodel.SessionInfo, ...) (*appsecret.AppSecretVisitToken, error)
- func (s *AppService) GenerateTesterToken(ctx context.Context, app *model.App, returnURI string) (*tester.TesterToken, error)
- func (s *AppService) Get(ctx context.Context, id string) (*model.App, error)
- func (s *AppService) GetAppList(ctx context.Context, userID string) ([]*model.AppListItem, error)
- func (s *AppService) GetMany(ctx context.Context, ids []string) (out []*model.App, err error)
- func (s *AppService) GetManyProjectQuota(ctx context.Context, userIDs []string) ([]int, error)
- func (s *AppService) GetProjectQuota(ctx context.Context, userID string) (int, error)
- func (s *AppService) LoadAppSecretConfig(ctx context.Context, app *model.App, sessionInfo *apimodel.SessionInfo, ...) (*model.SecretConfig, string, error)
- func (s *AppService) LoadAppWebhookSecretMaterials(ctx context.Context, app *model.App) (*config.WebhookKeyMaterials, error)
- func (s *AppService) LoadEffectiveSecretConfig(ctx context.Context, app *model.App) (*model.EffectiveSecretConfig, error)
- func (s *AppService) LoadRawAppConfig(ctx context.Context, app *model.App) (*config.AppConfig, string, error)
- func (s *AppService) RenderSAMLEntityID(appID string) string
- func (s *AppService) UpdateResources(ctx context.Context, app *model.App, updates []appresource.Update) error
- func (s *AppService) UpdateResources0(ctx context.Context, app *model.App, updates []appresource.Update) error
- type AppTesterTokenStore
- type AuditService
- type AuditServiceAppService
- type AuthzAdder
- type AuthzCollaboratorService
- type AuthzConfigService
- type AuthzService
- func (s *AuthzService) AddAuthorizedUser(ctx context.Context, appID string, userID string, role model.CollaboratorRole) error
- func (s *AuthzService) CheckAccessOfViewer(ctx context.Context, appID string) (userID string, err error)
- func (s *AuthzService) ListAuthorizedApps(ctx context.Context, userID string) ([]string, error)
- type CollaboratorAppConfigService
- type CollaboratorService
- func (s *CollaboratorService) AcceptInvitation(ctx context.Context, code string) (*model.Collaborator, error)
- func (s *CollaboratorService) CheckInviteeEmail(ctx context.Context, i *model.CollaboratorInvitation, actorID string) error
- func (s *CollaboratorService) CreateCollaborator(ctx context.Context, c *model.Collaborator) error
- func (s *CollaboratorService) DeleteCollaborator(ctx context.Context, c *model.Collaborator) error
- func (s *CollaboratorService) DeleteInvitation(ctx context.Context, i *model.CollaboratorInvitation) error
- func (s *CollaboratorService) GetCollaborator(ctx context.Context, id string) (*model.Collaborator, error)
- func (s *CollaboratorService) GetCollaboratorByAppAndUser(ctx context.Context, appID string, userID string) (*model.Collaborator, error)
- func (s *CollaboratorService) GetInvitation(ctx context.Context, id string) (*model.CollaboratorInvitation, error)
- func (s *CollaboratorService) GetInvitationWithCode(ctx context.Context, code string) (*model.CollaboratorInvitation, error)
- func (s *CollaboratorService) GetManyCollaborators(ctx context.Context, ids []string) ([]*model.Collaborator, error)
- func (s *CollaboratorService) GetManyInvitations(ctx context.Context, ids []string) ([]*model.CollaboratorInvitation, error)
- func (s *CollaboratorService) GetManyProjectOwnerCount(ctx context.Context, userIDs []string) ([]int, error)
- func (s *CollaboratorService) GetProjectOwnerCount(ctx context.Context, userID string) (int, error)
- func (s *CollaboratorService) ListCollaborators(ctx context.Context, appID string) ([]*model.Collaborator, error)
- func (s *CollaboratorService) ListCollaboratorsByUser(ctx context.Context, userID string) ([]*model.Collaborator, error)
- func (s *CollaboratorService) ListInvitations(ctx context.Context, appID string) ([]*model.CollaboratorInvitation, error)
- func (s *CollaboratorService) NewCollaborator(appID string, userID string, role model.CollaboratorRole) *model.Collaborator
- func (s *CollaboratorService) SendInvitation(ctx context.Context, appID string, inviteeEmail string) (*model.CollaboratorInvitation, error)
- type CollaboratorServiceAdminAPIService
- type CollaboratorServiceEndpointsProvider
- type CollaboratorServiceSMTPService
- type ConfigService
- func (s *ConfigService) Create(ctx context.Context, opts *CreateAppOptions) error
- func (s *ConfigService) CreateDomain(ctx context.Context, appID string, domainID string, domain string, ...) error
- func (s *ConfigService) DeleteDomain(ctx context.Context, domain *apimodel.Domain) error
- func (s *ConfigService) GetStaticAppIDs() ([]string, error)
- func (s *ConfigService) ResolveContext(ctx context.Context, appID string, ...) error
- func (s *ConfigService) UpdateResources(ctx context.Context, appID string, files []*resource.ResourceFile) error
- type CreateAppOptions
- type DefaultDomainDomainService
- type DefaultDomainService
- type DomainConfigService
- type DomainService
- func (s *DomainService) CreateCustomDomain(ctx context.Context, appID string, domain string) (*apimodel.Domain, error)
- func (s *DomainService) CreateDomain(ctx context.Context, appID string, domain string, isVerified bool, ...) (*apimodel.Domain, error)
- func (s *DomainService) DeleteDomain(ctx context.Context, appID string, id string) error
- func (s *DomainService) GetMany(ctx context.Context, ids []string) ([]*apimodel.Domain, error)
- func (s *DomainService) ListDomains(ctx context.Context, appID string) ([]*apimodel.Domain, error)
- func (s *DomainService) VerifyDomain(ctx context.Context, appID string, id string) (*apimodel.Domain, error)
- type HTTPClient
- type IngressTemplateData
- type Kubernetes
- type KubernetesResource
- type NoopAttributesService
- type NoopRolesAndGroupsService
- type OnboardService
- type OnboardServiceAdminAPIService
- type OnboardServicePosthogService
- type PortalAdminAPIAuthContext
- type ResourceManager
- type ResourceTemplateData
- type SubscriptionConfigSourceStore
- type SubscriptionPlanStore
- type SubscriptionService
- func (s *SubscriptionService) ArchiveSubscription0(ctx context.Context, sub *model.Subscription) error
- func (s *SubscriptionService) CreateSubscriptionCheckout(ctx context.Context, checkoutSession *libstripe.CheckoutSession) (*model.SubscriptionCheckout, error)
- func (s *SubscriptionService) GetLastProcessingCustomerID(ctx context.Context, appID string) (*string, error)
- func (s *SubscriptionService) GetSubscription(ctx context.Context, appID string) (*model.Subscription, error)
- func (s *SubscriptionService) GetSubscription0(ctx context.Context, appID string) (*model.Subscription, error)
- func (s *SubscriptionService) GetSubscriptionUsage(ctx context.Context, appID string, planName string, date time.Time, ...) (*model.SubscriptionUsage, error)
- func (s *SubscriptionService) MarkCheckoutCancelled0(ctx context.Context, appID string, customerID string) error
- func (s *SubscriptionService) MarkCheckoutCompleted(ctx context.Context, appID string, stripCheckoutSessionID string, ...) error
- func (s *SubscriptionService) MarkCheckoutExpired(ctx context.Context, appID string, customerID string) error
- func (s *SubscriptionService) MarkCheckoutSubscribed0(ctx context.Context, appID string, customerID string) error
- func (s *SubscriptionService) SetSubscriptionCancelledStatus(ctx context.Context, id string, cancelled bool, endedAt *time.Time) error
- func (s *SubscriptionService) UpdateAppPlan(ctx context.Context, appID string, planName string) error
- func (s *SubscriptionService) UpdateAppPlan0(ctx context.Context, appID string, planName string) error
- func (s *SubscriptionService) UpdateAppPlanToDefault0(ctx context.Context, appID string) error
- func (s *SubscriptionService) UpsertSubscription0(ctx context.Context, appID string, stripeSubscriptionID string, ...) (*model.Subscription, error)
- type SubscriptionUsageStore
- type SystemConfigProvider
- type TokenService
- type Usage
- type UsageService
- type UsageUsageStore
Constants ¶
const AUTHGEARONCE = false
const DefaultPrivacyPolicyLink string = "https://www.authgear.com/data-privacy"
const DefaultTermsOfServiceLink string = "https://www.authgear.com/terms"
const DomainVerificationTimeout = 10 * time.Second
const SecretVisitTokenValidDuration = duration.Short
const SecretVisitTokenVisibleSecrets string = "visible_secrets"
Variables ¶
var AppServiceLogger = slogutil.NewLogger("app-service")
var AuthgearDependencySet = wire.NewSet( wire.FieldsOf(new(*model.App), "Context", ), wire.FieldsOf(new(*config.AppContext), "Resources", "Config", ), wire.Value(&NoopAttributesService{}), wire.Value(&NoopRolesAndGroupsService{}), auditdb.NewWriteHandle, deps.ConfigDeps, clock.DependencySet, auditdb.DependencySet, audit.DependencySet, hook.DependencySet, wire.Bind(new(hook.ResourceManager), new(*resource.Manager)), wire.Bind(new(hook.StandardAttributesServiceNoEvent), new(*NoopAttributesService)), wire.Bind(new(hook.CustomAttributesServiceNoEvent), new(*NoopAttributesService)), wire.Bind(new(hook.RolesAndGroupsServiceNoEvent), new(*NoopRolesAndGroupsService)), )
var DependencySet = wire.NewSet( appsecret.DependencySet, tester.DependencySet, NewHTTPClient, wire.Struct(new(AppService), "*"), wire.Struct(new(AdminAPIService), "*"), wire.Struct(new(AuthzService), "*"), wire.Struct(new(ConfigService), "*"), wire.Struct(new(Kubernetes), "*"), wire.Struct(new(DomainService), "*"), wire.Struct(new(DefaultDomainService), "*"), wire.Struct(new(CollaboratorService), "*"), wire.Struct(new(SystemConfigProvider), "*"), wire.Struct(new(SubscriptionService), "*"), wire.Struct(new(UsageService), "*"), wire.Struct(new(AuditService), "*"), wire.Struct(new(OnboardService), "*"), wire.Struct(new(TokenService), "*"), wire.Bind(new(AppAuthzService), new(*AuthzService)), wire.Bind(new(AppConfigService), new(*ConfigService)), wire.Bind(new(CollaboratorAppConfigService), new(*ConfigService)), wire.Bind(new(AuthzConfigService), new(*ConfigService)), wire.Bind(new(AuthzCollaboratorService), new(*CollaboratorService)), wire.Bind(new(DomainConfigService), new(*ConfigService)), wire.Bind(new(AppSecretVisitTokenStore), new(*appsecret.AppSecretVisitTokenStoreImpl)), wire.Bind(new(AppTesterTokenStore), new(*tester.TesterStore)), wire.Bind(new(AppDefaultDomainService), new(*DefaultDomainService)), wire.Bind(new(AdminAPIDefaultDomainService), new(*DefaultDomainService)), wire.Bind(new(DefaultDomainDomainService), new(*DomainService)), wire.Bind(new(AuditServiceAppService), new(*AppService)), )
var DomainVerificationFailed = apierrors.Forbidden.WithReason("DomainVerificationFailed")
var ErrAppIDInvalid = apierrors.Invalid.WithReason("InvalidAppID").
New("invalid app ID")
var ErrAppIDReserved = apierrors.Forbidden.WithReason("AppIDReserved").
New("requested app ID is reserved")
var ErrCollaboratorDuplicate = apierrors.AlreadyExists.WithReason("CollaboratorDuplicate").New("collaborator duplicate")
var ErrCollaboratorInvitationDuplicate = apierrors.AlreadyExists.WithReason("CollaboratorInvitationDuplicate").New("collaborator invitation duplicate")
var ErrCollaboratorInvitationInvalidCode = apierrors.Invalid.WithReason("CollaboratorInvitationInvalidCode").New("collaborator invitation invalid code")
var ErrCollaboratorInvitationInvalidEmail = apierrors.Invalid.WithReason("CollaboratorInvitationInvalidEmail").New("the email with the actor does match the invitee email")
var ErrCollaboratorInvitationNotFound = apierrors.NotFound.WithReason("CollaboratorInvitationNotFound").New("collaborator invitation not found")
var ErrCollaboratorNotFound = apierrors.NotFound.WithReason("CollaboratorNotFound").New("collaborator not found")
var ErrCollaboratorQuotaExceeded = apierrors.Invalid.WithReason("CollaboratorQuotaExceeded").New("collaborator quota exceeded")
var ErrCollaboratorSelfDeletion = apierrors.Forbidden.WithReason("CollaboratorSelfDeletion").New("cannot remove self from collaborator")
var ErrDomainDuplicated = apierrors.AlreadyExists.WithReason("DuplicatedDomain").
New("requested domain is already in use")
var ErrDomainNotCustom = apierrors.Forbidden.WithReason("DomainNotCustom").
New("requested domain is not a custom domain")
var ErrDomainNotFound = apierrors.NotFound.WithReason("DomainNotFound").
New("domain not found")
var ErrDomainVerified = apierrors.AlreadyExists.WithReason("DomainVerified").
New("requested domain is already verified")
var ErrDuplicatedAppID = apierrors.AlreadyExists.WithReason("DuplicatedAppID").
New("duplicated app ID")
var ErrForbidden = apierrors.Forbidden.WithReason("Forbidden").New("forbidden")
var ErrGetStaticAppIDsNotSupported = errors.New("only local FS config source can get static app ID")
var ErrHostSuffixNotConfigured = errors.New("host suffix not configured")
var ErrReauthRequrired = apierrors.Forbidden.WithReason("ReauthRequrired").
New("reauthentication required")
var ErrSubscriptionCheckoutNotFound = apierrors.NotFound.WithReason("ErrSubscriptionCheckoutNotFound").
New("subscription checkout not found")
var ErrSubscriptionNotFound = apierrors.NotFound.WithReason("ErrSubscriptionNotFound").New("subscription not found")
var ErrUnauthenticated = apierrors.Unauthorized.WithReason("Unauthenticated").New("unauthenticated")
var InvalidDomain = apierrors.Invalid.WithReason("InvalidDomain")
var KubernetesLogger = slogutil.NewLogger("kubernetes")
var LabelAppID = "authgear.com/app-id"
var LabelDomainID = "authgear.com/domain-id"
Functions ¶
func MakeVerificationNonce ¶
func MakeVerificationNonce() string
Types ¶
type AdminAPIService ¶
type AdminAPIService struct {
AuthgearConfig *portalconfig.AuthgearConfig
AdminAPIConfig *portalconfig.AdminAPIConfig
ConfigSource *configsource.ConfigSource
AuthzAdder AuthzAdder
DefaultDomains AdminAPIDefaultDomainService
}
func (*AdminAPIService) ResolveConfig ¶
func (*AdminAPIService) ResolveEndpoint ¶
func (s *AdminAPIService) ResolveEndpoint(appID string) (*url.URL, error)
func (*AdminAPIService) SelfDirector ¶
type AppAuthzService ¶
type AppConfigService ¶
type AppConfigSourceStore ¶
type AppConfigSourceStore interface {
ListAll(ctx context.Context) ([]*configsource.DatabaseSource, error)
}
type AppDefaultDomainService ¶
type AppPlanService ¶
type AppResourceManagerFactory ¶
type AppResourceManagerFactory interface {
NewManagerWithNewAppFS(appFs resource.Fs) *appresource.Manager
NewManagerWithAppContext(appContext *config.AppContext) *appresource.Manager
}
type AppService ¶
type AppService struct {
SQLBuilder *globaldb.SQLBuilder
SQLExecutor *globaldb.SQLExecutor
GlobalDatabase *globaldb.Handle
AppConfig *portalconfig.AppConfig
AppConfigs AppConfigService
AppAuthz AppAuthzService
DefaultDomains AppDefaultDomainService
Resources ResourceManager
AppResMgrFactory AppResourceManagerFactory
Plan AppPlanService
Clock clock.Clock
AppSecretVisitTokenStore AppSecretVisitTokenStore
AppTesterTokenStore AppTesterTokenStore
SAMLEnvironmentConfig config.SAMLEnvironmentConfig
ConfigSourceStore AppConfigSourceStore
}
func (*AppService) Create ¶
Create calls other services that acquires connection themselves, and acquires connection.
func (*AppService) GenerateSecretVisitToken ¶
func (s *AppService) GenerateSecretVisitToken( ctx context.Context, app *model.App, sessionInfo *apimodel.SessionInfo, visitingSecrets []config.SecretKey, ) (*appsecret.AppSecretVisitToken, error)
GenerateSecretVisitToken does not need connection.
func (*AppService) GenerateTesterToken ¶
func (s *AppService) GenerateTesterToken( ctx context.Context, app *model.App, returnURI string, ) (*tester.TesterToken, error)
GenerateTesterToken does not need connection.
func (*AppService) GetAppList ¶
func (s *AppService) GetAppList(ctx context.Context, userID string) ([]*model.AppListItem, error)
GetAppList calls other services that acquires connection themselves.
func (*AppService) GetManyProjectQuota ¶
GetManyProjectQuota acquires connection.
func (*AppService) GetProjectQuota ¶
GetProjectQuota acquires connection.
func (*AppService) LoadAppSecretConfig ¶
func (s *AppService) LoadAppSecretConfig( ctx context.Context, app *model.App, sessionInfo *apimodel.SessionInfo, token string) (*model.SecretConfig, string, error)
LoadAppSecretConfig does not need connection.
func (*AppService) LoadAppWebhookSecretMaterials ¶
func (s *AppService) LoadAppWebhookSecretMaterials( ctx context.Context, app *model.App) (*config.WebhookKeyMaterials, error)
func (*AppService) LoadEffectiveSecretConfig ¶
func (s *AppService) LoadEffectiveSecretConfig(ctx context.Context, app *model.App) (*model.EffectiveSecretConfig, error)
LoadEffectiveSecretConfig does not need connection.
func (*AppService) LoadRawAppConfig ¶
func (s *AppService) LoadRawAppConfig(ctx context.Context, app *model.App) (*config.AppConfig, string, error)
LoadRawAppConfig does not need connection.
func (*AppService) RenderSAMLEntityID ¶
func (s *AppService) RenderSAMLEntityID(appID string) string
func (*AppService) UpdateResources ¶
func (s *AppService) UpdateResources(ctx context.Context, app *model.App, updates []appresource.Update) error
UpdateResources acquires connection.
func (*AppService) UpdateResources0 ¶
func (s *AppService) UpdateResources0(ctx context.Context, app *model.App, updates []appresource.Update) error
UpdateResources0 assumes acquired connection.
type AppTesterTokenStore ¶
type AuditService ¶
type AuditService struct {
RemoteIP httputil.RemoteIP
UserAgentString httputil.UserAgentString
HTTPRequestURL httputil.HTTPRequestURL
Request *http.Request
Apps AuditServiceAppService
Authgear *portalconfig.AuthgearConfig
Database *db.Pool
DatabaseEnvironmentConfig *config.DatabaseEnvironmentConfig
DenoEndpoint config.DenoEndpoint
GlobalSQLBuilder *globaldb.SQLBuilder
GlobalSQLExecutor *globaldb.SQLExecutor
GlobalDatabase *globaldb.Handle
Clock clock.Clock
}
func (*AuditService) Log ¶
func (s *AuditService) Log(ctx context.Context, app *model.App, payload event.NonBlockingPayload) (err error)
type AuditServiceAppService ¶
type AuthzAdder ¶
type AuthzAdder interface {
AddAuthz(
auth config.AdminAPIAuth,
appID config.AppID,
authKey *config.AdminAPIAuthKey,
auditContext interface{},
hdr http.Header) (err error)
}
type AuthzCollaboratorService ¶
type AuthzCollaboratorService interface {
NewCollaborator(appID string, userID string, role model.CollaboratorRole) *model.Collaborator
CreateCollaborator(ctx context.Context, c *model.Collaborator) error
ListCollaboratorsByUser(ctx context.Context, userID string) ([]*model.Collaborator, error)
GetCollaboratorByAppAndUser(ctx context.Context, appID string, userID string) (*model.Collaborator, error)
}
type AuthzConfigService ¶
type AuthzService ¶
type AuthzService struct {
Configs AuthzConfigService
Collaborators AuthzCollaboratorService
}
func (*AuthzService) AddAuthorizedUser ¶
func (s *AuthzService) AddAuthorizedUser(ctx context.Context, appID string, userID string, role model.CollaboratorRole) error
AddAuthorizedUser assume acquired connection.
func (*AuthzService) CheckAccessOfViewer ¶
func (s *AuthzService) CheckAccessOfViewer(ctx context.Context, appID string) (userID string, err error)
CheckAccessOfViewer calls other services that acquires connection themselves.
func (*AuthzService) ListAuthorizedApps ¶
ListAuthorizedApps calls other services that acquires connection themselves.
type CollaboratorService ¶
type CollaboratorService struct {
Clock clock.Clock
SQLBuilder *globaldb.SQLBuilder
SQLExecutor *globaldb.SQLExecutor
HTTPClient HTTPClient
GlobalDatabase *globaldb.Handle
MailConfig *portalconfig.MailConfig
SMTPService CollaboratorServiceSMTPService
Endpoints CollaboratorServiceEndpointsProvider
TemplateEngine *template.Engine
AdminAPI CollaboratorServiceAdminAPIService
AppConfigs CollaboratorAppConfigService
}
func (*CollaboratorService) AcceptInvitation ¶
func (s *CollaboratorService) AcceptInvitation(ctx context.Context, code string) (*model.Collaborator, error)
AcceptInvitation acquires connection.
func (*CollaboratorService) CheckInviteeEmail ¶
func (s *CollaboratorService) CheckInviteeEmail(ctx context.Context, i *model.CollaboratorInvitation, actorID string) error
CheckInviteeEmail calls HTTP request.
func (*CollaboratorService) CreateCollaborator ¶
func (s *CollaboratorService) CreateCollaborator(ctx context.Context, c *model.Collaborator) error
CreateCollaborator assume acquired connection.
func (*CollaboratorService) DeleteCollaborator ¶
func (s *CollaboratorService) DeleteCollaborator(ctx context.Context, c *model.Collaborator) error
DeleteCollaborator acquires connection.
func (*CollaboratorService) DeleteInvitation ¶
func (s *CollaboratorService) DeleteInvitation(ctx context.Context, i *model.CollaboratorInvitation) error
DeleteInvitation acquires connection.
func (*CollaboratorService) GetCollaborator ¶
func (s *CollaboratorService) GetCollaborator(ctx context.Context, id string) (*model.Collaborator, error)
GetCollaborator acquires connection.
func (*CollaboratorService) GetCollaboratorByAppAndUser ¶
func (s *CollaboratorService) GetCollaboratorByAppAndUser(ctx context.Context, appID string, userID string) (*model.Collaborator, error)
GetCollaboratorByAppAndUser acquires connection.
func (*CollaboratorService) GetInvitation ¶
func (s *CollaboratorService) GetInvitation(ctx context.Context, id string) (*model.CollaboratorInvitation, error)
GetInvitation acquires connection.
func (*CollaboratorService) GetInvitationWithCode ¶
func (s *CollaboratorService) GetInvitationWithCode(ctx context.Context, code string) (*model.CollaboratorInvitation, error)
GetInvitationWithCode acquires connection.
func (*CollaboratorService) GetManyCollaborators ¶
func (s *CollaboratorService) GetManyCollaborators(ctx context.Context, ids []string) ([]*model.Collaborator, error)
GetManyCollaborators acquires connection.
func (*CollaboratorService) GetManyInvitations ¶
func (s *CollaboratorService) GetManyInvitations(ctx context.Context, ids []string) ([]*model.CollaboratorInvitation, error)
GetManyInvitations acquires connection.
func (*CollaboratorService) GetManyProjectOwnerCount ¶
func (s *CollaboratorService) GetManyProjectOwnerCount(ctx context.Context, userIDs []string) ([]int, error)
GetManyProjectOwnerCount acquires connection.
func (*CollaboratorService) GetProjectOwnerCount ¶
GetProjectOwnerCount acquires connection.
func (*CollaboratorService) ListCollaborators ¶
func (s *CollaboratorService) ListCollaborators(ctx context.Context, appID string) ([]*model.Collaborator, error)
ListCollaborators acquires connection.
func (*CollaboratorService) ListCollaboratorsByUser ¶
func (s *CollaboratorService) ListCollaboratorsByUser(ctx context.Context, userID string) ([]*model.Collaborator, error)
ListCollaboratorsByUser acquires connection.
func (*CollaboratorService) ListInvitations ¶
func (s *CollaboratorService) ListInvitations(ctx context.Context, appID string) ([]*model.CollaboratorInvitation, error)
ListInvitations acquires connection.
func (*CollaboratorService) NewCollaborator ¶
func (s *CollaboratorService) NewCollaborator(appID string, userID string, role model.CollaboratorRole) *model.Collaborator
NewCollaborator does not need connection.
func (*CollaboratorService) SendInvitation ¶
func (s *CollaboratorService) SendInvitation( ctx context.Context, appID string, inviteeEmail string, ) (*model.CollaboratorInvitation, error)
SendInvitation acquires connection.
type CollaboratorServiceSMTPService ¶
type CollaboratorServiceSMTPService interface {
SendRealEmail(ctx context.Context, opts mail.SendOptions) error
}
type ConfigService ¶
type ConfigService struct {
AppConfig *portalconfig.AppConfig
Controller *configsource.Controller
ConfigSource *configsource.ConfigSource
DomainImplementation portalconfig.DomainImplementationType
Kubernetes *Kubernetes
}
func (*ConfigService) Create ¶
func (s *ConfigService) Create(ctx context.Context, opts *CreateAppOptions) error
Create assumes acquired connection.
func (*ConfigService) CreateDomain ¶
func (s *ConfigService) CreateDomain(ctx context.Context, appID string, domainID string, domain string, isCustom bool) error
CreateDomain does not need connection.
func (*ConfigService) DeleteDomain ¶
DeleteDomain does not need connection.
func (*ConfigService) GetStaticAppIDs ¶
func (s *ConfigService) GetStaticAppIDs() ([]string, error)
GetStaticAppIDs does not need connection.
func (*ConfigService) ResolveContext ¶
func (s *ConfigService) ResolveContext(ctx context.Context, appID string, fn func(context.Context, *config.AppContext) error) error
ResolveContext calls other services that acquires connection themselves.
func (*ConfigService) UpdateResources ¶
func (s *ConfigService) UpdateResources(ctx context.Context, appID string, files []*resource.ResourceFile) error
UpdateResources assumes acquired connection.
type CreateAppOptions ¶
type DefaultDomainService ¶
type DefaultDomainService struct {
AppHostSuffixes config.AppHostSuffixes
AppConfig *portalconfig.AppConfig
Domains DefaultDomainDomainService
}
func (*DefaultDomainService) CreateAllDefaultDomains ¶
func (s *DefaultDomainService) CreateAllDefaultDomains(ctx context.Context, appID string) error
CreateAllDefaultDomains assume acquired connection.
func (*DefaultDomainService) GetLatestAppHost ¶
func (s *DefaultDomainService) GetLatestAppHost(appID string) (string, error)
GetLatestAppHost does not need connection.
type DomainConfigService ¶
type DomainService ¶
type DomainService struct {
Clock clock.Clock
DomainConfig DomainConfigService
SQLBuilder *globaldb.SQLBuilder
SQLExecutor *globaldb.SQLExecutor
GlobalDatabase *globaldb.Handle
}
func (*DomainService) CreateCustomDomain ¶
func (s *DomainService) CreateCustomDomain(ctx context.Context, appID string, domain string) (*apimodel.Domain, error)
CreateCustomDomain acquires connection.
func (*DomainService) CreateDomain ¶
func (s *DomainService) CreateDomain(ctx context.Context, appID string, domain string, isVerified bool, isCustom bool) (*apimodel.Domain, error)
CreateDomain assumes acquired connection.
func (*DomainService) DeleteDomain ¶
DeleteDomain assumes acquired connection.
func (*DomainService) ListDomains ¶
ListDomains acquires connection.
func (*DomainService) VerifyDomain ¶
func (s *DomainService) VerifyDomain(ctx context.Context, appID string, id string) (*apimodel.Domain, error)
VerifyDomain acquires connection.
type HTTPClient ¶
func NewHTTPClient ¶
func NewHTTPClient() HTTPClient
type IngressTemplateData ¶
type Kubernetes ¶
type Kubernetes struct {
KubernetesConfig *portalconfig.KubernetesConfig
AppConfig *portalconfig.AppConfig
Namespace string `wire:"-"`
KubeConfig *rest.Config `wire:"-"`
Client kubernetes.Interface `wire:"-"`
CertManagerClient certmanagerclientset.Interface `wire:"-"`
DynamicClient dynamic.Interface `wire:"-"`
DiscoveryRESTMapper meta.RESTMapper `wire:"-"`
}
func (*Kubernetes) CreateResourcesForDomain ¶
func (*Kubernetes) DeleteResourcesForDomain ¶
func (k *Kubernetes) DeleteResourcesForDomain(ctx context.Context, domainID string) error
type KubernetesResource ¶
type KubernetesResource struct {
Object *unstructured.Unstructured
GVK *schema.GroupVersionKind
}
func GenerateResources ¶
func GenerateResources(def *ResourceTemplateData, templateBytes []byte) ([]*KubernetesResource, error)
type NoopAttributesService ¶
type NoopAttributesService struct{}
func (*NoopAttributesService) UpdateAllCustomAttributes ¶
func (*NoopAttributesService) UpdateAllCustomAttributes(ctx context.Context, role accesscontrol.Role, userID string, stdAttrs map[string]interface{}) error
func (*NoopAttributesService) UpdateStandardAttributes ¶
func (*NoopAttributesService) UpdateStandardAttributes(ctx context.Context, role accesscontrol.Role, userID string, stdAttrs map[string]interface{}) error
type NoopRolesAndGroupsService ¶
type NoopRolesAndGroupsService struct{}
func (*NoopRolesAndGroupsService) ResetUserGroup ¶
func (*NoopRolesAndGroupsService) ResetUserGroup(ctx context.Context, options *rolesgroups.ResetUserGroupOptions) error
func (*NoopRolesAndGroupsService) ResetUserRole ¶
func (*NoopRolesAndGroupsService) ResetUserRole(ctx context.Context, options *rolesgroups.ResetUserRoleOptions) error
type OnboardService ¶
type OnboardService struct {
HTTPClient HTTPClient
AuthgearConfig *portalconfig.AuthgearConfig
AdminAPI OnboardServiceAdminAPIService
PosthogService OnboardServicePosthogService
}
func (*OnboardService) CheckOnboardingSurveyCompletion ¶
func (*OnboardService) SubmitOnboardEntry ¶
func (s *OnboardService) SubmitOnboardEntry(ctx context.Context, entry model.OnboardEntry, actorID string) error
type OnboardServicePosthogService ¶
type OnboardServicePosthogService interface {
Batch(ctx context.Context, events []json.RawMessage) error
}
type PortalAdminAPIAuthContext ¶
type PortalAdminAPIAuthContext struct {
Usage Usage `json:"usage"`
ActorUserID string `json:"actor_user_id,omitempty"`
HTTPReferer string `json:"http_referer,omitempty"`
}
func (*PortalAdminAPIAuthContext) ToAuditContext ¶
func (c *PortalAdminAPIAuthContext) ToAuditContext(requestURL httputil.HTTPRequestURL) event.AuditContext
type ResourceManager ¶
type ResourceTemplateData ¶
type SubscriptionConfigSourceStore ¶
type SubscriptionConfigSourceStore interface {
GetDatabaseSourceByAppID(ctx context.Context, appID string) (*configsource.DatabaseSource, error)
UpdateDatabaseSource(ctx context.Context, dbs *configsource.DatabaseSource) error
}
type SubscriptionPlanStore ¶
type SubscriptionService ¶
type SubscriptionService struct {
SQLBuilder *globaldb.SQLBuilder
SQLExecutor *globaldb.SQLExecutor
GlobalDatabase *globaldb.Handle
ConfigSourceStore SubscriptionConfigSourceStore
PlanStore SubscriptionPlanStore
UsageStore SubscriptionUsageStore
Clock clock.Clock
AppConfig *portalconfig.AppConfig
}
func (*SubscriptionService) ArchiveSubscription0 ¶
func (s *SubscriptionService) ArchiveSubscription0(ctx context.Context, sub *model.Subscription) error
ArchiveSubscription0 assumes acquired connection.
func (*SubscriptionService) CreateSubscriptionCheckout ¶
func (s *SubscriptionService) CreateSubscriptionCheckout(ctx context.Context, checkoutSession *libstripe.CheckoutSession) (*model.SubscriptionCheckout, error)
CreateSubscriptionCheckout acquires connection.
func (*SubscriptionService) GetLastProcessingCustomerID ¶
func (s *SubscriptionService) GetLastProcessingCustomerID(ctx context.Context, appID string) (*string, error)
GetLastProcessingCustomerID acquires connection.
func (*SubscriptionService) GetSubscription ¶
func (s *SubscriptionService) GetSubscription(ctx context.Context, appID string) (*model.Subscription, error)
GetSubscription acquires connection.
func (*SubscriptionService) GetSubscription0 ¶
func (s *SubscriptionService) GetSubscription0(ctx context.Context, appID string) (*model.Subscription, error)
GetSubscription0 assumes acquired connection.
func (*SubscriptionService) GetSubscriptionUsage ¶
func (s *SubscriptionService) GetSubscriptionUsage( ctx context.Context, appID string, planName string, date time.Time, subscriptionPlans []*model.SubscriptionPlan, ) (*model.SubscriptionUsage, error)
GetSubscriptionUsage acquires connection. GetSubscriptionUsage uses the current plan to estimate the usage and the cost. However, if we ever adjust the prices, the estimation will become inaccurate. A accurate estimation should use the Prices in the Stripe Subscription to perform calculation.
func (*SubscriptionService) MarkCheckoutCancelled0 ¶
func (s *SubscriptionService) MarkCheckoutCancelled0(ctx context.Context, appID string, customerID string) error
MarkCheckoutCancelled0 assumes acquired connection.
func (*SubscriptionService) MarkCheckoutCompleted ¶
func (s *SubscriptionService) MarkCheckoutCompleted(ctx context.Context, appID string, stripCheckoutSessionID string, customerID string) error
MarkCheckoutCompleted acquires connection. MarkCheckoutCompleted marks subscription checkout as completed. It returns ErrSubscriptionCheckoutNotFound when the checkout is not found or the checkout status is already subscribed.
func (*SubscriptionService) MarkCheckoutExpired ¶
func (s *SubscriptionService) MarkCheckoutExpired(ctx context.Context, appID string, customerID string) error
MarkCheckoutExpired acquires connection.
func (*SubscriptionService) MarkCheckoutSubscribed0 ¶
func (s *SubscriptionService) MarkCheckoutSubscribed0(ctx context.Context, appID string, customerID string) error
MarkCheckoutSubscribed0 assumes acquired connection. MarkCheckoutSubscribed0 marks subscription checkout as subscribed. It returns ErrSubscriptionCheckoutNotFound when the checkout is not found or the checkout status is already subscribed.
func (*SubscriptionService) SetSubscriptionCancelledStatus ¶
func (s *SubscriptionService) SetSubscriptionCancelledStatus(ctx context.Context, id string, cancelled bool, endedAt *time.Time) error
SetSubscriptionCancelledStatus acquires connection.
func (*SubscriptionService) UpdateAppPlan ¶
func (s *SubscriptionService) UpdateAppPlan(ctx context.Context, appID string, planName string) error
UpdateAppPlan acquires connection.
func (*SubscriptionService) UpdateAppPlan0 ¶
func (s *SubscriptionService) UpdateAppPlan0(ctx context.Context, appID string, planName string) error
UpdateAppPlan0 assumes acquired connection.
func (*SubscriptionService) UpdateAppPlanToDefault0 ¶
func (s *SubscriptionService) UpdateAppPlanToDefault0(ctx context.Context, appID string) error
UpdateAppPlanToDefault0 assumes acquired connection.
func (*SubscriptionService) UpsertSubscription0 ¶
func (s *SubscriptionService) UpsertSubscription0(ctx context.Context, appID string, stripeSubscriptionID string, stripeCustomerID string) (*model.Subscription, error)
UpsertSubscription0 assumes acquired connection.
type SubscriptionUsageStore ¶
type SubscriptionUsageStore interface {
FetchUploadedUsageRecords(
ctx context.Context,
appID string,
recordName usage.RecordName,
period periodical.Type,
stripeStart time.Time,
stripeEnd time.Time,
) ([]*usage.UsageRecord, error)
FetchUsageRecords(
ctx context.Context,
appID string,
recordName usage.RecordName,
period periodical.Type,
startTime time.Time,
) ([]*usage.UsageRecord, error)
}
type SystemConfigProvider ¶
type SystemConfigProvider struct {
AuthgearConfig *config.AuthgearConfig
AppConfig *config.AppConfig
SearchConfig *config.SearchConfig
AuditLogConfig *config.AuditLogConfig
AnalyticConfig *configlib.AnalyticConfig
GTMConfig *config.GoogleTagManagerConfig
FrontendSentryConfig *config.PortalFrontendSentryConfig
PortalFeaturesConfig *config.PortalFeaturesConfig
GlobalUIImplementation configlib.GlobalUIImplementation
GlobalUISettingsImplementation configlib.GlobalUISettingsImplementation
Resources ResourceManager
}
func (*SystemConfigProvider) SystemConfig ¶
func (p *SystemConfigProvider) SystemConfig(ctx context.Context) (*model.SystemConfig, error)
type TokenService ¶
func (*TokenService) GenerateShortLivedAdminAPIToken ¶
type UsageService ¶
type UsageService struct {
GlobalDatabase *globaldb.Handle
UsageStore UsageUsageStore
}
type UsageUsageStore ¶
type UsageUsageStore interface {
FetchUsageRecordsInRange(
ctx context.Context,
appID string,
recordName usage.RecordName,
period periodical.Type,
fromStartTime time.Time,
toEndTime time.Time,
) ([]*usage.UsageRecord, error)
FetchUsageRecords(
ctx context.Context,
appID string,
recordName usage.RecordName,
period periodical.Type,
startTime time.Time,
) ([]*usage.UsageRecord, error)
}