utils

package
v0.0.0-...-d4d4b81 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentScopeCluster is the cluster scope
	AgentScopeCluster AgentScope = "cluster"
	// AgentScopeNamespace is the namespace scope
	AgentScopeNamespace AgentScope = "namespace"
	// AgentTypeInternal is the internal agent
	AgentTypeInternal AgentType = "internal"
	// AgentTypeExternal is the external agent
	AgentTypeExternal AgentType = "external"
)

Variables

This section is empty.

Functions

func AddCache

func AddCache(c *cache.Cache, k string, x interface{}) error

AddCache function takes a string and an object to be cached

func AddRootIndent

func AddRootIndent(b []byte, n int) []byte

func ContainsString

func ContainsString(s []string, str string) bool

ContainsString checks if a string is present in an array of strings

func GetKeyValueMapFromQuotedString

func GetKeyValueMapFromQuotedString(quotedString string) map[string]string

GetKeyValueMapFromQuotedString returns key value pairs from a string with quotes

func NewCache

func NewCache() *cache.Cache

NewCache initializes a new cache with a given expiration period and cleanup interval

func RandomString

func RandomString(n int) string

RandomString generates random strings, can be used to create ids or random secrets

func Split

func Split(str, before, after string) string

Split returns the string in between a before sub-string and an after sub-string

func Truncate

func Truncate(num float64) float64

Truncate a float to two levels of precision

func URLDecodeBase64

func URLDecodeBase64(enconded string) string

URLDecodeBase64 decader String of type base64 or return the text if error happens

func UpdateCache

func UpdateCache(c *cache.Cache, k string, x interface{}) error

UpdateCache function takes a string and an object to be cached

func WriteHeaders

func WriteHeaders(w *gin.ResponseWriter, statusCode int)

WriteHeaders adds important headers to API responses

Types

type AgentScope

type AgentScope string

AgentScope is the scope of the agent

type AgentType

type AgentType string

AgentType is the type of the agent

type Configurations

type Configurations struct {
	Version                     string `required:"true"`
	AgentDeployments            string `required:"true" split_words:"true"`
	DbServer                    string `required:"true" split_words:"true"`
	JwtSecret                   string `required:"true" split_words:"true"`
	SelfAgent                   string `required:"true" split_words:"true"`
	AgentScope                  string `required:"true" split_words:"true"`
	AgentNamespace              string `required:"true" split_words:"true"`
	LitmusPortalNamespace       string `required:"true" split_words:"true"`
	DbUser                      string `required:"true" split_words:"true"`
	DbPassword                  string `required:"true" split_words:"true"`
	ChaosCenterScope            string `required:"true" split_words:"true"`
	SubscriberImage             string `required:"true" split_words:"true"`
	EventTrackerImage           string `required:"true" split_words:"true"`
	ArgoWorkflowControllerImage string `required:"true" split_words:"true"`
	ArgoWorkflowExecutorImage   string `required:"true" split_words:"true"`
	LitmusChaosOperatorImage    string `required:"true" split_words:"true"`
	LitmusChaosRunnerImage      string `required:"true" split_words:"true"`
	LitmusChaosExporterImage    string `required:"true" split_words:"true"`
	LitmusChaosServerLogFormat  string `split_words:"true" default:"text"`
	ContainerRuntimeExecutor    string `required:"true" split_words:"true"`
	HubBranchName               string `required:"true" split_words:"true"`
	WorkflowHelperImageVersion  string `required:"true" split_words:"true"`
	ServerServiceName           string `split_words:"true"`
	NodeName                    string `split_words:"true"`
	Ingress                     string `split_words:"true"`
	IngressName                 string `split_words:"true"`
	ChaosCenterUiEndpoint       string `split_words:"true"`
	TlsCertB64                  string `split_words:"true"`
	TlsSecretName               string `split_words:"true"`
	LitmusAuthGrpcEndpoint      string `split_words:"true" default:"localhost"`
	LitmusAuthGrpcPort          string `split_words:"true" default:":3030"`
	KubeConfigFilePath          string `split_words:"true"`
	RemoteHubMaxSize            string `split_words:"true"`
	SkipSslVerify               string `split_words:"true"`
	SelfAgentNodeSelector       string `split_words:"true"`
	SelfAgentTolerations        string `split_words:"true"`
	HttpPort                    string `split_words:"true" default:"8080"`
	RpcPort                     string `split_words:"true" default:"8000"`
}
var Config Configurations

Jump to

Keyboard shortcuts

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