v1beta1connect

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 81 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdempotencyReplyHeader = "X-Idempotency-Replayed"
	HttpChunkSize          = 204800 // 200KB
)

Variables

View Source
var (
	ErrBadRequest                  = errors.New("invalid syntax in body")
	ErrInvalidMetadata             = errors.New("metadata schema validation failed")
	ErrOperationUnsupported        = errors.New("operation not supported")
	ErrInternalServerError         = errors.New("internal server error")
	ErrUnauthenticated             = errors.New("not authenticated")
	ErrUnauthorized                = errors.New("not authorized")
	ErrNotFound                    = errors.New("not found")
	ErrInvalidEmail                = errors.New("Invalid email")
	ErrUserNotExist                = errors.New("user doesn't exist")
	ErrInvalidNamesapceOrID        = errors.New("namespace and ID cannot be empty")
	ErrConflictRequest             = errors.New("already exist")
	ErrBadBodyMetaSchemaError      = errors.New(ErrBadRequest.Error() + " : " + ErrInvalidMetadata.Error())
	ErrInvalidActorType            = errors.New("invalid actor type")
	ErrActivityRequired            = errors.New("activity is required")
	ErrStatusRequired              = errors.New("status is required")
	ErrProspectIdRequired          = errors.New("prospect ID is required")
	ErrProspectNotFound            = errors.New("record not found for the given input")
	ErrRQLParse                    = errors.New("error parsing RQL query")
	ErrOrgDisabled                 = errors.New("org is disabled. Please contact your administrator to enable it")
	ErrRoleFilter                  = errors.New("cannot use role filters and with_roles together")
	ErrMinAdminCount               = errors.New("org must have at least one admin, consider adding another admin before removing")
	ErrDomainNotFound              = errors.New("domain whitelist request doesn't exist")
	ErrDomainAlreadyExists         = errors.New("domain name already exists for that organization")
	ErrInvalidHost                 = errors.New("invalid domain, no such host found")
	ErrTXTRecordNotFound           = errors.New("required TXT record not found for domain verification")
	ErrDomainMismatch              = errors.New("user and org's whitelisted domains doesn't match")
	ErrInvitationNotFound          = errors.New("invitation not found")
	ErrInvitationExpired           = errors.New("invitation expired")
	ErrAlreadyMember               = errors.New("user is already a member of the organization")
	ErrEmptyEmailID                = errors.New("email id is empty")
	ErrEmailConflict               = errors.New("user email can't be updated")
	ErrCustomerNotFound            = errors.New("customer doesn't exist")
	ErrServiceUserNotFound         = errors.New("service user not found")
	ErrServiceUserCredNotFound     = errors.New("service user credentials not found")
	ErrConflictingPlanChange       = errors.New("cannot change plan and cancel upcoming changes at the same time")
	ErrNoChangeRequested           = errors.New("no change requested")
	ErrPerSeatLimitReached         = errors.New("per seat limit reached")
	ErrAlreadyOnSamePlan           = errors.New("already on same plan")
	ErrBillingProviderNotSupported = errors.New("provider not supported")
	ErrInsufficientCredits         = errors.New("insufficient credits")
	ErrAlreadyApplied              = errors.New("credits already applied")
	ErrInvalidRoleID               = errors.New("role id is invalid")
	ErrNamespaceSplitNotation      = errors.New("subject/object should be provided as 'namespace:uuid'")
	ErrPolicyNotFound              = errors.New("policy doesn't exist")
	ErrProjectNotFound             = errors.New("project doesn't exist")
	ErrGroupNotFound               = errors.New("group doesn't exist")
	ErrOrgNotFound                 = errors.New("org doesn't exist")
	ErrGroupMinOwnerCount          = errors.New("group must have at least one owner, consider adding another owner before removing")
	ErrPortalChangesKycCompleted   = errors.New("customer portal changes not allowed: organization kyc completed")
	ErrResourceNotFound            = errors.New("resource doesn't exist")
	ErrInvalidPreferenceFilter     = errors.New("invalid preference filter set")
	ErrTraitNotFound               = errors.New("preference trait not found, preferences can only be created with valid trait")
	ErrInvalidPreferenceValue      = errors.New("invalid value for preference")
	ErrMetaschemaNotFound          = errors.New("metaschema doesn't exist")
	ErrSessionNotFound             = errors.New("session doesn't exist")
	ErrInvalidSessionID            = errors.New("invalid session_id format: must be a valid UUID")
	ErrInvalidUserID               = errors.New("invalid user_id format: must be a valid UUID")
	ErrRoleNotFound                = errors.New("role doesn't exist")
)

