licensewrapper

package
v0.0.0-...-d3c205b Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 32

Documentation

Overview

Package licensewrapper provides a version-agnostic wrapper for KOTS License resources.

The LicenseWrapper type can hold either a v1beta1.License or v1beta2.License, providing a unified interface for accessing license properties regardless of the underlying version.

Usage:

// Load from file
wrapper, err := licensewrapper.LoadLicenseFromPath("/path/to/license.yaml")
if err != nil {
    log.Fatal(err)
}

// Load from bytes
wrapper, err := licensewrapper.LoadLicenseFromBytes(yamlData)
if err != nil {
    log.Fatal(err)
}

// Check version
if wrapper.IsV1() {
    // Working with v1beta1
}
if wrapper.IsV2() {
    // Working with v1beta2
}

// Access properties (works with both versions)
appSlug := wrapper.GetAppSlug()
licenseID := wrapper.GetLicenseID()
isAirgap := wrapper.IsAirgapSupported()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntitlementFieldWrapper

type EntitlementFieldWrapper struct {
	V1 *kotsv1beta1.EntitlementField
	V2 *kotsv1beta2.EntitlementField
}

EntitlementFieldWrapper holds either a v1beta1 or v1beta2 EntitlementField (never both). Exactly one field will be non-nil.

func (EntitlementFieldWrapper) GetDescription

func (w EntitlementFieldWrapper) GetDescription() string

GetDescription returns the entitlement description from whichever version is present

func (EntitlementFieldWrapper) GetSignature

func (w EntitlementFieldWrapper) GetSignature() []byte

GetSignature returns the entitlement signature from whichever version is present Abstracts the V1/V2 signature field difference

func (EntitlementFieldWrapper) GetTitle

func (w EntitlementFieldWrapper) GetTitle() string

GetTitle returns the entitlement title from whichever version is present

func (EntitlementFieldWrapper) GetValue

func (w EntitlementFieldWrapper) GetValue() interface{}

GetValue returns the entitlement value from whichever version is present EntitlementValue type is identical in both versions

func (EntitlementFieldWrapper) GetValueType

func (w EntitlementFieldWrapper) GetValueType() string

GetValueType returns the entitlement value type from whichever version is present

func (EntitlementFieldWrapper) IsHidden

func (w EntitlementFieldWrapper) IsHidden() bool

IsHidden returns whether the entitlement is hidden from whichever version is present

type LicenseWrapper

type LicenseWrapper struct {
	V1 *kotsv1beta1.License
	V2 *kotsv1beta2.License
}

LicenseWrapper holds either a v1beta1 or v1beta2 license (never both). Exactly one field will be non-nil.

func LoadLicenseFromBytes

func LoadLicenseFromBytes(data []byte) (LicenseWrapper, error)

LoadLicenseFromBytes deserializes license YAML/JSON bytes into a LicenseWrapper. It automatically detects whether the data contains a v1beta1 or v1beta2 License.

func LoadLicenseFromPath

func LoadLicenseFromPath(licenseFilePath string) (LicenseWrapper, error)

LoadLicenseFromPath loads a license from a file path and returns a LicenseWrapper

func (LicenseWrapper) GetAppSlug

func (w LicenseWrapper) GetAppSlug() string

GetAppSlug returns the app slug from whichever version is present

func (LicenseWrapper) GetChannelID

func (w LicenseWrapper) GetChannelID() string

GetChannelID returns the channel ID from whichever version is present

func (LicenseWrapper) GetChannelName

func (w LicenseWrapper) GetChannelName() string

GetChannelName returns the channel name from whichever version is present

func (LicenseWrapper) GetChannels

func (w LicenseWrapper) GetChannels() []kotsv1beta1.Channel

GetChannels returns the list of channels from whichever version is present Channel type is identical in both v1beta1 and v1beta2, so we return v1beta1.Channel

func (LicenseWrapper) GetCustomerEmail

func (w LicenseWrapper) GetCustomerEmail() string

GetCustomerEmail returns the customer email from whichever version is present

func (LicenseWrapper) GetCustomerID

func (w LicenseWrapper) GetCustomerID() string

GetCustomerID returns the customer ID from whichever version is present

func (LicenseWrapper) GetCustomerName

func (w LicenseWrapper) GetCustomerName() string

GetCustomerName returns the customer name from whichever version is present

