service

package
v0.0.0-...-122f59b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 90 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPrivacyPolicyLink string = "https://www.authgear.com/data-privacy"
View Source
const DefaultTermsOfServiceLink string = "https://www.authgear.com/terms"
View Source
const DomainVerificationTimeout = 10 * time.Second
View Source
const SecretVisitTokenValidDuration = duration.Short
View Source
const SecretVisitTokenVisibleSecrets string = "visible_secrets"

Variables

View Source
var DomainVerificationFailed = apierrors.Forbidden.WithReason("DomainVerificationFailed")
View Source
var ErrAppIDInvalid = apierrors.Invalid.WithReason("InvalidAppID").
	New("invalid app ID")
View Source
var ErrAppIDReserved = apierrors.Forbidden.WithReason("AppIDReserved").
	New("requested app ID is reserved")
View Source
var ErrCollaboratorDuplicate = apierrors.AlreadyExists.WithReason("CollaboratorDuplicate").New("collaborator duplicate")
View Source
var ErrCollaboratorInvitationDuplicate = apierrors.AlreadyExists.WithReason("CollaboratorInvitationDuplicate").New("collaborator invitation duplicate")
View Source
var ErrCollaboratorInvitationInvalidCode = apierrors.Invalid.WithReason("CollaboratorInvitationInvalidCode").New("collaborator invitation invalid code")
View Source
var ErrCollaboratorInvitationInvalidEmail = apierrors.Invalid.WithReason("CollaboratorInvitationInvalidEmail").New("the email with the actor does match the invitee email")
View Source
var ErrCollaboratorInvitationNotFound = apierrors.NotFound.WithReason("CollaboratorInvitationNotFound").New("collaborator invitation not found")
View Source
var ErrCollaboratorNotFound = apierrors.NotFound.WithReason("CollaboratorNotFound").New("collaborator not found")
View Source
var ErrCollaboratorQuotaExceeded = apierrors.Invalid.WithReason("CollaboratorQuotaExceeded").New("collaborator quota exceeded")
View Source
var ErrCollaboratorSelfDeletion = apierrors.Forbidden.WithReason("CollaboratorSelfDeletion").New("cannot remove self from collaborator")
View Source
var ErrDomainDuplicated = apierrors.AlreadyExists.WithReason("DuplicatedDomain").
	New("requested domain is already in use")
View Source
var ErrDomainNotCustom = apierrors.Forbidden.WithReason("DomainNotCustom").
	New("requested domain is not a custom domain")
View Source
var ErrDomainNotFound = apierrors.NotFound.WithReason("DomainNotFound").
	New("domain not found")
View Source
var ErrDomainVerified = apierrors.AlreadyExists.WithReason("DomainVerified").
	New("requested domain is already verified")
View Source
var ErrDuplicatedAppID = apierrors.AlreadyExists.WithReason("DuplicatedAppID").
	New("duplicated app ID")
View Source
var ErrForbidden = apierrors.Forbidden.WithReason("Forbidden").New("forbidden")
View Source
var ErrGetStaticAppIDsNotSupported = errors.New("only local FS config source can get static app ID")
View Source
var ErrHostSuffixNotConfigured = errors.New("host suffix not configured")
View Source
var ErrReauthRequrired = apierrors.Forbidden.WithReason("ReauthRequrired").
	New("reauthentication required")
View Source
var ErrSubscriptionCheckoutNotFound = apierrors.NotFound.WithReason("ErrSubscriptionCheckoutNotFound").
	New("subscription checkout not found")
View Source
var ErrSubscriptionNotFound = apierrors.NotFound.WithReason("ErrSubscriptionNotFound").New("subscription not found")
View Source
var InvalidDomain = apierrors.Invalid.WithReason("InvalidDomain")
View Source
var LabelAppID = "authgear.com/app-id"
View Source
var LabelDomainID = "authgear.com/domain-id"

Functions

func MakeVerificationNonce

func MakeVerificationNonce() string

Types

type AdminAPIDefaultDomainService

type AdminAPIDefaultDomainService interface {
	GetLatestAppHost(appID string) (string, error)
}

type AdminAPIService

type AdminAPIService struct {
	AuthgearConfig *portalconfig.AuthgearConfig
	AdminAPIConfig *portalconfig.AdminAPIConfig
	ConfigSource   *configsource.ConfigSource
	AuthzAdder     AuthzAdder
	DefaultDomains AdminAPIDefaultDomainService
}

