configmanager

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GOOS   string = runtime.GOOS
	GOARCH string = runtime.GOARCH
)

Functions

func GetPluginFileName

func GetPluginFileName(t *Tool) string

GetPluginFileName creates the file name based on the tool's name and version If the plugin {githubactions 0.0.1}, the generated name will be "githubactions_0.0.1.so"

func GetPluginMD5FileName

func GetPluginMD5FileName(t *Tool) string

GetPluginMD5FileName If the plugin {githubactions 0.0.1}, the generated name will be "githubactions_0.0.1.md5"

func GetPluginName

func GetPluginName(t *Tool) string

GetPluginName return plugin name without file extensions

Types

type Config

type Config struct {
	PluginDir string
	Tools     []Tool `yaml:"tools"`
	State     *State
}

Config records rendered config values and is used as a general config in DevStream.

func (*Config) Validate

func (c *Config) Validate() []error

func (*Config) ValidateDependency

func (c *Config) ValidateDependency() []error

type CoreConfig

type CoreConfig struct {
	// TODO(daniel-hutao): Relative path support
	VarFile string `yaml:"varFile"`
	// TODO(daniel-hutao): Relative path support
	ToolFile string `yaml:"toolFile"`
	// abs path of the plugin dir
	PluginDir string `yaml:"pluginDir"`
	State     *State `yaml:"state"`
}

CoreConfig is the struct representing the complete original configuration YAML files.

func (*CoreConfig) ParseToolFilePath

func (c *CoreConfig) ParseToolFilePath() error

func (*CoreConfig) ParseVarFilePath

func (c *CoreConfig) ParseVarFilePath() error

func (*CoreConfig) Validate

func (c *CoreConfig) Validate() error

type Manager

type Manager struct {
	ConfigFile string
}

func NewManager

func NewManager(configFileName string) *Manager

func (*Manager) LoadConfig

func (m *Manager) LoadConfig() (*Config, error)

LoadConfig reads an input file as a general config.

type State

type State struct {
	Backend string             `yaml:"backend"`
	Options StateConfigOptions `yaml:"options"`
}

State is the struct for reading the state configuration in the config file. It defines how the state is stored, specifies the type of backend and related options.

type StateConfigOptions

type StateConfigOptions struct {
	// for s3 backend
	Bucket string `yaml:"bucket"`
	Region string `yaml:"region"`
	Key    string `yaml:"key"`
	// for local backend
	StateFile string `yaml:"stateFile"`
	// for ConfigMap backend
	Namespace string `yaml:"namespace"`
	ConfigMap string `yaml:"configmap"`
}

StateConfigOptions is the struct for reading the options of the state backend.

type Tool

type Tool struct {
	Name string `yaml:"name" validate:"required"`
	// RFC 1123 - DNS Subdomain Names style
	// contain no more than 253 characters
	// contain only lowercase alphanumeric characters, '-' or '.'
	// start with an alphanumeric character
	// end with an alphanumeric character
	InstanceID string                 `yaml:"instanceID" validate:"required,dns1123subdomain"`
	DependsOn  []string               `yaml:"dependsOn"`
	Options    map[string]interface{} `yaml:"options"`
}

Tool is the struct for one section of the DevStream tool file (part of the config.)

func NewToolWithToolConfigBytesAndVarsConfigBytes

func NewToolWithToolConfigBytesAndVarsConfigBytes(toolConfigBytes, varConfigBytes []byte) ([]Tool, error)

func NewToolWithToolConfigFileAndVarsConfigFile

func NewToolWithToolConfigFileAndVarsConfigFile(toolFilePath, varFilePath string) ([]Tool, error)

func (*Tool) DeepCopy

func (t *Tool) DeepCopy() *Tool

func (*Tool) Key

func (t *Tool) Key() string

func (*Tool) Validate

func (t *Tool) Validate() []error

Jump to

Keyboard shortcuts

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