config

package
v0.0.20 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// UpdateNotificationSetting is the name of the setting controlling update notification
	UpdateNotificationSetting = "UpdateNotification"
	// UpdateNotificationSettingDescription is human-readable description for the update notification setting
	UpdateNotificationSettingDescription = "Controls if an update notification is shown or not (true or false)"
	// NamePrefixSetting is the name of the setting controlling name prefix
	NamePrefixSetting = "NamePrefix"
	// NamePrefixSettingDescription is human-readable description for the name prefix setting
	NamePrefixSettingDescription = "Default prefix is the current directory name. Use this value to set a default name prefix"
	// TimeoutSetting is the name of the setting controlling timeout for connection check
	TimeoutSetting = "Timeout"
	// TimeoutSettingDescription is human-readable description for the timeout setting
	TimeoutSettingDescription = "Timeout (in seconds) for OpenShift server connection check"
	// ComponentType is the name of the setting controlling the component type i.e. builder image
	ComponentType = "ComponentType"
	// ComponentTypeDescription is human-readable description of the componentType setting
	ComponentTypeDescription = "The type of component"
	// ComponentName is the name of the setting controlling the component name
	ComponentName = "ComponentName"
	// ComponentNameDescription is human-readable description of the componentType setting
	ComponentNameDescription = "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"
)
View Source
const (

	//DefaultTimeout for openshift server connection check
	DefaultTimeout = 1
)

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 FormatSupportedParameters added in v0.0.19

func FormatSupportedParameters() (result string)

FormatSupportedParameters 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

func GetSupportedParameters added in v0.0.19

func GetSupportedParameters() []string

GetSupportedParameters returns the name of the supported parameters

Types

type ApplicationInfo added in v0.0.2

type ApplicationInfo struct {
	// name of the application
	Name string `json:"Name"`
	// is this application active? Only one application can be active at the time
	Active bool `json:"Active"`
	// name of the openshift project this application belongs to
	Project string `json:"Project"`
	// last active component for  this application
	ActiveComponent string `json:"ActiveComponent"`
}

ApplicationInfo holds all important information about one application

type ComponentSettings added in v0.0.19

type ComponentSettings struct {

	// The builder image to use
	ComponentType *string `json:"ComponentType,omitempty"`

	ComponentName *string `json:"ComponentName,omitempty"`

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

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

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

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

	MaxCPU *string `json:"MaxCPU,omitempty"`
}

ComponentSettings holds all component related information

type GlobalConfig added in v0.0.19

type GlobalConfig struct {

	// Currently active application
	// multiple applications can be active but each one has to be in different project
	// there shouldn't be more active applications in one project
	ActiveApplications []ApplicationInfo `json:"ActiveApplications"`

	// Odo settings holds the odo specific global settings
	OdoSettings OdoSettings `json:"Settings,omitempty"`
}

GlobalConfig stores all the config related to odo, its the superset of local config.

type GlobalConfigInfo added in v0.0.19

type GlobalConfigInfo struct {
	Filename     string `json:"FileName,omitempty"`
	GlobalConfig `json:",omitempty"`
}

GlobalConfigInfo wraps the global config and provides helpers to serialize it.

func New

func New() (*GlobalConfigInfo, error)

New returns the globalConfigInfo to retain the expected behavior

func NewGlobalConfig added in v0.0.19

func NewGlobalConfig() (*GlobalConfigInfo, error)

NewGlobalConfig gets the GlobalConfigInfo from global config file and global creates the config file in case it's not present then it

func (*GlobalConfigInfo) AddApplication added in v0.0.19

func (c *GlobalConfigInfo) AddApplication(application string, project string) error

AddApplication add new application to the config file Newly create application is NOT going to be se as Active.

func (*GlobalConfigInfo) DeleteApplication added in v0.0.19

func (c *GlobalConfigInfo) DeleteApplication(application string, project string) error

DeleteApplication deletes application from given project from config file

func (*GlobalConfigInfo) DeleteConfiguration added in v0.0.19

func (c *GlobalConfigInfo) DeleteConfiguration(parameter string) error

DeleteConfiguration delete Odo configurations in the global config file as of now being used for nameprefix, timeout, updatenotification

func (*GlobalConfigInfo) DeleteProject added in v0.0.19