func (*AdminAPIService) Director

func (s *AdminAPIService) Director(appID string, p string, actorUserID string, usage Usage) (director func(*http.Request), err error)

func (*AdminAPIService) ResolveConfig

func (s *AdminAPIService) ResolveConfig(appID string) (*config.Config, error)

func (*AdminAPIService) ResolveEndpoint

func (s *AdminAPIService) ResolveEndpoint(appID string) (*url.URL, error)

func (*AdminAPIService) SelfDirector

func (s *AdminAPIService) SelfDirector(actorUserID string, usage Usage) (director func(*http.Request), err error)

type AppAuthzService

type AppAuthzService interface {
	AddAuthorizedUser(appID string, userID string, role model.CollaboratorRole) error
	ListAuthorizedApps(userID string) ([]string, error)
}

type AppConfigService

type AppConfigService interface {
	ResolveContext(appID string) (*config.AppContext, error)
	UpdateResources(appID string, updates []*resource.ResourceFile) error
	Create(opts *CreateAppOptions) error
}

type AppDefaultDomainService

type AppDefaultDomainService interface {
	GetLatestAppHost(appID string) (string, error)
	CreateAllDefaultDomains(appID string) error
}

type AppPlanService

type AppPlanService interface {
	GetDefaultPlan() (*model.Plan, error)
}

type AppResourceManagerFactory

type AppResourceManagerFactory interface {
	NewManagerWithNewAppFS(appFs resource.Fs) *appresource.Manager
	NewManagerWithAppContext(appContext *config.AppContext) *appresource.Manager
}

type AppSecretVisitTokenStore

type AppSecretVisitTokenStore interface {
	CreateToken(
		appID config.AppID,
		userID string,
		secrets []config.SecretKey,
	) (*appsecret.AppSecretVisitToken, error)
	GetTokenByID(
		appID config.AppID,
		tokenID string,
	) (*appsecret.AppSecretVisitToken, error)
}

type AppService

type AppService struct {
	Logger      AppServiceLogger
	SQLBuilder  *globaldb.SQLBuilder
	SQLExecutor *globaldb.SQLExecutor

	AppConfig                *portalconfig.AppConfig
	AppConfigs               AppConfigService
	AppAuthz                 AppAuthzService
	DefaultDomains           AppDefaultDomainService
	Resources                ResourceManager
	AppResMgrFactory         AppResourceManagerFactory
	Plan                     AppPlanService
	Clock                    clock.Clock
	AppSecretVisitTokenStore AppSecretVisitTokenStore
	AppTesterTokenStore      AppTesterTokenStore
}

func (*AppService) Create

func (s *AppService) Create(userID string, id string) (*model.App, error)

func (*AppService) GenerateSecretVisitToken

func (s *AppService) GenerateSecretVisitToken(
	app *model.App,
	sessionInfo *apimodel.SessionInfo,
	visitingSecrets []config.SecretKey,
) (*appsecret.AppSecretVisitToken, error)

func (*AppService) GenerateTesterToken

func (s *AppService) GenerateTesterToken(
	app *model.App,
	returnURI string,
) (*tester.TesterToken, error)

func (*AppService) Get

func (s *AppService) Get(id string) (*model.App, error)

func (*AppService) GetAppList

func (s *AppService) GetAppList(userID string) ([]*model.AppListItem, error)

func (*AppService) GetMany

func (s *AppService) GetMany(ids []string) (out []*model.App, err error)

func (*AppService) GetManyProjectQuota

func (s *AppService) GetManyProjectQuota(userIDs []string) ([]int, error)

func (*AppService) GetProjectQuota

func (s *AppService) GetProjectQuota(userID string) (int, error)

func (*AppService) LoadAppSecretConfig

func (s *AppService) LoadAppSecretConfig(
	app *model.App,
	sessionInfo *apimodel.SessionInfo,
	token string) (*model.SecretConfig, string, error)

func (*AppService) LoadRawAppConfig

func (s *AppService) LoadRawAppConfig(app *model.App) (*config.AppConfig, string, error)

func (*AppService) UpdateResources

func (s *AppService) UpdateResources(app *model.App, updates []appresource.Update) error