Functions

func ExtractLogger added in v0.69.0

func ExtractLogger(ctx context.Context) *zap.Logger

func TransformAuditRecordToPB added in v0.74.0

func TransformAuditRecordToPB(record auditrecord.AuditRecord) (*frontierv1beta1.CreateAuditRecordResponse, error)

Types

type AuditRecordService added in v0.74.0

type AuditRecordService interface {
	Create(ctx context.Context, record auditrecord.AuditRecord) (auditrecord.AuditRecord, bool, error)
	List(ctx context.Context, query *rql.Query) (auditrecord.AuditRecordsList, error)
	Export(ctx context.Context, query *rql.Query) (io.Reader, string, error)
}

type AuthnService added in v0.82.0

type AuthnService interface {
	StartFlow(ctx context.Context, request authenticate.RegistrationStartRequest) (*authenticate.RegistrationStartResponse, error)
	FinishFlow(ctx context.Context, request authenticate.RegistrationFinishRequest) (*authenticate.RegistrationFinishResponse, error)
	BuildToken(ctx context.Context, principal authenticate.Principal, metadata map[string]string) ([]byte, error)
	JWKs(ctx context.Context) jwk.Set
	GetPrincipal(ctx context.Context, via ...authenticate.ClientAssertion) (authenticate.Principal, error)
	SupportedStrategies() []string
	InitFlows(ctx context.Context) error
	SanitizeReturnToURL(url string) string
	SanitizeCallbackURL(url string) string
}

type BootstrapService added in v0.74.0

type BootstrapService interface {
	AppendSchema(ctx context.Context, definition schema.ServiceDefinition) error
}

type CascadeDeleter added in v0.82.0

type CascadeDeleter interface {
	DeleteProject(ctx context.Context, id string) error
	DeleteOrganization(ctx context.Context, id string) error
	RemoveUsersFromOrg(ctx context.Context, orgID string, userIDs []string) error
	DeleteUser(ctx context.Context, userID string) error
}

type CheckoutService added in v0.74.0

type CheckoutService interface {
	Create(ctx context.Context, ch checkout.Checkout) (checkout.Checkout, error)
	GetByID(ctx context.Context, id string) (checkout.Checkout, error)
	List(ctx context.Context, filter checkout.Filter) ([]checkout.Checkout, error)
	Apply(ctx context.Context, ch checkout.Checkout) (*subscription.Subscription, *product.Product, error)
	CreateSessionForPaymentMethod(ctx context.Context, ch checkout.Checkout) (checkout.Checkout, error)
	CreateSessionForCustomerPortal(ctx context.Context, ch checkout.Checkout) (checkout.Checkout, error)
}

type ConnectHandler

type ConnectHandler struct {
	frontierv1beta1connect.UnimplementedAdminServiceHandler
	frontierv1beta1connect.UnimplementedFrontierServiceHandler
	// contains filtered or unexported fields
}

func NewConnectHandler

func NewConnectHandler(deps api.Deps, authConf authenticate.Config) *ConnectHandler

func (*ConnectHandler) AddGroupUsers added in v0.76.0

func (*ConnectHandler) AuthCallback added in v0.69.0

func (*ConnectHandler) AuthLogout added in v0.69.0

func (*ConnectHandler) AuthToken added in v0.69.0

func (*ConnectHandler) Authenticate added in v0.69.0

func (*ConnectHandler) CheckPlanEntitlement added in v0.69.0

func (h *ConnectHandler) CheckPlanEntitlement(ctx context.Context, obj relation.Object, request connect.AnyRequest) error

CheckPlanEntitlement is only currently used to restrict seat based plans

func (*ConnectHandler) CreateCheckout added in v0.76.0

