config

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Type is the name of the setting controlling the component type i.e. builder image
	Type = "Type"
	// TypeDescription is human-readable description of the componentType setting
	TypeDescription = "The type of component"
	// Name is the name of the setting controlling the component name
	Name = "Name"
	// NameDescription is human-readable description of the componentType setting
	NameDescription = "The name of the component"
	// MinMemory is the name of the setting controlling the min memory a component consumes
	MinMemory = "MinMemory"
	// MinMemoryDescription is the name of the setting controlling the minimum memory
	MinMemoryDescription = "The minimum memory a component is provided"
	// MaxMemory is the name of the setting controlling the min memory a component consumes
	MaxMemory = "MaxMemory"
	// MaxMemoryDescription is the name of the setting controlling the maximum memory
	MaxMemoryDescription = "The maximum memory a component can consume"
	// Memory is the name of the setting controlling the memory a component consumes
	Memory = "Memory"
	// MemoryDescription is the name of the setting controlling the min and max memory to same value
	MemoryDescription = "The minimum and maximum Memory a component can consume"
	// Ignore is the name of the setting controlling the min memory a component consumes
	Ignore = "Ignore"
	// IgnoreDescription is the name of the setting controlling the use of .odoignore file
	IgnoreDescription = "Consider the .odoignore file for push and watch"
	// MinCPU is the name of the setting controlling minimum cpu
	MinCPU = "MinCPU"
	// MinCPUDescription is the name of the setting controlling the min CPU value
	MinCPUDescription = "The minimum cpu a component can consume"
	// MaxCPU is the name of the setting controlling the use of .odoignore file
	MaxCPU = "MaxCPU"
	//MaxCPUDescription is the name of the setting controlling the max CPU value
	MaxCPUDescription = "The maximum cpu a component can consume"
	// CPU is the name of the setting controlling the cpu a component consumes
	CPU = "CPU"
	// CPUDescription is the name of the setting controlling the min and max CPU to same value
	CPUDescription = "The minimum and maximum CPU a component can consume"
	// SourceLocation indicates path of the source e.g. location of the git repo
	SourceLocation = "SourceLocation"
	// SourceType indicates type of component source -- git/binary/local
	SourceType = "SourceType"
	// Ref indicates git ref for the component source
	Ref = "Ref"
	// Ports is the space separated list of user specified ports to be opened in the component
	Ports = "Ports"
	// Application indicates application of which component is part of
	Application = "Application"
	// Project indicates project the component is part of
	Project = "Project"
	// ProjectDescription is the description of project component setting
	ProjectDescription = "Project is the name of the project the component is part of"
	// ApplicationDescription is the description of app component setting
	ApplicationDescription = "Application is the name of application the component needs to be part of"
	// PortsDescription is the desctription of the ports component setting
	PortsDescription = "Ports to be opened in the component"
	// RefDescription is the description of ref setting
	RefDescription = "Git ref to use for creating component from git source"
	// SourceTypeDescription is the description of type setting
	SourceTypeDescription = "Type of component source - git/binary/local"
	// SourceLocationDescription is the human-readable description of path setting
	SourceLocationDescription = "The path indicates the location of binary file or git source"
	// Url
	Url = "Url"
	// UrlDescription is the description of URL
	UrlDescription = "Url to access the compoent"
)

Variables

This section is empty.

Functions

func FormatLocallySupportedParameters added in v0.0.19

func FormatLocallySupportedParameters() (result string)

FormatLocallySupportedParameters outputs supported parameters and their description

func GetLocallySupportedParameters added in v0.0.19

func GetLocallySupportedParameters() []string

GetLocallySupportedParameters returns the name of the supported global parameters

Types

type ComponentSettings added in v0.0.19