type AppServiceLogger

type AppServiceLogger struct{ *log.Logger }

func NewAppServiceLogger

func NewAppServiceLogger(lf *log.Factory) AppServiceLogger

type AppTesterTokenStore

type AppTesterTokenStore interface {
	CreateToken(
		appID config.AppID,
		returnURI string,
	) (*tester.TesterToken, error)
}

type AuditService

type AuditService struct {
	Context         context.Context
	RemoteIP        httputil.RemoteIP
	UserAgentString httputil.UserAgentString
	Request         *http.Request

	Apps     AuditServiceAppService
	Authgear *portalconfig.AuthgearConfig

	DenoEndpoint config.DenoEndpoint

	SQLBuilder  *globaldb.SQLBuilder
	SQLExecutor *globaldb.SQLExecutor

	AuditDatabase *auditdb.WriteHandle

	Clock         clock.Clock
	LoggerFactory *log.Factory
}

func (*AuditService) Log

func (s *AuditService) Log(app *model.App, payload event.NonBlockingPayload) (err error)

type AuditServiceAppService

type AuditServiceAppService interface {
	Get(id string) (*model.App, error)
}

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(c *model.Collaborator) error
	ListCollaboratorsByUser(userID string) ([]*model.Collaborator, error)
	GetCollaboratorByAppAndUser(appID string, userID string) (*model.Collaborator, error)
}

type AuthzConfigService

type AuthzConfigService interface {
	GetStaticAppIDs() ([]string, error)
}

type AuthzService

type AuthzService struct {
	Context       context.Context
	Configs       AuthzConfigService
	Collaborators AuthzCollaboratorService
}

func (*AuthzService) AddAuthorizedUser

func (s *AuthzService) AddAuthorizedUser(appID string, userID string, role model.CollaboratorRole) error

func (*AuthzService) CheckAccessOfViewer

func (s *AuthzService) CheckAccessOfViewer(appID string) (userID string, err error)

func (*AuthzService) ListAuthorizedApps

func (s *AuthzService) ListAuthorizedApps(userID string) ([]string, error)

type CollaboratorAppConfigService

type CollaboratorAppConfigService interface {
	ResolveContext(appID string) (*config.AppContext, error)
}

type CollaboratorService

type CollaboratorService struct {
	Context     context.Context
	Clock       clock.Clock
	SQLBuilder  *globaldb.SQLBuilder
	SQLExecutor *globaldb.SQLExecutor

	MailConfig     *portalconfig.MailConfig
	TaskQueue      CollaboratorServiceTaskQueue
	Endpoints      CollaboratorServiceEndpointsProvider
	TemplateEngine *template.Engine
	AdminAPI       CollaboratorServiceAdminAPIService

	AppConfigs CollaboratorAppConfigService
}

func (*CollaboratorService) AcceptInvitation

func (s *CollaboratorService) AcceptInvitation(code string) (*model.Collaborator, error)

func (*CollaboratorService) CheckInviteeEmail

func (s *CollaboratorService) CheckInviteeEmail(i *model.CollaboratorInvitation, actorID string) error

func (*CollaboratorService) CreateCollaborator

func (s *CollaboratorService) CreateCollaborator(c *model.Collaborator) error

func (*CollaboratorService) DeleteCollaborator

func (s *CollaboratorService) DeleteCollaborator(c *model.Collaborator) error

func (*CollaboratorService) DeleteInvitation

func (s *CollaboratorService) DeleteInvitation(i *model.CollaboratorInvitation) error

func (*CollaboratorService) GetCollaborator

func (s *CollaboratorService) GetCollaborator(id string) (*model.Collaborator, error)

func (*CollaboratorService) GetCollaboratorByAppAndUser

func (s *CollaboratorService) GetCollaboratorByAppAndUser(appID string, userID string) (*model.Collaborator, error)

func (*CollaboratorService) GetInvitation

func (s *CollaboratorService) GetInvitation(id string) (*model.CollaboratorInvitation, error)

func (*CollaboratorService) GetInvitationWithCode

func (s *CollaboratorService) GetInvitationWithCode(code string) (*model.CollaboratorInvitation, error)

func (*CollaboratorService) GetManyCollaborators

func (s *CollaboratorService) GetManyCollaborators(ids []string) ([]*model.Collaborator, error)