func (*ConnectHandler) CreateFeature added in v0.76.1

func (*ConnectHandler) CreateGroup added in v0.76.0

func (*ConnectHandler) CreatePlan added in v0.76.0

func (*ConnectHandler) CreatePolicy added in v0.76.0

func (*ConnectHandler) CreateProduct added in v0.76.0

func (*ConnectHandler) CreateProject added in v0.76.0

func (*ConnectHandler) CreateProspect added in v0.75.0

func (*ConnectHandler) CreateRelation added in v0.76.0

func (*ConnectHandler) CreateRole added in v0.74.0

func (*ConnectHandler) CreateUser added in v0.75.0

func (*ConnectHandler) DeleteGroup added in v0.76.0

func (*ConnectHandler) DeletePolicy added in v0.76.0

func (*ConnectHandler) DeleteProject added in v0.76.1

func (*ConnectHandler) DeleteProspect added in v0.75.0

func (*ConnectHandler) DeleteRelation added in v0.76.0

func (*ConnectHandler) DeleteRole added in v0.74.0

func (*ConnectHandler) DeleteUser added in v0.75.0

func (*ConnectHandler) DisableGroup added in v0.76.0

func (*ConnectHandler) DisableProject added in v0.76.0

func (*ConnectHandler) DisableUser added in v0.75.0

func (*ConnectHandler) EnableGroup added in v0.76.0

func (*ConnectHandler) EnableProject added in v0.76.0

func (*ConnectHandler) EnableUser added in v0.75.0

func (*ConnectHandler) ExportAuditRecords added in v0.75.0

func (*ConnectHandler) ExportOrganizationProjects added in v0.73.0

func (*ConnectHandler) ExportOrganizationTokens added in v0.73.0

func (*ConnectHandler) ExportOrganizationUsers added in v0.73.0

func (*ConnectHandler) ExportOrganizations added in v0.71.0

func (*ConnectHandler) ExportUsers added in v0.73.0

func (*ConnectHandler) GetCheckout added in v0.76.0

func (*ConnectHandler) GetCurrentUser added in v0.75.0

func (*ConnectHandler) GetFeature added in v0.76.0

func (*ConnectHandler) GetGroup added in v0.76.0

func (*ConnectHandler) GetJWKs added in v0.76.0

func (*ConnectHandler) GetLoggedInPrincipal added in v0.69.0

func (h *ConnectHandler) GetLoggedInPrincipal(ctx context.Context, via ...authenticate.ClientAssertion) (authenticate.Principal, error)

func (*ConnectHandler) GetNamespace added in v0.76.0

func (*ConnectHandler) GetPermission added in v0.76.0

func (*ConnectHandler) GetPlan added in v0.76.0

func (*ConnectHandler) GetPolicy added in v0.76.0

func (*ConnectHandler) GetProduct added in v0.76.0

func (*ConnectHandler) GetProject added in v0.76.0

func (*ConnectHandler) GetProspect added in v0.75.0

func (*ConnectHandler) GetRawCheckout added in v0.69.0

func (h *ConnectHandler) GetRawCheckout(ctx context.Context, id string, request connect.AnyRequest) (checkout.Checkout, error)

func (*ConnectHandler) GetRelation added in v0.76.0

func (*ConnectHandler) GetServiceUser added in v0.69.0

func (*ConnectHandler) GetUser added in v0.75.0

func (*ConnectHandler) HasTrialed added in v0.76.0

func (*ConnectHandler) IsAuthorized added in v0.69.0

func (h *ConnectHandler) IsAuthorized(ctx context.Context, object relation.Object, permission string, request connect.AnyRequest) error

func (*ConnectHandler) IsSuperUser added in v0.69.0

func (h *ConnectHandler) IsSuperUser(ctx context.Context, request connect.AnyRequest) error

func (*ConnectHandler) IsUserIDSuperUser added in v0.76.2

func (h *ConnectHandler) IsUserIDSuperUser(ctx context.Context, userID string) (bool, error)

IsUserIDSuperUser returns true if the user ID is a super user

func (*ConnectHandler) ListCheckouts added in v0.76.0