type ComponentSettings struct {

	// The builder image to use
	Type *string `yaml:"Type,omitempty"`

	// SourceLocation is path to binary in current/context dir, it can be the
	// git url in case of source type being git
	SourceLocation *string `yaml:"SourceLocation,omitempty"`

	// Ref is component source git ref but can be levaraged for more in future
	Ref *string `yaml:"Ref,omitempty"`

	// Type is type of component source: git/local/binary
	SourceType *SrcType `yaml:"SourceType,omitempty"`

	// Ports is a slice of ports to be exposed when a component is created
	// the format of the port is "PORT/PROTOCOL" e.g. "8080/TCP"
	Ports *[]string `yaml:"Ports,omitempty"`

	Application *string `yaml:"Application,omitempty"`

	Project *string `yaml:"Project,omitempty"`

	Name *string `yaml:"Name,omitempty"`

	MinMemory *string `yaml:"MinMemory,omitempty"`

	MaxMemory *string `yaml:"MaxMemory,omitempty"`

	// Ignore if set to true then odoignore file should be considered
	Ignore *bool `yaml:"Ignore,omitempty"`

	MinCPU *string `yaml:"MinCPU,omitempty"`

	MaxCPU *string `yaml:"MaxCPU,omitempty"`

	Envs EnvVarList `yaml:"Envs,omitempty"`

	Url *[]ConfigUrl `yaml:"Url,omitempty"`
}

ComponentSettings holds all component related information

type ConfigUrl added in v1.0.0

type ConfigUrl struct {
	// Name of the URL
	Name string `yaml:"Name,omitempty"`
	// Port number for the url of the component, required in case of components which expose more than one service port
	Port int `yaml:"Port,omitempty"`
}

ConfigUrl holds URL related information

type EnvVar added in v1.0.0

type EnvVar struct {
	Name  string `yaml:"Name"`
	Value string `yaml:"Value"`
}

EnvVar represents an enviroment variable

func NewEnvVarFromString added in v1.0.0

func NewEnvVarFromString(envStr string) (EnvVar, error)

NewEnvVarFromString takes a string of format "name=value" and returns an Env variable struct

type EnvVarList added in v1.0.0

type EnvVarList []EnvVar

EnvVarList represents a list of environment variables

func NewEnvVarListFromSlice added in v1.0.0

func NewEnvVarListFromSlice(envList []string) (EnvVarList, error)

NewEnvVarListFromSlice takes multiple env variables with format "name=value" and returns an EnvVarList

func RemoveEnvVarsFromList added in v1.0.0

func RemoveEnvVarsFromList(envVarList EnvVarList, keys []string) EnvVarList

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

func (EnvVarList) Merge added in v1.0.0

func (evl EnvVarList) Merge(other EnvVarList) EnvVarList

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

func (EnvVarList) ToStringSlice added in v1.0.0

func (evl EnvVarList) ToStringSlice() []string

ToStringSlice converts the EnvVarList into a slice of env var of kind "key=value"

type LocalConfig added in v0.0.19

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

LocalConfig holds all the config relavent to a specific Component.

func NewLocalConfig added in v0.0.19

func NewLocalConfig() LocalConfig

NewLocalConfig creates an empty LocalConfig struct with typeMeta populated

func (*LocalConfig) GetApplication added in v1.0.0

func (lc *LocalConfig) GetApplication() string

GetApplication returns the app, returns default if nil

func (*LocalConfig) GetIgnore added in v1.0.0

func (lc *LocalConfig) GetIgnore() bool

GetIgnore returns the Ignore, returns default if nil

func (*LocalConfig) GetMaxCPU added in v1.0.0

func (lc *LocalConfig) GetMaxCPU() string

GetMaxCPU returns the MaxCPU, returns default if nil

func (*LocalConfig) GetMaxMemory added in v1.0.0

func (lc *LocalConfig) GetMaxMemory() string

GetMaxMemory returns the MaxMemory, returns default if nil

func (*LocalConfig) GetMinCPU added in v1.0.0

func (lc *LocalConfig) GetMinCPU() string

GetMinCPU returns the MinCPU, returns default if nil

func (*LocalConfig) GetMinMemory added in v1.0.0

func (lc *LocalConfig) GetMinMemory() string

GetMinMemory returns the MinMemory, returns default if nil

func (*LocalConfig) GetName added in v1.0.0

func (lc *LocalConfig) GetName() string

GetName returns the Name, returns default if nil

func (*LocalConfig) GetPorts added in v1.0.0

func (lc *LocalConfig) GetPorts() []string

GetPorts returns the ports, returns default if nil

func (*LocalConfig) GetProject added in v1.0.0

func (lc *LocalConfig) GetProject() string

GetProject returns the project, returns default if nil

func (*LocalConfig) GetRef added in v1.0.0

func (lc *LocalConfig) GetRef() string

GetRef returns the ref, returns default if nil

func (*LocalConfig) GetSourceLocation added in v1.0.0