func (*CollaboratorService) GetManyInvitations

func (s *CollaboratorService) GetManyInvitations(ids []string) ([]*model.CollaboratorInvitation, error)

func (*CollaboratorService) GetManyProjectOwnerCount

func (s *CollaboratorService) GetManyProjectOwnerCount(userIDs []string) ([]int, error)

func (*CollaboratorService) GetProjectOwnerCount

func (s *CollaboratorService) GetProjectOwnerCount(userID string) (int, error)

func (*CollaboratorService) ListCollaborators

func (s *CollaboratorService) ListCollaborators(appID string) ([]*model.Collaborator, error)

func (*CollaboratorService) ListCollaboratorsByUser

func (s *CollaboratorService) ListCollaboratorsByUser(userID string) ([]*model.Collaborator, error)

func (*CollaboratorService) ListInvitations

func (s *CollaboratorService) ListInvitations(appID string) ([]*model.CollaboratorInvitation, error)

func (*CollaboratorService) NewCollaborator

func (s *CollaboratorService) NewCollaborator(appID string, userID string, role model.CollaboratorRole) *model.Collaborator

func (*CollaboratorService) SendInvitation

func (s *CollaboratorService) SendInvitation(
	appID string,
	inviteeEmail string,
) (*model.CollaboratorInvitation, error)

type CollaboratorServiceAdminAPIService

type CollaboratorServiceAdminAPIService interface {
	SelfDirector(actorUserID string, usage Usage) (func(*http.Request), error)
}

type CollaboratorServiceEndpointsProvider

type CollaboratorServiceEndpointsProvider interface {
	AcceptCollaboratorInvitationEndpointURL() *url.URL
}

type CollaboratorServiceTaskQueue

type CollaboratorServiceTaskQueue interface {
	Enqueue(param task.Param)
}

type ConfigService

type ConfigService struct {
	Context              context.Context
	Logger               ConfigServiceLogger
	AppConfig            *portalconfig.AppConfig
	Controller           *configsource.Controller
	ConfigSource         *configsource.ConfigSource
	DomainImplementation portalconfig.DomainImplementationType
	Kubernetes           *Kubernetes
}

func (*ConfigService) Create

func (s *ConfigService) Create(opts *CreateAppOptions) error

func (*ConfigService) CreateDomain

func (s *ConfigService) CreateDomain(appID string, domainID string, domain string, isCustom bool) error

func (*ConfigService) DeleteDomain

func (s *ConfigService) DeleteDomain(domain *apimodel.Domain) error

func (*ConfigService) GetStaticAppIDs

func (s *ConfigService) GetStaticAppIDs() ([]string, error)

func (*ConfigService) ResolveContext

func (s *ConfigService) ResolveContext(appID string) (*config.AppContext, error)

func (*ConfigService) UpdateResources

func (s *ConfigService) UpdateResources(appID string, files []*resource.ResourceFile) error

type ConfigServiceLogger

type ConfigServiceLogger struct{ *log.Logger }

func NewConfigServiceLogger

func NewConfigServiceLogger(lf *log.Factory) ConfigServiceLogger

type CreateAppOptions

type CreateAppOptions struct {
	AppID     string
	Resources map[string][]byte
	PlanName  string
}

type DefaultDomainDomainService

type DefaultDomainDomainService interface {
	CreateDomain(appID string, domain string, isVerified bool, isCustom bool) (*apimodel.Domain, error)
}

type DefaultDomainService

type DefaultDomainService struct {
	AppHostSuffixes config.AppHostSuffixes
	AppConfig       *portalconfig.AppConfig
	Domains         DefaultDomainDomainService
}

func (*DefaultDomainService) CreateAllDefaultDomains

func (s *DefaultDomainService) CreateAllDefaultDomains(appID string) error

func (*DefaultDomainService) GetLatestAppHost

func (s *DefaultDomainService) GetLatestAppHost(appID string) (string, error)

type DomainConfigService

type DomainConfigService interface {
	CreateDomain(appID string, domainID string, domain string, isCustom bool) error
	DeleteDomain(domain *apimodel.Domain) error
}

type DomainService

type DomainService struct {
	Context      context.Context
	Clock        clock.Clock
	DomainConfig DomainConfigService
	SQLBuilder   *globaldb.SQLBuilder
	SQLExecutor  *globaldb.SQLExecutor
}

