util

package
v0.0.0-...-8a49579 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RevisionHistoryLimit = int32(0)

Functions

func CheckWithRegex

func CheckWithRegex(pattern, name string) bool

CheckWithRegex checks if a name matches the pattern. If a pattern fails to compile, it returns false

func GenerateRandomRouteName

func GenerateRandomRouteName(componentName string) string

GenerateRandomRouteName returns a random, trimmed route name based on the Component name based on the following criteria 1. Under 30 characters 2. Contains 4 random characters

func GenerateUniqueHashForWorkloadImageTag

func GenerateUniqueHashForWorkloadImageTag(namespace string) string

GenerateUniqueHashForWorkloadImageTag generates a unique hash from the namespace in order to not expose user's username via namespace of a particular resource potentially.

func GetIntValue

func GetIntValue(intPtr *int) int

GetIntValue returns the value of an int pointer, with the default of 0 if nil

func GetMappedGitOpsComponent

func GetMappedGitOpsComponent(component appstudiov1alpha1.Component, kubernetesResources parser.KubernetesResources) gitopsgenv1alpha1.GeneratorOptions

GetMappedGitOpsComponent gets a mapped GeneratorOptions from the Component for GitOps resource generation

func GetRandomString

func GetRandomString(n int, lower bool) string

GetRandomString returns a random string which is n characters long. If lower is set to true a lower case string is returned.

func ProcessGitOpsStatus

func ProcessGitOpsStatus(gitopsStatus appstudiov1alpha1.GitOpsStatus, gitToken string) (string, string, string, error)

ProcessGitOpsStatus processes the GitOps status and returns the remote url, branch, context and the error

func RemoveStrFromList

func RemoveStrFromList(str string, strList []string) []string

RemoveStrFromList removes the first occurence of str from the slice strList

func SanitizeName

func SanitizeName(name string) string

func StrInList

func StrInList(str string, strList []string) bool

StrInList returns true if the given string is present in strList

func ValidateEndpoint

func ValidateEndpoint(endpoint string) error

ValidateEndpoint validates if the endpoint url can be parsed and if it has a host and a scheme

func ValidateGithubURL

func ValidateGithubURL(URL string) error

ValidateGithubURL checks if the given url includes github in hostname In case of invalid url (not able to parse / not github) returns an error.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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