license

package
v0.0.0-...-926d3c4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package license makes HTTP requests to a license generation service to obtain trial licenses

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientError

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

ClientError is returned when the license-generation-server returns an error code in the 4xx range

func (*ClientError) Error

func (h *ClientError) Error() string

type Fetcher

type Fetcher interface {
	RequestLicense(ctx context.Context, customerName string) (license *TrialLicense, err error)
}

Fetcher requests licenses from a license-generation-service.

func NewFetcher

func NewFetcher(licGenURL *url.URL, apiKey string, trialDays int) Fetcher

NewFetcher returns a new trial license fetcher configured to talk to the license-generation-service at licGenURL. The fetcher will request license that expire trialDays from now.

type ServerError

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

ServerError is returned when the license-generation-server returns an error code in the 5xx range

func (*ServerError) Error

func (h *ServerError) Error() string

type TrialLicense

type TrialLicense struct {
	License    string
	CustomerID string
}

TrialLicense is returned by RequestLicense and contains the generated License and the assigned CustomerID.

func (*TrialLicense) ID

func (tl *TrialLicense) ID() (string, error)

ID returns the TrialLicense's ID (decoded from the license JWT)

Jump to

Keyboard shortcuts

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