func (c *GlobalConfigInfo) DeleteProject(projectName string) error

DeleteProject deletes applications belonging to the given project from the config file

func (*GlobalConfigInfo) GetActiveApplication added in v0.0.19

func (c *GlobalConfigInfo) GetActiveApplication(project string) string

GetActiveApplication get currently active application for given project if no application is active return empty string

func (*GlobalConfigInfo) GetActiveComponent added in v0.0.19

func (c *GlobalConfigInfo) GetActiveComponent(application string, project string) string

GetActiveComponent if no component is set as current returns empty string

func (*GlobalConfigInfo) GetConfiguration added in v0.0.19

func (c *GlobalConfigInfo) GetConfiguration(parameter string) (interface{}, bool)

GetConfiguration gets the value of the specified parameter, it returns false in case the value is not part of the struct

func (*GlobalConfigInfo) GetNamePrefix added in v0.0.19

func (c *GlobalConfigInfo) GetNamePrefix() string

GetNamePrefix returns the value of Prefix from config and if absent then returns default

func (*GlobalConfigInfo) GetTimeout added in v0.0.19

func (c *GlobalConfigInfo) GetTimeout() int

GetTimeout returns the value of Timeout from config and if absent then returns default

func (*GlobalConfigInfo) GetUpdateNotification added in v0.0.19

func (c *GlobalConfigInfo) GetUpdateNotification() bool

GetUpdateNotification returns the value of UpdateNotification from config and if absent then returns default

func (*GlobalConfigInfo) SetActiveApplication added in v0.0.19

func (c *GlobalConfigInfo) SetActiveApplication(application string, project string) error

SetActiveApplication set application as active for given project

func (*GlobalConfigInfo) SetActiveComponent added in v0.0.19

func (c *GlobalConfigInfo) SetActiveComponent(componentName string, applicationName string, projectName string) error

SetActiveComponent sets active component for given project and application. application must exist

func (*GlobalConfigInfo) SetConfiguration added in v0.0.19

func (c *GlobalConfigInfo) SetConfiguration(parameter string, value string) error

SetConfiguration modifies Odo configurations in the config file as of now being used for nameprefix, timeout, updatenotification TODO: Use reflect to set parameters

func (*GlobalConfigInfo) UnsetActiveApplication added in v0.0.19

func (c *GlobalConfigInfo) UnsetActiveApplication(project string) error

UnsetActiveApplication sets the active application as blank of the given project in the configuration file

func (*GlobalConfigInfo) UnsetActiveComponent added in v0.0.19

func (c *GlobalConfigInfo) UnsetActiveComponent(project string) error

UnsetActiveComponent sets the active component as blank of the given project in the configuration file

type Info added in v0.0.19

type Info interface {
	SetConfiguration(parameter string, value string) error
	GetConfiguration(parameter string) (interface{}, bool)
	DeleteConfiguration(parameter string) error
}

Info is implemented by configuration managers

type LocalConfig added in v0.0.19

type LocalConfig struct {
	ComponentSettings ComponentSettings `json:"ComponentSettings,omitempty"`
}

LocalConfig holds all the config relavent to a specific Component.

func (*LocalConfig) GetComponentType added in v0.0.19

func (lc *LocalConfig) GetComponentType() string

GetComponentType returns type of component (builder image name) in the config and if absent then returns default

type LocalConfigInfo added in v0.0.19

type LocalConfigInfo struct {
	Filename    string `json:"FileName,omitempty"`
	LocalConfig `json:",omitempty"`
}

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

func NewLocalConfig added in v0.0.19

func NewLocalConfig() (*LocalConfigInfo, error)

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

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) GetConfiguration added in v0.0.19

func (lci *LocalConfigInfo) GetConfiguration(parameter string) (interface{}, bool)

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

func (*LocalConfigInfo) SetConfiguration added in v0.0.19

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

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

type OdoSettings added in v0.0.11

type OdoSettings struct {
	// Controls if an update notification is shown or not
	UpdateNotification *bool `json:"UpdateNotification,omitempty"`
	// Holds the prefix part of generated random application name
	NamePrefix *string `json:"NamePrefix,omitempty"`
	// Timeout for openshift server connection check
	Timeout *int `json:"Timeout,omitempty"`
}

OdoSettings holds all odo specific configurations

Jump to

Keyboard shortcuts

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