types

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalVariableKVToYaml

func GlobalVariableKVToYaml(kvs []*GlobalVariableKV) (string, error)

func RenderVariableKVToYaml

func RenderVariableKVToYaml(kvs []*RenderVariableKV) (string, error)

RenderVariableKVToYaml

func ServiceVariableKVToYaml

func ServiceVariableKVToYaml(kvs []*ServiceVariableKV) (string, error)

not suitable for flatten kv ServiceVariableKV is a kv which aggregate complicated struct to the first layer

func UpdateGlobalVariableKVs

func UpdateGlobalVariableKVs(serviceName string, globalVariables []*GlobalVariableKV, argVariables, currentVariables []*RenderVariableKV) ([]*GlobalVariableKV, []*RenderVariableKV, error)

update global variable's related serivces and render variables value base on useGlobalVariable flag

func ValidateGlobalVariables

func ValidateGlobalVariables(globalVariablesDefine []*ServiceVariableKV, globalVariables []*GlobalVariableKV) bool

validate global variables base on global variables define

func ValidateRenderVariables

func ValidateRenderVariables(globalVariables []*GlobalVariableKV, renderVariables []*RenderVariableKV) error

Types

type GlobalVariableKV

type GlobalVariableKV struct {
	ServiceVariableKV `bson:",inline" yaml:",inline" json:",inline"`
	RelatedServices   []string `bson:"related_services"     yaml:"related_services"     json:"related_services"`
}

func RemoveGlobalVariableRelatedService

func RemoveGlobalVariableRelatedService(globalVariableKVs []*GlobalVariableKV, serviceNames ...string) []*GlobalVariableKV

type GlobalVariables

type GlobalVariables struct {
	Variables           []*ServiceVariableKV `json:"variables"`
	ProductionVariables []*ServiceVariableKV `json:"production_variables"`
}

type RenderVariableKV

type RenderVariableKV struct {
	ServiceVariableKV `bson:",inline" yaml:",inline" json:",inline"`
	UseGlobalVariable bool `bson:"use_global_variable"     yaml:"use_global_variable"    json:"use_global_variable"`
}

func ClipRenderVariableKVs

func ClipRenderVariableKVs(template []*ServiceVariableKV, render []*RenderVariableKV) (yaml string, kvs []*RenderVariableKV, err error)

func MergeRenderAndServiceTemplateVariableKVs

func MergeRenderAndServiceTemplateVariableKVs(render []*RenderVariableKV, serivceTemplate []*ServiceVariableKV) (string, []*RenderVariableKV, error)

merge render variables base on service template variables render variables has higher value priority, service template variables has higher type priority normally used to get latest variables for a service

func MergeRenderVariableKVs

func MergeRenderVariableKVs(kvsList ...[]*RenderVariableKV) (string, []*RenderVariableKV, error)

func ServiceToRenderVariableKVs

func ServiceToRenderVariableKVs(ServiceVariables []*ServiceVariableKV) []*RenderVariableKV

func UpdateRenderVariable

func UpdateRenderVariable(global []*GlobalVariableKV, render []*RenderVariableKV) []*RenderVariableKV

update render variables base on global variables and useGlobalVariable flag

type ServiceVariableKV

type ServiceVariableKV struct {
	Key     string                `bson:"key"      yaml:"key"      json:"key"`
	Value   interface{}           `bson:"value"    yaml:"value"    json:"value"`
	Type    ServiceVariableKVType `bson:"type"     yaml:"type"     json:"type"`
	Options []string              `bson:"options"  yaml:"options"  json:"options"`
	Desc    string                `bson:"desc"     yaml:"desc"     json:"desc"`
}

This kv will aggregate complicated struct to the first layer of key

func ClipServiceVariableKVs

func ClipServiceVariableKVs(clipRange []*ServiceVariableKV, kvs []*ServiceVariableKV) (string, []*ServiceVariableKV, error)

func MergeServiceVariableKVs

func MergeServiceVariableKVs(kvsList ...[]*ServiceVariableKV) (string, []*ServiceVariableKV, error)

func MergeServiceVariableKVsIfNotExist

func MergeServiceVariableKVsIfNotExist(kvsList ...[]*ServiceVariableKV) (string, []*ServiceVariableKV, error)

func YamlToServiceVariableKV

func YamlToServiceVariableKV(yamlStr string, origKVs []*ServiceVariableKV) ([]*ServiceVariableKV, error)

not suitable for flatten kv ServiceVariableKV is a kv which aggregate complicated struct to the first layer

type ServiceVariableKVType

type ServiceVariableKVType string
const (
	ServiceVariableKVTypeBoolean ServiceVariableKVType = "bool"
	ServiceVariableKVTypeString  ServiceVariableKVType = "string"
	ServiceVariableKVTypeEnum    ServiceVariableKVType = "enum"
	ServiceVariableKVTypeYaml    ServiceVariableKVType = "yaml"
)

type ServiceWithVariable

type ServiceWithVariable struct {
	ServiceName  string              `json:"service_name"`
	VariableYaml string              `json:"variable_yaml"`
	VariableKVs  []*RenderVariableKV `json:"variable_kvs"`
}

Jump to

Keyboard shortcuts

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