Documentation
¶
Index ¶
- Constants
- Variables
- func AddRootIndent(b []byte, n int) []byte
- func CheckEmptyFields(v interface{}) error
- func ContainsString(s []string, str string) bool
- func DirSize(path string) (int64, error)
- func GenerateAccessKey(length int) (string, error)
- func GenerateUUID() string
- func GetTlsConfig(certPath string, keyPath string, isServerConfig bool) *tls.Config
- func IsFileExisting(path string) (bool, error)
- func MatchInfrastructureType(infras []*model.InfrastructureType, infra model.InfrastructureType) bool
- func ParseGRPCError(err error) error
- func RandomString(n int) string
- func RestCall(method string, url string, payload []byte, opt ...func(option *RestCallOption)) (int, []byte, error)
- func Split(str, before, after string) string
- func StringPtrToString(val *string) string
- func TransformProbe(probeList []v1alpha1.ProbeAttributes) []v1alpha1.ProbeAttributes
- func Truncate(num float64) float64
- func WithHeaders(headers map[string]string) func(*RestCallOption)
- func WithMaxRetries(maxRetries int) func(*RestCallOption)
- func WithRetryInterval(retryInterval time.Duration) func(*RestCallOption)
- func WithTimeout(timeout time.Duration) func(*RestCallOption)
- func WriteHeaders(w *gin.ResponseWriter, statusCode int)
- type AppError
- type Configuration
- type RestCallOption
Constants ¶
View Source
const GRPCErrorPrefix string = "rpc error: code = Unknown desc ="
View Source
const UnitValidationRegex string = `\b(\d+(\.\d+)?)((ns|us|ms|s|m|h))\b`
Variables ¶
View Source
var ErrorDescriptions = map[AppError]string{ ErrDocumentExists: "This mongo document is already exist in the collection", }
ErrorDescriptions holds detailed error description for every AppError
View Source
var ErrorStatusCodes = map[AppError]int{ ErrDocumentExists: 401, }
ErrorStatusCodes holds the http status codes for every AppError
View Source
var (
SupportedPrivateGitRepository = []string{"github", "gitlab"}
)
Functions ¶
func AddRootIndent ¶
func CheckEmptyFields ¶
func CheckEmptyFields(v interface{}) error
func ContainsString ¶
ContainsString checks if a string is present in an array of strings
func GenerateAccessKey ¶
GenerateAccessKey generates an access key by leveraging crypto/rand package
func GenerateUUID ¶
func GenerateUUID() string
GenerateUUID : Generate a unique string id based on google/uuid
func GetTlsConfig ¶
func IsFileExisting ¶
IsFileExisting checks if a file or directory exists in the system
func MatchInfrastructureType ¶
func MatchInfrastructureType(infras []*model.InfrastructureType, infra model.InfrastructureType) bool
func ParseGRPCError ¶
func RandomString ¶
RandomString generates random strings, can be used to create ids
func StringPtrToString ¶
func TransformProbe ¶
func TransformProbe(probeList []v1alpha1.ProbeAttributes) []v1alpha1.ProbeAttributes
func WithHeaders ¶
func WithHeaders(headers map[string]string) func(*RestCallOption)
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int) func(*RestCallOption)
func WithRetryInterval ¶
func WithRetryInterval(retryInterval time.Duration) func(*RestCallOption)
func WithTimeout ¶
func WithTimeout(timeout time.Duration) func(*RestCallOption)
func WriteHeaders ¶
func WriteHeaders(w *gin.ResponseWriter, statusCode int)
WriteHeaders adds important headers to API responses
Types ¶
type Configuration ¶
type Configuration struct { Version string `required:"true"` InfraDeployments string `required:"true" split_words:"true"` DbServer string `required:"true" split_words:"true"` DbUser string `required:"true" split_words:"true"` DbPassword 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"` ContainerRuntimeExecutor string `required:"true" split_words:"true"` WorkflowHelperImageVersion string `required:"true" split_words:"true"` ChaosCenterUiEndpoint string `split_words:"true" default:"https://localhost:8080"` TlsCertB64 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"` RestPort string `split_words:"true" default:"8080"` GrpcPort string `split_words:"true" default:"8000"` InfraCompatibleVersions string `required:"true" split_words:"true"` DefaultHubGitURL string `required:"true" default:"https://github.com/litmuschaos/chaos-charts"` GitUsername string `required:"true" split_words:"true" default:"litmus"` DefaultHubBranchName string `required:"true" split_words:"true"` CustomChaosHubPath string `split_words:"true" default:"/tmp/"` DefaultChaosHubPath string `split_words:"true" default:"/tmp/default/"` EnableGQLIntrospection string `split_words:"true" default:"false"` EnableInternalTls string `split_words:"true" default:"false"` TlsCertPath string `split_words:"true"` TlsKeyPath string `split_words:"true"` CaCertTlsPath string `split_words:"true"` AllowedOrigins []string `split_words:"true" default:"^(http://|https://|)litmuschaos.io(:[0-9]+|)?,^(http://|https://|)localhost(:[0-9]+|)"` }
var Config Configuration
type RestCallOption ¶
type RestCallOption struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.