entitlements

package
v2.18.5 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLicenseRequiresTelemetry = xerrors.New("License requires telemetry but telemetry is disabled")

ErrLicenseRequiresTelemetry is an error returned by a fetch passed to Update to indicate that the fetched license cannot be used because it requires telemetry.

Functions

This section is empty.

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

func New

func New() *Set

func (*Set) AllowRefresh

func (l *Set) AllowRefresh(now time.Time) (bool, time.Duration)

AllowRefresh returns whether the entitlements are allowed to be refreshed. If it returns false, that means it was recently refreshed and the caller should wait the returned duration before trying again.

func (*Set) AsJSON

func (l *Set) AsJSON() json.RawMessage

AsJSON is used to return this to the api without exposing the entitlements for mutation.

func (*Set) Enabled

func (l *Set) Enabled(feature codersdk.FeatureName) bool

func (*Set) Errors added in v2.17.0

func (l *Set) Errors() []string

func (*Set) Feature

func (l *Set) Feature(name codersdk.FeatureName) (codersdk.Feature, bool)

func (*Set) FeatureChanged

func (l *Set) FeatureChanged(featureName codersdk.FeatureName, newFeature codersdk.Feature) (initial, changed, enabled bool)

func (*Set) Modify added in v2.17.0

func (l *Set) Modify(do func(entitlements *codersdk.Entitlements))

func (*Set) Update

func (l *Set) Update(ctx context.Context, fetch func(context.Context) (codersdk.Entitlements, error)) error

func (*Set) WriteEntitlementWarningHeaders

func (l *Set) WriteEntitlementWarningHeaders(header http.Header)

Jump to

Keyboard shortcuts

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