library

package
v0.0.0-...-f77b0bf Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 25 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// Supported Devfile media types
	DevfileMediaType        = "application/vnd.devfileio.devfile.layer.v1"
	DevfileVSXMediaType     = "application/vnd.devfileio.vsx.layer.v1.tar"
	DevfileSVGLogoMediaType = "image/svg+xml"
	DevfilePNGLogoMediaType = "image/png"
	DevfileArchiveMediaType = "application/x-tar"

	OwnersFile = "OWNERS"

	DeprecatedFilterTrue  DeprecatedFilter = "true"
	DeprecatedFilterFalse DeprecatedFilter = "false"
)

Variables

Functions

func CleanFilepath

func CleanFilepath(parent string, child string) string

Cleans a child path to ensure that there is no escaping from the parent directory with the use of ../ escape methods Ensures that the child path is always contained and absolutely pathed from the parent

func DownloadStarterProject

func DownloadStarterProject(path string, registryURL string, stack string, starterProject string, options RegistryOptions) error

DownloadStarterProject downloads a specified starter project archive to a given path

func DownloadStarterProjectAsBytes

func DownloadStarterProjectAsBytes(registryURL string, stack string, starterProject string, options RegistryOptions) ([]byte, error)

DownloadStarterProjectAsBytes downloads the file bytes of a specified starter project archive and return these bytes

func DownloadStarterProjectAsDir

func DownloadStarterProjectAsDir(path string, registryURL string, stack string, starterProject string, options RegistryOptions) error

DownloadStarterProjectAsDir downloads a specified starter project archive and extracts it to given path

func GetRegistryIndex

func GetRegistryIndex(registryURL string, options RegistryOptions, devfileTypes ...indexSchema.DevfileType) ([]indexSchema.Schema, error)

GetRegistryIndex returns the list of index schema structured stacks and/or samples from a specified devfile registry.

func GetStackIndex

func GetStackIndex(registryURL string, stack string, options RegistryOptions) (indexSchema.Schema, error)

GetStackIndex returns the schema index of a specified stack

func GetStackLink(registryURL string, stack string, options RegistryOptions) (string, error)

GetStackLink returns the slug needed to pull a specified stack from a registry URL

func IsStarterProjectExists

func IsStarterProjectExists(registryURL string, stack string, starterProject string, options RegistryOptions) (bool, error)

IsStarterProjectExists checks if starter project exists for a given stack

func PrintRegistry

func PrintRegistry(registryURLs string, devfileType string, options RegistryOptions) error

PrintRegistry prints the registry with devfile type

func PullStackByMediaTypesFromRegistry

func PullStackByMediaTypesFromRegistry(registry string, stack string, allowedMediaTypes []string, destDir string, options RegistryOptions) error

PullStackByMediaTypesFromRegistry pulls a specified stack with allowed media types from a given registry URL to the destination directory. OWNERS files present in the registry will be excluded

func PullStackFromRegistry

func PullStackFromRegistry(registry string, stack string, destDir string, options RegistryOptions) error

PullStackFromRegistry pulls a specified stack with all devfile supported media types from a registry URL to the destination directory

func SplitVersionFromStack

func SplitVersionFromStack(stackWithVersion string) (string, string, error)

SplitVersionFromStack takes a stack/version tag and splits the stack name from the version

func ValidateStackVersionTag

func ValidateStackVersionTag(stackWithVersion string) (bool, error)

ValidateStackVersionTag returns true if stack/version tag is well formed and false if it is malformed

Types

type DeprecatedFilter

type DeprecatedFilter string

DeprecatedFilter to manage the deprecated filter values

type Registry

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

func GetMultipleRegistryIndices

func GetMultipleRegistryIndices(registryURLs []string, options RegistryOptions, devfileTypes ...indexSchema.DevfileType) []Registry

GetMultipleRegistryIndices returns the list of stacks and/or samples from multiple registries

type RegistryFilter

type RegistryFilter struct {
	Architectures []string
	// MinSchemaVersion is set to filter devfile index equal and above a particular devfile schema version (inclusive)
	// only major version and minor version are required. e.g. 2.1, 2.2 ect. service version should not be provided.
	// will only be applied if `NewIndexSchema=true`
	MinSchemaVersion string
	// MaxSchemaVersion is set to filter devfile index equal and below a particular devfile schema version (inclusive)
	// only major version and minor version are required. e.g. 2.1, 2.2 ect. service version should not be provided.
	// will only be applied if `NewIndexSchema=true`
	MaxSchemaVersion string
	// Deprecated is set to filter devfile index for stacks having the "Deprecated" tag inside their default set of tags
	// or not. the only acceptable values are "true"/"false". in case the value is "true" it will only include only
	// deprecated stacks, if is "false" only non deprecated. will only be applied if `NewIndexSchema=true`
	Deprecated DeprecatedFilter
}

type RegistryOptions

type RegistryOptions struct {
	// SkipTLSVerify is false by default which is the recommended setting for a devfile registry deployed in production.  SkipTLSVerify should only be set to true
	// if you are testing a devfile registry or proxy server that is set up with self-signed certificates in a pre-production environment.
	SkipTLSVerify bool
	// Telemetry allows clients to send telemetry data to the community Devfile Registry
	Telemetry TelemetryData
	// Filter allows clients to specify which architectures they want to filter their devfiles on
	Filter RegistryFilter
	// NewIndexSchema is false by default, which calls GET /index and returns index of default version of each stack using the old index schema struct.
	// If specified to true, calls GET /v2index and returns the new Index schema with multi-version support
	NewIndexSchema bool
	// HTTPTimeout overrides the request and response timeout values for the custom HTTP clients set by the registry library.  If unset or a negative value is specified, the default timeout of 30s will be used.
	HTTPTimeout *int
}

type TelemetryData

type TelemetryData struct {
	// User is a generated UUID or generic client name
	User string
	// Locale is the OS or browser locale
	Locale string
	//Client is a generic name that describes the client
	Client string
}

TelemetryData structure to pass in client telemetry information The User and Locale fields should be passed in by clients if telemetry opt-in is enabled the generic Client name will be passed in regardless of opt-in/out choice. The value will be assigned to the UserId field for opt-outs

Jump to

Keyboard shortcuts

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