v1beta1

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest            = errors.New("invalid syntax in body")
	ErrInvalidMetadata       = errors.New("metadata schema validation failed")
	ErrConflictRequest       = errors.New("already exist")
	ErrRequestBodyValidation = errors.New("invalid format for field(s)")
	ErrEmptyEmailID          = errors.New("email id is empty")
	ErrEmailConflict         = errors.New("user email can't be updated")
	ErrOperationUnsupported  = errors.New("operation not supported")
)

HTTP Codes defined here: https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L36

View Source
var (
	ErrNamespaceSplitNotation = errors.New("subject/object should be provided as 'namespace:uuid'")
)

Functions

func ErrInvalidInput added in v0.8.36

func ErrInvalidInput(err string) error

func Register

func Register(s *grpc.Server, deps api.Deps, authConf authenticate.Config)

Types

type AuditService

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 AuthnService

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, principalID string, 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

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

type CascadeDeleter

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.8.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 CreditService added in v0.8.0

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

type CustomerService added in v0.8.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
}

type DomainService added in v0.7.2

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.8.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.13.0

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

type GroupService

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 Handler

type Handler struct {
	frontierv1beta1.UnimplementedFrontierServiceServer
	frontierv1beta1.UnimplementedAdminServiceServer
	// contains filtered or unexported fields
}

func (Handler) AddPlatformUser added in v0.8.0

func (Handler) CancelSubscription added in v0.8.0

func (Handler) ChangeSubscription added in v0.8.19

func (Handler) CheckPlanEntitlement added in v0.8.18

func (h Handler) CheckPlanEntitlement(ctx context.Context, obj relation.Object) error

CheckPlanEntitlement is only currently used to restrict seat based plans

func (Handler) CreateBillingAccount added in v0.8.0

func (Handler) CreateBillingUsage added in v0.8.0

func (Handler) CreateCheckout added in v0.8.0

func (Handler) CreateFeature added in v0.8.0

func (Handler) CreateGroupPreferences added in v0.7.3

func (Handler) CreatePlan added in v0.8.0

func (Handler) CreatePolicyForProject added in v0.19.0

func (Handler) CreatePreferences added in v0.7.3

func (Handler) CreateProduct added in v0.8.14

func (Handler) CreateServiceUserJWK added in v0.9.1

func (Handler) CreateServiceUserToken added in v0.9.1

func (Handler) CreateUserPreferences added in v0.7.3

func (Handler) CreateWebhook added in v0.11.0

func (Handler) DelegatedCheckout added in v0.8.16

func (Handler) DeleteBillingAccount added in v0.8.0

func (Handler) DeletePermission added in v0.7.3

func (Handler) DeleteServiceUserJWK added in v0.9.1

func (Handler) DeleteServiceUserToken added in v0.9.1

func (Handler) DeleteWebhook added in v0.11.0

func (Handler) DescribePreferences added in v0.7.3

func (Handler) DisableBillingAccount added in v0.17.0

func (Handler) EnableBillingAccount added in v0.17.0

func (Handler) GetBillingAccount added in v0.8.0

func (Handler) GetBillingBalance added in v0.8.0

func (Handler) GetCheckout added in v0.21.0

func (Handler) GetFeature added in v0.8.0

func (Handler) GetLoggedInPrincipal

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

func (Handler) GetOrganizationDomain added in v0.7.2

func (Handler) GetPlan added in v0.8.0

func (Handler) GetProduct added in v0.8.14

func (Handler) GetRawCheckout added in v0.21.0

func (h Handler) GetRawCheckout(ctx context.Context, id string) (checkout.Checkout, error)

func (Handler) GetRequestCustomerID added in v0.8.36

func (h Handler) GetRequestCustomerID(ctx context.Context, request any) (string, error)

GetRequestCustomerID returns the customer id from the request via reflection(billing_id/id) or defaults to first customer id present in the org

func (Handler) GetServiceUserJWK added in v0.9.1

func (Handler) GetSubscription added in v0.8.0

func (Handler) GetUpcomingInvoice added in v0.8.13

func (Handler) HasTrialed added in v0.8.36

func (Handler) IsAuthorized

func (h Handler) IsAuthorized(ctx context.Context, object relation.Object, permission string) error

func (Handler) IsSuperUser

func (h Handler) IsSuperUser(ctx context.Context) error

func (Handler) JoinOrganization added in v0.7.2

func (Handler) ListAllBillingAccounts added in v0.8.29

func (Handler) ListAllInvoices added in v0.8.26

func (Handler) ListBillingAccounts added in v0.8.0

func (Handler) ListCheckouts added in v0.8.0

func (Handler) ListFeatures added in v0.8.0

func (Handler) ListGroupPreferences added in v0.7.3

func (Handler) ListInvoices added in v0.8.13

func (Handler) ListPlans added in v0.8.0

func (Handler) ListPlatformPreferences added in v0.7.13

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

func (Handler) ListPlatformUsers added in v0.8.8

func (Handler) ListPreferences added in v0.7.3

func (Handler) ListProducts added in v0.8.14

func (Handler) ListProjectGroups added in v0.7.6

func (Handler) ListProjectPreferences added in v0.7.3

func (Handler) ListProjectsByUser added in v0.7.5

func (Handler) ListServiceUserJWKs added in v0.9.1

func (Handler) ListServiceUserTokens added in v0.9.1

func (Handler) ListSubscriptions added in v0.8.0

func (Handler) ListUserPreferences added in v0.7.3

func (Handler) ListWebhooks added in v0.11.0

func (Handler) RegisterBillingAccount added in v0.17.0

func (Handler) RemovePlatformUser added in v0.14.0

func (Handler) RevertBillingUsage added in v0.8.37

func (Handler) UpdateBillingAccount added in v0.8.15

func (Handler) UpdateFeature added in v0.8.0

func (Handler) UpdatePermission

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

func (Handler) UpdateProduct added in v0.8.14

func (Handler) UpdateRole added in v0.7.2

func (Handler) UpdateWebhook added in v0.11.0

type InvitationService

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

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

type JsonWebKeySet

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

type MetaSchemaService

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 OrganizationService

type OrganizationService interface {
	Get(ctx context.Context, idOrSlug string) (organization.Organization, error)
	GetRaw(ctx context.Context, idOrSlug string) (organization.Organization, error)
	Create(ctx context.Context, org organization.Organization) (organization.Organization, error)
	List(ctx context.Context, f organization.Filter) ([]organization.Organization, error)
	Update(ctx context.Context, toUpdate organization.Organization) (organization.Organization, error)
	ListByUser(ctx context.Context, userID string, flt organization.Filter) ([]organization.Organization, error)
	AddUsers(ctx context.Context, orgID string, userID []string) error
	Enable(ctx context.Context, id string) error
	Disable(ctx context.Context, id string) error
}

type PlanService added in v0.8.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

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

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

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

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 RelationService

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

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

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

type ServiceUserService interface {
	List(ctx context.Context, flt serviceuser.Filter) ([]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

type SessionService interface {
	ExtractFromContext(ctx context.Context) (*frontiersession.Session, error)
	Create(ctx context.Context, userID string) (*frontiersession.Session, error)
	Delete(ctx context.Context, sessionID uuid.UUID) error
	Refresh(ctx context.Context, sessionID uuid.UUID) error
}

type SubscriptionService added in v0.8.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.8.0

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

type UserService

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
}

type WebhookService added in v0.11.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