func (*DomainService) CreateCustomDomain

func (s *DomainService) CreateCustomDomain(appID string, domain string) (*apimodel.Domain, error)

func (*DomainService) CreateDomain

func (s *DomainService) CreateDomain(appID string, domain string, isVerified bool, isCustom bool) (*apimodel.Domain, error)

func (*DomainService) DeleteDomain

func (s *DomainService) DeleteDomain(appID string, id string) error

func (*DomainService) GetMany

func (s *DomainService) GetMany(ids []string) ([]*apimodel.Domain, error)

func (*DomainService) ListDomains

func (s *DomainService) ListDomains(appID string) ([]*apimodel.Domain, error)

func (*DomainService) VerifyDomain

func (s *DomainService) VerifyDomain(appID string, id string) (*apimodel.Domain, error)

type GetContractMetadataResponse

type GetContractMetadataResponse struct {
	Result apimodel.GetContractMetadataResult `json:"result"`
	Error  *apierrors.APIError                `json:"error"`
}

type IngressTemplateData

type IngressTemplateData struct {
	AppID         string
	DomainID      string
	IsCustom      bool
	Host          string
	TLSSecretName string
}

type Kubernetes

type Kubernetes struct {
	KubernetesConfig *portalconfig.KubernetesConfig
	AppConfig        *portalconfig.AppConfig
	Logger           KubernetesLogger

	Context             context.Context                `wire:"-"`
	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 (k *Kubernetes) CreateResourcesForDomain(
	appID string,
	domainID string,
	domain string,
	isCustom bool,
) error

func (*Kubernetes) DeleteResourcesForDomain

func (k *Kubernetes) DeleteResourcesForDomain(domainID string) error

type KubernetesLogger

type KubernetesLogger struct{ *log.Logger }

func NewKubernetesLogger

func NewKubernetesLogger(lf *log.Factory) KubernetesLogger

type KubernetesResource

type KubernetesResource struct {
	Object *unstructured.Unstructured
	GVK    *schema.GroupVersionKind
}

func GenerateResources

func GenerateResources(def *ResourceTemplateData, templateBytes []byte) ([]*KubernetesResource, error)

type NFTService

type NFTService struct {
	APIEndpoint config.NFTIndexerAPIEndpoint
}

func (*NFTService) GetContractMetadata

func (s *NFTService) GetContractMetadata(contracts []web3.ContractID) ([]apimodel.NFTCollection, error)

func (*NFTService) ProbeNFTCollection

func (s *NFTService) ProbeNFTCollection(contractID web3.ContractID) (*apimodel.ProbeCollectionResult, error)

type NoopAttributesService

type NoopAttributesService struct{}

func (*NoopAttributesService) UpdateAllCustomAttributes

func (*NoopAttributesService) UpdateAllCustomAttributes(role accesscontrol.Role, userID string, stdAttrs map[string]interface{}) error

func (*NoopAttributesService) UpdateStandardAttributes

func (*NoopAttributesService) UpdateStandardAttributes(role accesscontrol.Role, userID string, stdAttrs map[string]interface{}) error

type NoopRolesAndGroupsService

type NoopRolesAndGroupsService struct{}

func (*NoopRolesAndGroupsService) ResetUserGroup

func (*NoopRolesAndGroupsService) ResetUserRole

type OnboardService

type OnboardService struct {
	AuthgearConfig *portalconfig.AuthgearConfig
	AdminAPI       OnboardServiceAdminAPIService
}

func (*OnboardService) SubmitOnboardEntry

func (s *OnboardService) SubmitOnboardEntry(entry model.OnboardEntry, actorID string) error

type OnboardServiceAdminAPIService

type OnboardServiceAdminAPIService interface {
	SelfDirector(actorUserID string, usage Usage) (func(*http.Request), error)
}

type PortalAdminAPIAuthContext

type PortalAdminAPIAuthContext struct {
	Usage       Usage  `json:"usage"`
	ActorUserID string `json:"actor_user_id,omitempty"`
	HTTPReferer string `json:"http_referer,omitempty"`
}

type ProbeColletionResponse

type ProbeColletionResponse struct {
	Result apimodel.ProbeCollectionResult `json:"result"`
	Error  *apierrors.APIError            `json:"error"`
}

type ResourceManager

type ResourceManager interface {
	Read(desc resource.Descriptor, view resource.View) (interface{}, error)
}

type ResourceTemplateData

type ResourceTemplateData struct {
	AppID    string
	DomainID string
	IsCustom bool
	Host     string
}

type SubscriptionConfigSourceStore

type SubscriptionConfigSourceStore interface {
	GetDatabaseSourceByAppID(appID string) (*configsource.DatabaseSource, error)
	UpdateDatabaseSource(dbs *configsource.DatabaseSource) error
}

type SubscriptionPlanStore

type SubscriptionPlanStore interface {
	GetPlan(name string) (*model.Plan, error)
}

type SubscriptionService

type SubscriptionService struct {
	SQLBuilder        *globaldb.SQLBuilder
	SQLExecutor       *globaldb.SQLExecutor
	ConfigSourceStore SubscriptionConfigSourceStore
	PlanStore         SubscriptionPlanStore
	UsageStore        UsageStore
	Clock             clock.Clock
	AppConfig         *portalconfig.AppConfig
}

func (*SubscriptionService) ArchiveSubscription

func (s *SubscriptionService) ArchiveSubscription(sub *model.Subscription) error

func (*SubscriptionService) CreateSubscriptionCheckout

func (s *SubscriptionService) CreateSubscriptionCheckout(checkoutSession *libstripe.CheckoutSession) (*model.SubscriptionCheckout, error)

func (*SubscriptionService) GetLastProcessingCustomerID

func (s *SubscriptionService) GetLastProcessingCustomerID(appID string) (*string, error)

func (*SubscriptionService) GetSubscription

func (s *SubscriptionService) GetSubscription(appID string) (*model.Subscription, error)

func (*SubscriptionService) GetSubscriptionUsage

func (s *SubscriptionService) GetSubscriptionUsage(
	appID string,
	planName string,
	date time.Time,
	subscriptionPlans []*model.SubscriptionPlan,
) (*model.SubscriptionUsage, error)

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) MarkCheckoutCancelled

