license

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package license provides functions to check a user's Constellation license.

Index

Constants

View Source
const (
	// CommunityLicense is used by everyone who has not bought an enterprise license.
	CommunityLicense = "00000000-0000-0000-0000-000000000000"
)

Variables

This section is empty.

Functions

func FromFile

func FromFile(fileHandler file.Handler, path string) (string, error)

FromFile reads the license from fileHandler at path and returns it as a string.

Types

type Action

type Action string

Action performed by Constellation.

const (
	// Init action denotes the initialization of a Constellation cluster.
	Init Action = "init"
)

type Checker

type Checker struct{}

Checker checks the Constellation license.

func NewChecker

func NewChecker(quotaChecker QuotaChecker, fileHandler file.Handler) *Checker

NewChecker creates a new Checker.

func (*Checker) CheckLicense

func (c *Checker) CheckLicense(ctx context.Context, provider cloudprovider.Provider, providerCfg config.ProviderConfig, printer func(string, ...any)) error

CheckLicense is a no-op for open source version of Constellation.

type Client

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

Client interacts with the ES license server.

func NewClient

func NewClient() *Client

NewClient creates a new client to interact with ES license server.

func (*Client) QuotaCheck

func (c *Client) QuotaCheck(ctx context.Context, checkRequest QuotaCheckRequest) (QuotaCheckResponse, error)

QuotaCheck for a given license and action, passed via CheckQuotaRequest.

type QuotaCheckRequest

type QuotaCheckRequest struct {
	Action   Action `json:"action"`
	Provider string `json:"provider"`
	License  string `json:"license"`
}

QuotaCheckRequest is JSON request to license server to check quota for a given license and action.

type QuotaCheckResponse

type QuotaCheckResponse struct {
	Quota int `json:"quota"`
}

QuotaCheckResponse is JSON response by license server.

type QuotaChecker

type QuotaChecker interface {
	QuotaCheck(ctx context.Context, checkRequest QuotaCheckRequest) (QuotaCheckResponse, error)
}

QuotaChecker checks the vCPU quota for a given license.

Jump to

Keyboard shortcuts

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