license

package
v0.0.0-...-f0fd134 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

package license provides functions for reading and printing licenses generated by Chef's license generation service.

WARNING WARNING WARNING WARNING WARNING

The code in this package is a copy of code in the chef/license library. chef/license is still proprietary and thus cannot be included in full as a dependency. Please take care that any changes to this file are compatible with the chef/license library.

WARNING WARNING WARNING WARNING WARNING

Index

Constants

This section is empty.

Variables

View Source
var File_lib_license_license_proto protoreflect.FileDescriptor

Functions

func GetKeySha256

func GetKeySha256(jwtLicense string) (string, error)

GetKeySha256 fetches the SHA256 of the public key from the JWT encoded license

Types

type Entitlement

type Entitlement struct {
	Name    string                 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`       // ReticulateSplines
	Measure string                 `protobuf:"bytes,2,opt,name=measure,proto3" json:"measure,omitempty"` // nodes
	Limit   int64                  `protobuf:"zigzag64,3,opt,name=limit,proto3" json:"limit,omitempty"`  // 10
	Start   *timestamppb.Timestamp `protobuf:"bytes,22,opt,name=start,proto3" json:"start,omitempty"`    // date the entitlement becomes active
	End     *timestamppb.Timestamp `protobuf:"bytes,23,opt,name=end,proto3" json:"end,omitempty"`        // last date the entitlement is active
	// contains filtered or unexported fields
}

func (*Entitlement) Descriptor deprecated

func (*Entitlement) Descriptor() ([]byte, []int)

Deprecated: Use Entitlement.ProtoReflect.Descriptor instead.

func (*Entitlement) GetEnd

func (x *Entitlement) GetEnd() *timestamppb.Timestamp

func (*Entitlement) GetLimit

func (x *Entitlement) GetLimit() int64

func (*Entitlement) GetMeasure

func (x *Entitlement) GetMeasure() string

func (*Entitlement) GetName

func (x *Entitlement) GetName() string

func (*Entitlement) GetStart

func (x *Entitlement) GetStart() *timestamppb.Timestamp

func (*Entitlement) ProtoMessage

func (*Entitlement) ProtoMessage()

func (*Entitlement) ProtoReflect

func (x *Entitlement) ProtoReflect() protoreflect.Message

func (*Entitlement) Reset

func (x *Entitlement) Reset()

func (*Entitlement) String

func (x *Entitlement) String() string

type License

type License struct {
	Id                string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                                // Unique ID for this license; defaults to auto-generated
	Version           string                 `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`                      // License version
	Type              string                 `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`                            // commercial, eval, developer, partner
	Generator         string                 `protobuf:"bytes,20,opt,name=generator,proto3" json:"generator,omitempty"`                 // chef/license, chef/license-generation-service
	KeySha256         string                 `protobuf:"bytes,6,opt,name=key_sha256,json=keySha256,proto3" json:"key_sha256,omitempty"` // public key checksum
	GenerationDate    *timestamppb.Timestamp `protobuf:"bytes,21,opt,name=generation_date,json=generationDate,proto3" json:"generation_date,omitempty"`
	Customer          string                 `protobuf:"bytes,24,opt,name=customer,proto3" json:"customer,omitempty"`
	CustomerId        string                 `protobuf:"bytes,4,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"`
	CustomerIdVersion string                 `protobuf:"bytes,25,opt,name=customer_id_version,json=customerIdVersion,proto3" json:"customer_id_version,omitempty"`
	Entitlements      []*Entitlement         `protobuf:"bytes,5,rep,name=entitlements,proto3" json:"entitlements,omitempty"`
	// contains filtered or unexported fields
}

func Read

func Read(license string, publicKey []byte) (*License, error)

Read and parse a license from a string and return the config Ex: sha, _ := license.GetKeySha256(license)

lic, _ := license.Read(license, publicKeys[sha])

func (*License) Descriptor deprecated

func (*License) Descriptor() ([]byte, []int)

Deprecated: Use License.ProtoReflect.Descriptor instead.

func (*License) GetCustomer

func (x *License) GetCustomer() string

func (*License) GetCustomerId

func (x *License) GetCustomerId() string

func (*License) GetCustomerIdVersion

func (x *License) GetCustomerIdVersion() string

func (*License) GetEntitlements

func (x *License) GetEntitlements() []*Entitlement

func (*License) GetGenerationDate

func (x *License) GetGenerationDate() *timestamppb.Timestamp

func (*License) GetGenerator

func (x *License) GetGenerator() string

func (*License) GetId

func (x *License) GetId() string

func (*License) GetKeySha256

func (x *License) GetKeySha256() string

func (*License) GetType

func (x *License) GetType() string

func (*License) GetVersion

func (x *License) GetVersion() string

func (*License) PrettyPrint

func (l *License) PrettyPrint() string

PrettyPrint a license into a nice string for text output

func (*License) ProtoMessage

func (*License) ProtoMessage()

func (*License) ProtoReflect

func (x *License) ProtoReflect() protoreflect.Message

func (*License) Reset

func (x *License) Reset()

func (*License) String

func (x *License) String() string

Jump to

Keyboard shortcuts

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