func (LicenseWrapper) GetEndpoint

func (w LicenseWrapper) GetEndpoint() string

GetEndpoint returns the endpoint from whichever version is present

func (LicenseWrapper) GetEntitlements

func (w LicenseWrapper) GetEntitlements() map[string]EntitlementFieldWrapper

GetEntitlements returns the entitlements map from whichever version is present Returns wrapped entitlements for version-agnostic access

func (LicenseWrapper) GetLicenseID

func (w LicenseWrapper) GetLicenseID() string

GetLicenseID returns the license ID from whichever version is present

func (LicenseWrapper) GetLicenseSequence

func (w LicenseWrapper) GetLicenseSequence() int64

GetLicenseSequence returns the license sequence from whichever version is present

func (LicenseWrapper) GetLicenseType

func (w LicenseWrapper) GetLicenseType() string

GetLicenseType returns the license type from whichever version is present

func (LicenseWrapper) GetReplicatedProxyDomain

func (w LicenseWrapper) GetReplicatedProxyDomain() string

GetReplicatedProxyDomain returns the replicated proxy domain from whichever version is present

func (LicenseWrapper) GetSignature

func (w LicenseWrapper) GetSignature() []byte

GetSignature returns the license signature from whichever version is present

func (LicenseWrapper) IsAirgapSupported

func (w LicenseWrapper) IsAirgapSupported() bool

IsAirgapSupported returns whether airgap is supported from whichever version is present

func (LicenseWrapper) IsDisasterRecoverySupported

func (w LicenseWrapper) IsDisasterRecoverySupported() bool

IsDisasterRecoverySupported returns whether disaster recovery is supported from whichever version is present

func (LicenseWrapper) IsEmbeddedClusterDownloadEnabled

func (w LicenseWrapper) IsEmbeddedClusterDownloadEnabled() bool

IsEmbeddedClusterDownloadEnabled returns whether embedded cluster download is enabled from whichever version is present

func (LicenseWrapper) IsEmbeddedClusterMultiNodeEnabled

func (w LicenseWrapper) IsEmbeddedClusterMultiNodeEnabled() bool

IsEmbeddedClusterMultiNodeEnabled returns whether embedded cluster multi-node is enabled from whichever version is present

func (LicenseWrapper) IsEmbeddedClusterRookEnabled

func (w LicenseWrapper) IsEmbeddedClusterRookEnabled() bool

IsEmbeddedClusterRookEnabled returns whether embedded cluster rook is enabled from whichever version is present

func (*LicenseWrapper) IsEmpty

func (l *LicenseWrapper) IsEmpty() bool

func (LicenseWrapper) IsGeoaxisSupported

func (w LicenseWrapper) IsGeoaxisSupported() bool

IsGeoaxisSupported returns whether geoaxis is supported from whichever version is present

func (LicenseWrapper) IsGitOpsSupported

func (w LicenseWrapper) IsGitOpsSupported() bool

IsGitOpsSupported returns whether GitOps is supported from whichever version is present

func (LicenseWrapper) IsIdentityServiceSupported

func (w LicenseWrapper) IsIdentityServiceSupported() bool

IsIdentityServiceSupported returns whether identity service is supported from whichever version is present

func (LicenseWrapper) IsSemverRequired

func (w LicenseWrapper) IsSemverRequired() bool

IsSemverRequired returns whether semver is required from whichever version is present

func (LicenseWrapper) IsSnapshotSupported

func (w LicenseWrapper) IsSnapshotSupported() bool

IsSnapshotSupported returns whether snapshots are supported from whichever version is present

func (LicenseWrapper) IsSupportBundleUploadSupported

func (w LicenseWrapper) IsSupportBundleUploadSupported() bool

IsSupportBundleUploadSupported returns whether support bundle upload is supported from whichever version is present

func (*LicenseWrapper) IsV1

func (w *LicenseWrapper) IsV1() bool

IsV1 returns true if this wrapper contains a v1beta1 license

func (*LicenseWrapper) IsV2

func (w *LicenseWrapper) IsV2() bool

IsV2 returns true if this wrapper contains a v1beta2 license

func (*LicenseWrapper) VerifySignature

func (w *LicenseWrapper) VerifySignature() error

VerifySignature validates the license signature for whichever version (V1 or V2) is present. Returns an error if the wrapper is empty or if signature validation fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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