Documentation
¶
Index ¶
- Constants
- Variables
- func GetDistributionFromEntitlements(entitlements []string) types.ProductTelemetryDistribution
- type Config
- type Provider
- func (p *Provider) DeviceLimit(ctx context.Context) (gatewayclient.DeviceLimit, error)
- func (p *Provider) Entitlements(ctx context.Context) ([]string, error)
- func (p *Provider) GetLicenseViolations(ctx context.Context, c kclient.Client) ([]Violation, error)
- func (p *Provider) HasValidLicense(ctx context.Context) (bool, error)
- func (p *Provider) LicenseKey(ctx context.Context) (string, error)
- func (p *Provider) LicenseKeyViaConfiguration() bool
- func (p *Provider) MachineFingerprint() string
- func (p *Provider) MissingEntitlements(ctx context.Context, requiredEntitlements []string) ([]string, error)
- func (p *Provider) RemoveLicenseKey(ctx context.Context) error
- func (p *Provider) RequireEntitlements(ctx context.Context, requiredEntitlements []string) error
- func (p *Provider) SetLicenseKey(ctx context.Context, licenseKey string) error
- func (p *Provider) UserLimit(ctx context.Context) (gatewayclient.UserLimit, error)
- func (p *Provider) Validate(ctx context.Context) error
- type ProviderEntitlementGate
- type Violation
Constants ¶
const ( // LicenseKeyPropertyKey is the database property key used to persist the Keygen license key. LicenseKeyPropertyKey = "obot-license-key" // LicenseMachineIDPropertyKey is the database property key used to persist the Keygen machine fingerprint. LicenseMachineIDPropertyKey = "obot-license-machine-id" // EnterpriseAuthProvidersEntitlement is required to enable enterprise auth providers. EnterpriseAuthProvidersEntitlement = "OBOT_ENTERPRISE_AUTH_PROVIDERS" // EnterpriseEntitlement is required to enable enterprise edition. EnterpriseEntitlement = "OBOT_ENTERPRISE" // CommunityEntitlement is required to enable community edition. CommunityEntitlement = "OBOT_COMMUNITY" // CloudEntitlement identifies Obot Cloud deployments. CloudEntitlement = "OBOT_CLOUD" // EnterpriseModelProvidersEntitlement is required to enable enterprise model providers. EnterpriseModelProvidersEntitlement = "OBOT_ENTERPRISE_MODEL_PROVIDERS" )
Variables ¶
var ( // ErrNotConfigured indicates license validation was requested without enough Keygen configuration. ErrNotConfigured = errors.New("license provider is not configured") // ErrLicenseKeyViaConfiguration indicates the license key is managed by startup configuration. ErrLicenseKeyViaConfiguration = errors.New("license key is configured at startup") // ErrInvalidLicense indicates the provided license key could not be validated. ErrInvalidLicense = errors.New("license key is invalid") )
Functions ¶
func GetDistributionFromEntitlements ¶ added in v0.26.0
func GetDistributionFromEntitlements(entitlements []string) types.ProductTelemetryDistribution
GetDistributionFromEntitlements returns the product distribution represented by the entitlements.
Types ¶
type Config ¶
type Config struct {
LicenseKey string `usage:"Keygen license key for this Obot installation"`
}
Config contains the Keygen settings needed to validate an Obot license.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(ctx context.Context, gatewayClient *client.Client, config Config) (*Provider, error)
NewProvider creates a Keygen-backed license provider.
func (*Provider) DeviceLimit ¶ added in v0.25.0
func (p *Provider) DeviceLimit(ctx context.Context) (gatewayclient.DeviceLimit, error)
DeviceLimit returns the maximum number of devices allowed by the current license. OBOT_ENTERPRISE grants unlimited devices unless one or more OBOT_ENTERPRISE_<number>_DEVICES entitlements define an additive limit.
func (*Provider) Entitlements ¶
func (*Provider) GetLicenseViolations ¶ added in v0.25.0
GetLicenseViolations returns all license violations for the configured auth/model providers and resource limits.
func (*Provider) HasValidLicense ¶
func (*Provider) LicenseKeyViaConfiguration ¶
func (*Provider) MachineFingerprint ¶ added in v0.26.0
MachineFingerprint returns the existing persisted installation identity.
func (*Provider) MissingEntitlements ¶
func (p *Provider) MissingEntitlements(ctx context.Context, requiredEntitlements []string) ([]string, error)
MissingEntitlements returns the required entitlements that are unavailable from the current database/config license key.
func (*Provider) RequireEntitlements ¶
RequireEntitlements returns Payment Required if any required entitlements are unavailable.
func (*Provider) SetLicenseKey ¶
type ProviderEntitlementGate ¶
type ProviderEntitlementGate struct {
// contains filtered or unexported fields
}
func NewProviderEntitlementGate ¶
func NewProviderEntitlementGate(licenseProvider *Provider, client kclient.Client) *ProviderEntitlementGate
type Violation ¶ added in v0.25.0
type Violation struct {
Type string `json:"type"`
Namespace string `json:"namespace"`
Name string `json:"name"`
RequiredEntitlements []string `json:"requiredEntitlements"`
MissingEntitlements []string `json:"missingEntitlements"`
Message string `json:"message"`
}
Violation describes a configured provider that requires license entitlements that are not currently available.