omnitruck

package
v0.0.0-...-085d482 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOWNLOAD_URL         = `https://packages.chef.io/files/%s/%s/%s/%s`
	CHEF_AUTOMATE_CLI    = "chef-automate-cli"
	AUTOMATE_CLI_VERSION = "latest"
	AUTOMATE_CHANNEL     = "current"
	AUTOMATE_PRODUCT     = "automate"
	HABITAT_PRODUCT      = "habitat"
)

Variables

This section is empty.

Functions

func EolProductName

func EolProductName(name string) bool

func EolProductVersion

func EolProductVersion(product string, v ProductVersion) bool

func FilterList

func FilterList[T comparable](s []T, filter func(T) bool) []T

func FilterProductList

func FilterProductList[T comparable](s []T, product string, filter func(string, T) bool) []T

func FilterProductsForFreeTrial

func FilterProductsForFreeTrial[T comparable](s []T, filter func(T) bool) []T

func NewConstraint

func NewConstraint(i string) version.Constraints

func OsProductName

func OsProductName(name string) bool

func OsProductVersion

func OsProductVersion(name string, v ProductVersion) bool

func ProductsForFreeTrial

func ProductsForFreeTrial(name string) bool

func SelectList

func SelectList[T comparable](s []T, filter func(T) bool) []T

func SupportedVersion

func SupportedVersion(product string) string

func ValidateRequest

func ValidateRequest(p *RequestParams, flags RequestParamsFlags) *clients.Request

Types

type ArchList

type ArchList map[string]PackageMetadata

type ContainsValidator

type ContainsValidator struct {
	Field      string
	Values     []string
	Code       int
	AllowEmpty bool
	Skip       func(c Context) bool
}

func (*ContainsValidator) GetCode

func (fv *ContainsValidator) GetCode() int

func (*ContainsValidator) GetField

func (fv *ContainsValidator) GetField() string

func (*ContainsValidator) GetValues

func (fv *ContainsValidator) GetValues() interface{}

func (*ContainsValidator) Validate

type Context

type Context struct {
	Path      string
	License   bool
	LicenseId string
}

type DynamoServices

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

func NewDynamoServices

func NewDynamoServices(db dboperations.IDbOperations, log *log.Entry) DynamoServices

func (*DynamoServices) FetchLatestOsVersion

func (svc *DynamoServices) FetchLatestOsVersion(params *RequestParams) (string, error)

func (*DynamoServices) GetFilename

func (svc *DynamoServices) GetFilename(params *RequestParams) (string, error)

func (*DynamoServices) GetRelatedProducts

func (svc *DynamoServices) GetRelatedProducts(params *RequestParams) (*models.RelatedProducts, error)

func (*DynamoServices) Platforms

func (svc *DynamoServices) Platforms(platforms PlatformList) PlatformList

func (*DynamoServices) ProductDownload

func (svc *DynamoServices) ProductDownload(params *RequestParams) (string, error)

func (*DynamoServices) ProductMetadata

func (svc *DynamoServices) ProductMetadata(params *RequestParams) (PackageMetadata, error)

func (*DynamoServices) ProductPackages

func (svc *DynamoServices) ProductPackages(params *RequestParams) (PackageList, error)

func (*DynamoServices) Products

func (svc *DynamoServices) Products(products []string, eol string) []string

func (*DynamoServices) VersionAll

func (svc *DynamoServices) VersionAll(params *RequestParams) ([]ProductVersion, error)

func (*DynamoServices) VersionLatest

func (svc *DynamoServices) VersionLatest(params *RequestParams) (ProductVersion, error)

type EolVersionValidator

type EolVersionValidator struct {
	Code int
}

func (*EolVersionValidator) GetCode

func (fv *EolVersionValidator) GetCode() int

func (*EolVersionValidator) GetField

func (fv *EolVersionValidator) GetField() string

func (*EolVersionValidator) GetValues

func (fv *EolVersionValidator) GetValues() interface{}

func (*EolVersionValidator) Validate

type FiberContext