func (*ConnectHandler) ListFeatures added in v0.76.0

func (*ConnectHandler) ListGroupUsers added in v0.76.0

func (*ConnectHandler) ListGroups added in v0.74.0

func (*ConnectHandler) ListInvoices added in v0.76.0

func (*ConnectHandler) ListNamespaces added in v0.76.0

func (*ConnectHandler) ListPlans added in v0.76.0

func (*ConnectHandler) ListPlatformPreferences added in v0.69.0

func (h *ConnectHandler) ListPlatformPreferences(ctx context.Context) (map[string]string, error)

func (*ConnectHandler) ListPolicies added in v0.76.0

func (*ConnectHandler) ListProducts added in v0.76.0

func (*ConnectHandler) ListProjects added in v0.74.0

func (*ConnectHandler) ListProspects added in v0.75.0

func (*ConnectHandler) ListRelations added in v0.74.0

func (*ConnectHandler) ListResources added in v0.74.0

func (*ConnectHandler) ListRoles added in v0.76.0

func (*ConnectHandler) ListSessions added in v0.75.0

SDK APIs Returns a list of all sessions for the current authenticated user.

func (*ConnectHandler) ListUserGroups added in v0.75.0

func (*ConnectHandler) ListUserSessions added in v0.75.0

Admin APIs Returns a list of all sessions for a specific user.

func (*ConnectHandler) PingUserSession added in v0.75.0

Ping user current active session.

func (*ConnectHandler) RevokeSession added in v0.75.0

Revoke a specific session for the current authenticated user.

func (*ConnectHandler) RevokeUserSession added in v0.75.0

Revoke a specific session for a specific user (admin only).

func (*ConnectHandler) SearchInvoices added in v0.74.0

func (*ConnectHandler) SearchUsers added in v0.73.0

func (*ConnectHandler) UpdateFeature added in v0.76.1

func (*ConnectHandler) UpdateGroup added in v0.76.0

func (*ConnectHandler) UpdatePermission added in v0.74.0

UpdatePermission should only be used to update permission metadata at the moment

func (*ConnectHandler) UpdateProduct added in v0.76.0

func (*ConnectHandler) UpdateProject added in v0.76.0

func (*ConnectHandler) UpdateProspect added in v0.75.0

func (*ConnectHandler) UpdateRole added in v0.74.0

func (*ConnectHandler) UpdateUser added in v0.75.0

type CreditService added in v0.75.0

type CreditService interface {
	List(ctx context.Context, filter credit.Filter) ([]credit.Transaction, error)
	GetBalance(ctx context.Context, accountID string) (int64, error)
	GetTotalDebitedAmount(ctx context.Context, accountID string) (int64, error)
}

type CustomerService added in v0.74.0

type CustomerService interface {
	GetByID(ctx context.Context, id string) (customer.Customer, error)
	Create(ctx context.Context, customer customer.Customer, offline bool) (customer.Customer, error)
	List(ctx context.Context, filter customer.Filter) ([]customer.Customer, error)
	Delete(ctx context.Context, id string) error
	ListPaymentMethods(ctx context.Context, id string) ([]customer.PaymentMethod, error)
	Update(ctx context.Context, customer customer.Customer) (customer.Customer, error)
	RegisterToProviderIfRequired(ctx context.Context, customerID string) (customer.Customer, error)
	Disable(ctx context.Context, id string) error
	Enable(ctx context.Context, id string) error
	UpdateCreditMinByID(ctx context.Context, customerID string, limit int64) (customer.Details, error)
	GetDetails(ctx context.Context, customerID string) (customer.Details, error)
	UpdateDetails(ctx context.Context, customerID string, details customer.Details) (customer.Details, error)
}

type DomainService added in v0.82.0

type DomainService interface {
	Get(ctx context.Context, id string) (domain.Domain, error)
	List(ctx context.Context, flt domain.Filter) ([]domain.Domain, error)
	ListJoinableOrgsByDomain(ctx context.Context, email string) ([]string, error)
	Delete(ctx context.Context, id string) error
	Create(ctx context.Context, toCreate domain.Domain) (domain.Domain, error)
	VerifyDomain(ctx context.Context, id string) (domain.Domain, error)
	Join(ctx context.Context, orgID string, userID string) error
}

type EntitlementService added in v0.76.0

type EntitlementService interface {
	Check(ctx context.Context, customerID, featureID string) (bool, error)
	CheckPlanEligibility(ctx context.Context, customerID string) error
}

type ErrorLogger added in v0.80.1

type ErrorLogger struct{}

ErrorLogger provides centralized error logging functionality for Connect handlers

func NewErrorLogger added in v0.80.1

func NewErrorLogger() *ErrorLogger

NewErrorLogger creates a new ErrorLogger instance

func (*ErrorLogger) LogServiceError added in v0.80.1

func (e *ErrorLogger) LogServiceError(ctx context.Context, req connect.AnyRequest, operation string, err error, contextFields ...zap.Field)

LogServiceError logs detailed service error information with context

func (*ErrorLogger) LogTransformError added in v0.80.1

func (e *ErrorLogger) LogTransformError(ctx context.Context, req connect.AnyRequest, operation string, entityID string, err error)

LogTransformError logs protobuf transformation errors

func (*ErrorLogger) LogUnexpectedError added in v0.80.1

func (e *ErrorLogger) LogUnexpectedError(ctx context.Context, req connect.AnyRequest, operation string, err error, contextFields ...zap.Field)

LogUnexpectedError logs additional context for unexpected internal errors

type EventService added in v0.76.0

type EventService interface {
	BillingWebhook(ctx context.Context, event event.ProviderWebhookEvent) error
}

type GroupService added in v0.82.0

type GroupService interface {
	Create(ctx context.Context, grp group.Group) (group.Group, error)
	Get(ctx context.Context, id string) (group.Group, error)
	List(ctx context.Context, flt group.Filter) ([]group.Group, error)
	Update(ctx context.Context, grp group.Group) (group.Group, error)
	ListByUser(ctx context.Context, principalId, principalType string, flt group.Filter) ([]group.Group, error)
	AddUsers(ctx context.Context, groupID string, userID []string) error
	RemoveUsers(ctx context.Context, groupID string, userID []string) error
	Enable(ctx context.Context, id string) error
	Disable(ctx context.Context, id string) error
	Delete(ctx context.Context, id string) error
}

type InvitationService added in v0.82.0

type InvitationService interface {
	Get(ctx context.Context, id uuid.UUID) (invitation.Invitation, error)
	List(ctx context.Context, filter invitation.Filter) ([]invitation.Invitation, error)
	ListByUser(ctx context.Context, userID string) ([]invitation.Invitation, error)
	Create(ctx context.Context, inv invitation.Invitation) (invitation.Invitation, error)
	Accept(ctx context.Context, id uuid.UUID) error
	Delete(ctx context.Context, id uuid.UUID) error
}

type InvoiceService added in v0.74.0

type InvoiceService interface {
	List(ctx context.Context, filter invoice.Filter) ([]invoice.Invoice, error)
	ListAll(ctx context.Context, filter invoice.Filter) ([]invoice.Invoice, error)
	GetUpcoming(ctx context.Context, customerID string) (invoice.Invoice, error)
	TriggerCreditOverdraftInvoices(ctx context.Context) error
	SearchInvoices(ctx context.Context, rqlQuery *rql.Query) ([]invoice.InvoiceWithOrganization, error)
}

type JsonWebKeySet added in v0.75.0

type JsonWebKeySet struct {
	Keys []*frontierv1beta1.JSONWebKey `json:"keys"`
}

type KycService added in v0.73.0

type KycService interface {
	GetKyc(context.Context, string) (kyc.KYC, error)
	SetKyc(context.Context, kyc.KYC) (kyc.KYC, error)
	ListKycs(context.Context) ([]kyc.KYC, error)
}

type MetaSchemaService added in v0.76.0

type MetaSchemaService interface {
	Get(ctx context.Context, id string) (metaschema.MetaSchema, error)
	Create(ctx context.Context, toCreate metaschema.MetaSchema) (metaschema.MetaSchema, error)
	List(ctx context.Context) ([]metaschema.MetaSchema, error)
	Update(ctx context.Context, id string, toUpdate metaschema.MetaSchema) (metaschema.MetaSchema, error)
	Delete(ctx context.Context, id string) error
	Validate(schema metadata.Metadata, data string) error
}

type NamespaceService added in v0.76.0

type NamespaceService interface {
	Get(ctx context.Context, id string) (namespace.Namespace, error)
	List(ctx context.Context) ([]namespace.Namespace, error)
	Upsert(ctx context.Context, ns namespace.Namespace) (namespace.Namespace, error)
	Update(ctx context.Context, ns namespace.Namespace) (namespace.Namespace, error)
}

type OrgBillingService added in v0.71.0

type OrgBillingService interface {
	Search(ctx context.Context, query *rql.Query) (orgbilling.OrgBilling, error)
	Export(ctx context.Context) ([]byte, string, error)
}

type OrgInvoicesService added in v0.71.0

type OrgInvoicesService interface {
	Search(ctx context.Context, id string, query *rql.Query) (orginvoices.OrganizationInvoices, error)
}

type OrgProjectsService added in v0.71.0

type OrgProjectsService interface {
	Search(ctx context.Context, id string, query *rql.Query) (orgprojects.OrgProjects, error)
	Export(ctx context.Context, orgID string) ([]byte, string, error)
}

type OrgServiceUserCredentialsService added in v0.71.0

type OrgServiceUserCredentialsService interface {
	Search(ctx context.Context, id string, query *rql.Query) (svc.OrganizationServiceUserCredentials, error)
}

type OrgServiceUserService added in v0.75.0

type OrgServiceUserService interface {
	Search(ctx context.Context, orgID string, query *rql.Query) (orgserviceuser.OrganizationServiceUsers, error)
}

type OrgTokensService added in v0.71.0

type OrgTokensService interface {
	Search(ctx context.Context, id string, query *rql.Query) (orgtokens.OrganizationTokens, error)
	Export(ctx context.Context, orgID string) ([]byte, string, error)
}

type OrgUsersService added in v0.71.0

type OrgUsersService interface {
	Search(ctx context.Context, id string, query *rql.Query) (orgusers.OrgUsers, error)
	Export(ctx context.Context, orgID string) ([]byte, string, error)
}

type OrganizationService added in v0.82.0

type PermissionService added in v0.74.0

type PermissionService interface {
	Get(ctx context.Context, id string) (permission.Permission, error)
	List(ctx context.Context, filter permission.Filter) ([]permission.Permission, error)
	Upsert(ctx context.Context, perm permission.Permission) (permission.Permission, error)
	Update(ctx context.Context, perm permission.Permission) (permission.Permission, error)
}

type PlanService added in v0.76.0

type PlanService interface {
	GetByID(ctx context.Context, id string) (plan.Plan, error)
	Create(ctx context.Context, plan plan.Plan) (plan.Plan, error)
	List(ctx context.Context, filter plan.Filter) ([]plan.Plan, error)
	UpsertPlans(ctx context.Context, planFile plan.File) error
}

type PolicyService added in v0.76.0

type PolicyService interface {
	Get(ctx context.Context, id string) (policy.Policy, error)
	List(ctx context.Context, f policy.Filter) ([]policy.Policy, error)
	Create(ctx context.Context, pol policy.Policy) (policy.Policy, error)
	Delete(ctx context.Context, id string) error
	ListRoles(ctx context.Context, principalType, principalID, objectNamespace, objectID string) ([]role.Role, error)
}

type PreferenceService added in v0.82.0

type PreferenceService interface {
	Create(ctx context.Context, preference preference.Preference) (preference.Preference, error)
	Describe(ctx context.Context) []preference.Trait
	List(ctx context.Context, filter preference.Filter) ([]preference.Preference, error)
	LoadPlatformPreferences(ctx context.Context) (map[string]string, error)
}

type ProductService added in v0.76.0

type ProductService interface {
	GetByID(ctx context.Context, id string) (product.Product, error)
	Create(ctx context.Context, product product.Product) (product.Product, error)
	Update(ctx context.Context, product product.Product) (product.Product, error)
	List(ctx context.Context, filter product.Filter) ([]product.Product, error)
	UpsertFeature(ctx context.Context, feature product.Feature) (product.Feature, error)
	GetFeatureByID(ctx context.Context, id string) (product.Feature, error)
	ListFeatures(ctx context.Context, filter product.Filter) ([]product.Feature, error)
}

type ProjectService added in v0.82.0

type ProjectService interface {
	Get(ctx context.Context, idOrName string) (project.Project, error)
	Create(ctx context.Context, prj project.Project) (project.Project, error)
	List(ctx context.Context, f project.Filter) ([]project.Project, error)
	ListByUser(ctx context.Context, principalID, principalType string, flt project.Filter) ([]project.Project, error)
	Update(ctx context.Context, toUpdate project.Project) (project.Project, error)
	ListUsers(ctx context.Context, id string, permissionFilter string) ([]user.User, error)
	ListServiceUsers(ctx context.Context, id string, permissionFilter string) ([]serviceuser.ServiceUser, error)
	ListGroups(ctx context.Context, id string) ([]group.Group, error)
	Enable(ctx context.Context, id string) error
	Disable(ctx context.Context, id string) error
}

type ProjectUsersService added in v0.74.0

type ProjectUsersService interface {
	Search(ctx context.Context, id string, query *rql.Query) (projectusers.ProjectUsers, error)
}

type ProspectService added in v0.75.0

type ProspectService interface {
	Create(ctx context.Context, prospect prospect.Prospect) (prospect.Prospect, error)
	List(ctx context.Context, query *rql.Query) (prospect.ListProspects, error)
	Get(ctx context.Context, prospectId string) (prospect.Prospect, error)
	Update(ctx context.Context, prospect prospect.Prospect) (prospect.Prospect, error)
	Delete(ctx context.Context, prospectId string) error
}

type RelationService added in v0.74.0

type RelationService interface {
	Get(ctx context.Context, id string) (relation.Relation, error)
	Create(ctx context.Context, rel relation.Relation) (relation.Relation, error)
	List(ctx context.Context, f relation.Filter) ([]relation.Relation, error)
	Delete(ctx context.Context, rel relation.Relation) error
}

type ResourceService added in v0.82.0

type ResourceService interface {
	Get(ctx context.Context, id string) (resource.Resource, error)
	List(ctx context.Context, flt resource.Filter) ([]resource.Resource, error)
	Create(ctx context.Context, resource resource.Resource) (resource.Resource, error)
	Update(ctx context.Context, resource resource.Resource) (resource.Resource, error)
	Delete(ctx context.Context, namespace, id string) error
	CheckAuthz(ctx context.Context, check resource.Check) (bool, error)
	BatchCheck(ctx context.Context, checks []resource.Check) ([]relation.CheckPair, error)
}

type RoleService added in v0.74.0

type RoleService interface {
	Get(ctx context.Context, id string) (role.Role, error)
	Upsert(ctx context.Context, toCreate role.Role) (role.Role, error)
	List(ctx context.Context, f role.Filter) ([]role.Role, error)
	Update(ctx context.Context, toUpdate role.Role) (role.Role, error)
	Delete(ctx context.Context, id string) error
}

type ServiceUserService added in v0.82.0

type ServiceUserService interface {
	List(ctx context.Context, flt serviceuser.Filter) ([]serviceuser.ServiceUser, error)
	ListAll(ctx context.Context) ([]serviceuser.ServiceUser, error)
	Create(ctx context.Context, serviceUser serviceuser.ServiceUser) (serviceuser.ServiceUser, error)
	Get(ctx context.Context, id string) (serviceuser.ServiceUser, error)
	Delete(ctx context.Context, id string) error
	ListKeys(ctx context.Context, serviceUserID string) ([]serviceuser.Credential, error)
	CreateKey(ctx context.Context, cred serviceuser.Credential) (serviceuser.Credential, error)
	GetKey(ctx context.Context, credID string) (serviceuser.Credential, error)
	DeleteKey(ctx context.Context, credID string) error
	CreateSecret(ctx context.Context, credential serviceuser.Credential) (serviceuser.Secret, error)
	ListSecret(ctx context.Context, serviceUserID string) ([]serviceuser.Credential, error)
	DeleteSecret(ctx context.Context, credID string) error
	CreateToken(ctx context.Context, credential serviceuser.Credential) (serviceuser.Token, error)
	ListToken(ctx context.Context, serviceUserID string) ([]serviceuser.Credential, error)
	DeleteToken(ctx context.Context, credID string) error
	ListByOrg(ctx context.Context, orgID string) ([]serviceuser.ServiceUser, error)
	IsSudo(ctx context.Context, id string, permissionName string) (bool, error)
	Sudo(ctx context.Context, id string, relationName string) error
	UnSudo(ctx context.Context, id string) error
	GetByIDs(ctx context.Context, ids []string) ([]serviceuser.ServiceUser, error)
}

type SessionService added in v0.82.0

type SessionService interface {
	ExtractFromContext(ctx context.Context) (*frontiersession.Session, error)
	Create(ctx context.Context, userID string, metadata frontiersession.SessionMetadata) (*frontiersession.Session, error)
	GetByID(ctx context.Context, sessionID uuid.UUID) (*frontiersession.Session, error)
	Refresh(ctx context.Context, sessionID uuid.UUID) error
	List(ctx context.Context, userID string) ([]*frontiersession.Session, error)
	Delete(ctx context.Context, sessionID uuid.UUID) error
	Ping(ctx context.Context, sessionID uuid.UUID, metadata frontiersession.SessionMetadata) error
}

type SubscriptionService added in v0.76.0

type SubscriptionService interface {
	GetByID(ctx context.Context, id string) (subscription.Subscription, error)
	List(ctx context.Context, filter subscription.Filter) ([]subscription.Subscription, error)
	Cancel(ctx context.Context, id string, immediate bool) (subscription.Subscription, error)
	ChangePlan(ctx context.Context, id string, change subscription.ChangeRequest) (subscription.Phase, error)
	HasUserSubscribedBefore(ctx context.Context, customerID string, planID string) (bool, error)
}

type UsageService added in v0.74.0

type UsageService interface {
	Report(ctx context.Context, usages []usage.Usage) error
	Revert(ctx context.Context, accountID, usageID string, amount int64) error
}

type UserOrgsService added in v0.73.0

type UserOrgsService interface {
	Search(ctx context.Context, id string, query *rql.Query) (userorgs.UserOrgs, error)
}

type UserProjectsService added in v0.73.0

type UserProjectsService interface {
	Search(ctx context.Context, userId string, orgId string, query *rql.Query) (userprojects.UserProjects, error)
}

type UserService added in v0.82.0

type UserService interface {
	GetByID(ctx context.Context, id string) (user.User, error)
	GetByIDs(ctx context.Context, userIDs []string) ([]user.User, error)
	GetByEmail(ctx context.Context, email string) (user.User, error)
	Create(ctx context.Context, user user.User) (user.User, error)
	List(ctx context.Context, flt user.Filter) ([]user.User, error)
	ListByOrg(ctx context.Context, orgID string, roleFilter string) ([]user.User, error)
	ListByGroup(ctx context.Context, groupID string, roleFilter string) ([]user.User, error)
	Update(ctx context.Context, toUpdate user.User) (user.User, error)
	Enable(ctx context.Context, id string) error
	Disable(ctx context.Context, id string) error
	IsSudo(ctx context.Context, id string, permissionName string) (bool, error)
	Sudo(ctx context.Context, id string, relationName string) error
	UnSudo(ctx context.Context, id string) error
	Search(ctx context.Context, rql *rql.Query) (user.SearchUserResponse, error)
	Export(ctx context.Context) ([]byte, string, error)
}

type WebhookService added in v0.75.0

type WebhookService interface {
	CreateEndpoint(ctx context.Context, endpoint webhook.Endpoint) (webhook.Endpoint, error)
	UpdateEndpoint(ctx context.Context, endpoint webhook.Endpoint) (webhook.Endpoint, error)
	DeleteEndpoint(ctx context.Context, id string) error
	ListEndpoints(ctx context.Context, filter webhook.EndpointFilter) ([]webhook.Endpoint, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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