func (lc *LocalConfig) GetSourceLocation() string

GetSourceLocation returns the sourcelocation, returns default if nil

func (*LocalConfig) GetSourceType added in v1.0.0

func (lc *LocalConfig) GetSourceType() SrcType

GetSourceType returns the source type, returns default if nil

func (*LocalConfig) GetType added in v1.0.0

func (lc *LocalConfig) GetType() string

GetType returns type of component (builder image name) in the config

func (*LocalConfig) GetUrl added in v1.0.0

func (lc *LocalConfig) GetUrl() []ConfigUrl

GetUrl returns the ConfigUrl, returns default if nil

type LocalConfigInfo added in v0.0.19

type LocalConfigInfo struct {
	Filename    string `yaml:"FileName,omitempty"`
	LocalConfig `yaml:",omitempty"`
	// contains filtered or unexported fields
}

LocalConfigInfo wraps the local config and provides helpers to serialize it.

func New

func New() (*LocalConfigInfo, error)

New returns the localConfigInfo

func NewLocalConfigInfo added in v1.0.0

func NewLocalConfigInfo(cfgDir string) (*LocalConfigInfo, error)

NewLocalConfigInfo gets the LocalConfigInfo from local config file and creates the local config file in case it's not present then it

func (*LocalConfigInfo) ConfigFileExists added in v1.0.0

func (lci *LocalConfigInfo) ConfigFileExists() bool

ConfigFileExists if a config file exists or not

func (*LocalConfigInfo) DeleteConfiguration added in v0.0.19

func (lci *LocalConfigInfo) DeleteConfiguration(parameter string) error

DeleteConfiguration is used to delete config from local odo config

func (*LocalConfigInfo) DeleteUrl added in v1.0.0

func (lci *LocalConfigInfo) DeleteUrl(parameter string) error

DeleteUrl is used to delete config from local odo config

func (*LocalConfigInfo) GetComponentSettings added in v1.0.0

func (lci *LocalConfigInfo) GetComponentSettings() ComponentSettings

GetComponentSettings returns the componentSettings from local config

func (*LocalConfigInfo) GetEnvVars added in v1.0.0

func (lci *LocalConfigInfo) GetEnvVars() EnvVarList

GetEnvVars gets the env variables from the component settings

func (*LocalConfigInfo) GetOSSourcePath added in v1.0.0

func (lci *LocalConfigInfo) GetOSSourcePath() (path string, err error)

GetOSSourcePath corrects the current sourcePath depending on local or binary configuration, if Git has been passed, we simply return the source location from LocalConfig this will get the correct source path whether on Windows, macOS or Linux.

This function also takes in the current working directory + context directory in order to correctly retrieve WHERE the source is located..

func (*LocalConfigInfo) IsSet added in v1.0.0

func (lci *LocalConfigInfo) IsSet(parameter string) bool

IsSet uses reflection to get the parameter from the localconfig struct, currently it only searches the componentSettings

func (*LocalConfigInfo) SetComponentSettings added in v1.0.0

func (lci *LocalConfigInfo) SetComponentSettings(cs ComponentSettings) error

SetComponentSettings sets the componentSettings from to the local config and writes to the file

func (*LocalConfigInfo) SetConfiguration added in v0.0.19

func (lci *LocalConfigInfo) SetConfiguration(parameter string, value interface{}) (err error)

SetConfiguration sets the common config settings like component type, min memory max memory etc. TODO: Use reflect to set parameters

func (*LocalConfigInfo) SetEnvVars added in v1.0.0

func (lci *LocalConfigInfo) SetEnvVars(envVars EnvVarList) error

SetEnvVars sets the env variables on the component settings

type SrcType added in v1.0.0

type SrcType string

SrcType is an enum to indicate the type of source of component -- local source/binary or git for the generation of app/component names

const (
	// GIT as source of component
	GIT SrcType = "git"
	// LOCAL Local source path as source of component
	LOCAL SrcType = "local"
	// BINARY Local Binary as source of component
	BINARY SrcType = "binary"
	// NONE indicates there's no information about the type of source of the component
	NONE SrcType = ""
)

func GetSrcType added in v1.0.0

func GetSrcType(ctStr string) (SrcType, error)

GetSrcType returns enum equivalent of passed component source type or error if unsupported type passed

Jump to

Keyboard shortcuts

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