parser

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Name              = "Name"
	Ports             = "Ports"
	Memory            = "Memory"
	PortsDescription  = "Ports to be opened in all component containers"
	MemoryDescription = "The Maximum memory all the component containers can consume"
	NameDescription   = "The name of the component"
)
View Source
const (
	OutputDevfileJsonPath = "devfile.json"
	OutputDevfileYamlPath = "devfile.yaml"
)

Default filenames for create devfile

Variables

This section is empty.

Functions

func GetContainerPortsFromStrings

func GetContainerPortsFromStrings(ports []string) ([]corev1.ContainerPort, error)

GetContainerPortsFromStrings generates ContainerPort values from the array of string port values ports is the array containing the string port values

func InArray

func InArray(arr []string, value string) bool

In checks if the value is in the array

func Merge

func Merge(original []v1.EnvVar, other []v1.EnvVar) []v1.EnvVar

Merge merges the other EnvVarlist with keeping last value for duplicate EnvVars and returns a new EnvVarList

func RemoveEnvVarsFromList

func RemoveEnvVarsFromList(envVarList []v1.EnvVar, keys []string) ([]v1.EnvVar, error)

RemoveEnvVarsFromList removes the env variables based on the keys provided and returns a new EnvVarList

Types

type DevfileObj

type DevfileObj struct {

	// Ctx has devfile context info
	Ctx devfileCtx.DevfileCtx

	// Data has the devfile data
	Data data.DevfileData
}

DevfileObj is the runtime devfile object

func Parse

func Parse(path string) (d DevfileObj, err error)

Parse func populates the devfile data, parses and validates the devfile integrity. Creates devfile context and runtime objects

func ParseFromData

func ParseFromData(data []byte) (d DevfileObj, err error)

ParseFromData func parses and validates the devfile integrity. Creates devfile context and runtime objects

func ParseFromURL

func ParseFromURL(url string) (d DevfileObj, err error)

ParseFromURL func parses and validates the devfile integrity. Creates devfile context and runtime objects

func (DevfileObj) AddEnvVars

func (d DevfileObj) AddEnvVars(otherList []v1.EnvVar) error

AddEnvVars adds environment variables to all the components in a devfile

func (DevfileObj) GetMemory

func (d DevfileObj) GetMemory() string

GetMemory gets memoryLimit from devfile container

func (DevfileObj) GetMetadataName

func (d DevfileObj) GetMetadataName() string

GetMetadataName gets metadata name from a devfile

func (DevfileObj) HasPorts

func (d DevfileObj) HasPorts() bool

HasPorts checks if a devfile contains container endpoints

func (DevfileObj) OverrideCommands

func (d DevfileObj) OverrideCommands(overridePatch []v1.CommandParentOverride) (err error)

OverrideCommands overrides the commands of the parent devfile overridePatch contains the patches to be applied to the parent's commands

func (DevfileObj) OverrideComponents

func (d DevfileObj) OverrideComponents(overridePatch []v1.ComponentParentOverride) error

OverrideComponents overrides the components of the parent devfile overridePatch contains the patches to be applied to the parent's components

func (DevfileObj) OverrideProjects

func (d DevfileObj) OverrideProjects(overridePatch []v1.ProjectParentOverride) error

OverrideProjects overrides the projects of the parent devfile overridePatch contains the patches to be applied to the parent's projects

func (DevfileObj) OverrideStarterProjects

func (d DevfileObj) OverrideStarterProjects(overridePatch []v1.StarterProjectParentOverride) error

OverrideStarterProjects overrides the starter projects of the parent devfile overridePatch contains the patches to be applied to the parent's starter projects

func (DevfileObj) RemoveEnvVars

func (d DevfileObj) RemoveEnvVars(keys []string) (err error)

RemoveEnvVars removes the environment variables which have the keys from all the components in a devfile

func (DevfileObj) RemovePorts

func (d DevfileObj) RemovePorts() error

RemovePorts removes all container endpoints from a devfile

func (DevfileObj) SetMemory

func (d DevfileObj) SetMemory(memory string) error

SetMemory sets memoryLimit in devfile container

func (DevfileObj) SetMetadataName

func (d DevfileObj) SetMetadataName(name string) error

SetMetadataName set metadata name in a devfile

func (DevfileObj) SetPorts

func (d DevfileObj) SetPorts(ports ...string) error

SetPorts converts ports to endpoints, adds to a devfile

func (*DevfileObj) WriteJsonDevfile

func (d *DevfileObj) WriteJsonDevfile() error

WriteJsonDevfile creates a devfile.json file

func (*DevfileObj) WriteYamlDevfile

func (d *DevfileObj) WriteYamlDevfile() error

WriteYamlDevfile creates a devfile.yaml file

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

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