configmanager

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Config

type Config struct {
	Config CoreConfig     `yaml:"config"`
	Vars   map[string]any `yaml:"vars"`
	Tools  Tools          `yaml:"tools"`
}

Config is a general config in DevStream.

type CoreConfig

type CoreConfig struct {
	State *State `yaml:"state"`
}

type Manager

type Manager struct {
	ConfigFilePath string
}

Manager is used to load the config file from the ConfigFilePath and finally get the Config object.

func NewManager

func NewManager(configFilePath string) *Manager

NewManager takes configFilePath, then return a *Manager object.

func (*Manager) LoadConfig

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

LoadConfig is the only method that the caller of Manager needs to be concerned with, and this method returns a *Config finally. The main workflow of this method is: 1. Get the original config from the config file specified by ConfigFilePath; 2. Validation.

type RawOptions added in v0.10.0

type RawOptions map[string]any

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 k8s 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    RawOptions `yaml:"options"`
}

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

func (*Tool) DeepCopy

func (t *Tool) DeepCopy() *Tool

func (*Tool) GetPluginFileName added in v0.10.0

func (t *Tool) GetPluginFileName() 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 (*Tool) GetPluginFileNameWithOSAndArch added in v0.10.0

func (t *Tool) GetPluginFileNameWithOSAndArch(os, arch string) string

func (*Tool) GetPluginMD5FileName added in v0.10.0

func (t *Tool) GetPluginMD5FileName() string

func (*Tool) GetPluginMD5FileNameWithOSAndArch added in v0.10.0

func (t *Tool) GetPluginMD5FileNameWithOSAndArch(os, arch string) string

func (*Tool) GetPluginName added in v0.10.0

func (t *Tool) GetPluginName() string

GetPluginName return plugin name without file extensions

func (*Tool) GetPluginNameWithOSAndArch added in v0.10.0

func (t *Tool) GetPluginNameWithOSAndArch(os, arch string) string

func (*Tool) KeyWithNameAndInstanceID added in v0.10.0

func (t *Tool) KeyWithNameAndInstanceID() string

func (*Tool) String added in v0.10.0

func (t *Tool) String() string

type Tools added in v0.10.0

type Tools []*Tool

Jump to

Keyboard shortcuts

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