type FiberContext interface {
	Params(string, ...string) string
	Query(string, ...string) string
	BaseURL() string
}

type ItemList

type ItemList []string

func ProductDisplayName

func ProductDisplayName(data ItemList) ItemList

type Omnitruck

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

func New

func New(log *log.Entry) Omnitruck

func (*Omnitruck) Architectures

func (ot *Omnitruck) Architectures() *clients.Request

func (*Omnitruck) Get

func (ot *Omnitruck) Get(url string) *clients.Request

func (*Omnitruck) LatestVersion

func (ot *Omnitruck) LatestVersion(p *RequestParams) *clients.Request

func (*Omnitruck) Platforms

func (ot *Omnitruck) Platforms() *clients.Request

func (*Omnitruck) ProductDownload

func (ot *Omnitruck) ProductDownload(p *RequestParams) *clients.Request

Product Download needs to fetch the metadata record instead of the Omnitruck download API The Omnitruck API normall redirects the user to the download URL and we need to do this ourselves.

func (*Omnitruck) ProductMetadata

func (ot *Omnitruck) ProductMetadata(p *RequestParams) *clients.Request

func (*Omnitruck) ProductPackages

func (ot *Omnitruck) ProductPackages(p *RequestParams) *clients.Request

func (*Omnitruck) ProductVersions

func (ot *Omnitruck) ProductVersions(p *RequestParams) *clients.Request

func (*Omnitruck) Products

type OsVersionValidator

type OsVersionValidator struct {
	Code int
}

func (*OsVersionValidator) GetCode

func (fv *OsVersionValidator) GetCode() int

func (*OsVersionValidator) GetField

func (fv *OsVersionValidator) GetField() string

func (*OsVersionValidator) GetValues

func (fv *OsVersionValidator) GetValues() interface{}

func (*OsVersionValidator) Validate

type PackageList

type PackageList map[string]PlatformVersionList

func (PackageList) UpdatePackages

func (pl PackageList) UpdatePackages(fn PackageListUpdater)

type PackageListUpdater

type PackageListUpdater func(platform string, platformVersion string, arch string, meta PackageMetadata) PackageMetadata

type PackageMetadata

type PackageMetadata struct {
	Sha1    string `json:"sha1"`
	Sha256  string `json:"sha256"`
	Url     string `json:"url"`
	Version string `json:"version"`
}

type PlatformList

type PlatformList map[string]string

type PlatformVersionList

type PlatformVersionList map[string]ArchList

type Product

type Product struct {
	Name              string
	ProductName       string
	SupportedVersion  version.Constraints
	OpensourceVersion version.Constraints
}

type ProductVersion

type ProductVersion string

type RequestParams

type RequestParams struct {
	Channel         string
	Product         string
	Version         string
	Platform        string
	PlatformVersion string
	Architecture    string
	Eol             string
	LicenseId       string
	BOM             string
}

func (*RequestParams) UrlParams

func (rp *RequestParams) UrlParams() url.Values

type RequestParamsFlags

type RequestParamsFlags struct {
	Channel         bool
	Product         bool
	Version         bool
	Platform        bool
	PlatformVersion bool
	Architecture    bool
	Eol             bool
	LicenseId       bool
	BOM             bool
}

type RequestValidator

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

func NewValidator

func NewValidator() RequestValidator

func (*RequestValidator) Add

func (*RequestValidator) ErrorMessages

func (o *RequestValidator) ErrorMessages(errors []*ValidationError) (string, int)

func (*RequestValidator) GetValidators

func (rv *RequestValidator) GetValidators() []ValidatorInterface

func (*RequestValidator) Params

func (o *RequestValidator) Params(params *RequestParams, c Context) []*ValidationError

type ValidationError

type ValidationError struct {
	FailedField string
	Value       string
	Tag         string
	Msg         string
	Code        int
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

type ValidatorFunc

type ValidatorFunc func(string, ValidatorInterface) bool

type ValidatorInterface

type ValidatorInterface interface {
	GetCode() int
	Validate(*RequestParams, Context) *ValidationError
}

Jump to

Keyboard shortcuts

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