Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Provider
- func (p *Provider) ConfiguredProviderViolations(ctx context.Context, c kclient.Client) ([]ProviderViolation, error)
- func (p *Provider) Entitlements() []string
- func (p *Provider) HasValidLicense() bool
- func (p *Provider) LicenseKey() string
- func (p *Provider) LicenseKeyViaConfiguration() bool
- func (p *Provider) MissingEntitlements(requiredEntitlements []string) []string
- func (p *Provider) RemoveLicenseKey(ctx context.Context) error
- func (p *Provider) RequireEntitlements(requiredEntitlements []string) error
- func (p *Provider) SetLicenseKey(ctx context.Context, licenseKey string) error
- type ProviderEntitlementGate
- type ProviderMeta
- type ProviderViolation
Constants ¶
View Source
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" // EnterpriseModelProvidersEntitlement is required to enable enterprise model providers. EnterpriseModelProvidersEntitlement = "OBOT_ENTERPRISE_MODEL_PROVIDERS" )
Variables ¶
View Source
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 ¶
This section is empty.
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) ConfiguredProviderViolations ¶
func (p *Provider) ConfiguredProviderViolations(ctx context.Context, c kclient.Client) ([]ProviderViolation, error)
ConfiguredProviderViolations returns any globally configured auth/model providers that are currently missing required license entitlements.
func (*Provider) Entitlements ¶
func (*Provider) HasValidLicense ¶
func (*Provider) LicenseKey ¶
func (*Provider) LicenseKeyViaConfiguration ¶
func (*Provider) MissingEntitlements ¶
Missing returns the required entitlements that are unavailable from the current license.
func (*Provider) RequireEntitlements ¶
Require returns Payment Required if any required entitlements are unavailable.
type ProviderEntitlementGate ¶
type ProviderEntitlementGate struct {
// contains filtered or unexported fields
}
func NewProviderEntitlementGate ¶
func NewProviderEntitlementGate(licenseProvider *Provider, client kclient.Client) *ProviderEntitlementGate
type ProviderMeta ¶
type ProviderMeta struct {
RequiredEntitlements []string `json:"requiredEntitlements"`
EnvVars []types.ProviderConfigurationParameter `json:"envVars"`
}
type ProviderViolation ¶
type ProviderViolation struct {
Type string `json:"type"`
Namespace string `json:"namespace"`
Name string `json:"name"`
RequiredEntitlements []string `json:"requiredEntitlements"`
MissingEntitlements []string `json:"missingEntitlements"`
}
ProviderViolation describes a configured provider that requires license entitlements that are not currently available.
Click to show internal directories.
Click to hide internal directories.