func (s *SubscriptionService) MarkCheckoutCancelled(appID string, customerID string) error

func (*SubscriptionService) MarkCheckoutCompleted

func (s *SubscriptionService) MarkCheckoutCompleted(appID string, stripCheckoutSessionID string, customerID string) error

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(appID string, customerID string) error

func (*SubscriptionService) MarkCheckoutSubscribed

func (s *SubscriptionService) MarkCheckoutSubscribed(appID string, customerID string) error

MarkCheckoutSubscribed 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(id string, cancelled bool, endedAt *time.Time) error

func (*SubscriptionService) UpdateAppPlan

func (s *SubscriptionService) UpdateAppPlan(appID string, planName string) error

func (*SubscriptionService) UpdateAppPlanToDefault

func (s *SubscriptionService) UpdateAppPlanToDefault(appID string) error

func (*SubscriptionService) UpsertSubscription

func (s *SubscriptionService) UpsertSubscription(appID string, stripeSubscriptionID string, stripeCustomerID string) (*model.Subscription, error)

type SystemConfigProvider

type SystemConfigProvider struct {
	AuthgearConfig       *config.AuthgearConfig
	AppConfig            *config.AppConfig
	SearchConfig         *config.SearchConfig
	Web3Config           *config.Web3Config
	AuditLogConfig       *config.AuditLogConfig
	AnalyticConfig       *configlib.AnalyticConfig
	GTMConfig            *config.GoogleTagManagerConfig
	FrontendSentryConfig *config.PortalFrontendSentryConfig
	Resources            ResourceManager
}

func (*SystemConfigProvider) SystemConfig

func (p *SystemConfigProvider) SystemConfig() (*model.SystemConfig, error)

type Usage

type Usage string
const (
	UsageProxy    Usage = "proxy"
	UsageInternal Usage = "internal"
)

type UsageStore

type UsageStore interface {
	FetchUploadedUsageRecords(
		appID string,
		recordName usage.RecordName,
		period periodical.Type,
		stripeStart time.Time,
		stripeEnd time.Time,
	) ([]*usage.UsageRecord, error)
	FetchUsageRecords(
		appID string,
		recordName usage.RecordName,
		period periodical.Type,
		startTime time.Time,
	) ([]*usage.UsageRecord, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL