v1beta1connect

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 82 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 AuditService added in v0.76.0

type AuditService interface {
	List(ctx context.Context, filter audit.Filter) ([]audit.Log, error)
	GetByID(ctx context.Context, id string) (audit.Log, error)
	Create(ctx context.Context, log *audit.Log) error
}

type BootstrapService added in v0.74.0

type BootstrapService interface {
	AppendSchema(ctx context.Context, definition schema.ServiceDefinition) 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) 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) (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) error

func (*ConnectHandler) IsSuperUser added in v0.69.0

func (h *ConnectHandler) IsSuperUser(ctx context.Context) 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 {
	GetBalance(ctx context.Context, id 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)
	Update(ctx context.Context, customer customer.Customer) (customer.Customer, error)
	Delete(ctx context.Context, id string) 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)
	ListPaymentMethods(ctx context.Context, id string) ([]customer.PaymentMethod, error)
	UpdateDetails(ctx context.Context, customerID string, details customer.Details) (customer.Details, 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 EventService added in v0.76.0

type EventService interface {
	BillingWebhook(ctx context.Context, event event.ProviderWebhookEvent) 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
}

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) (svc.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 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
}

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