Documentation ¶
Index ¶
- Constants
- func CutBetween(s string, startingToken string, endingToken string) string
- func DurationToBareSeconds(possibleDurationStr string) float64
- func ExtractRequiredVariablesDirective(yamlStr string) (string, []string)
- func FixLeadingZerosInJSON(strContainingJSON string) string
- func GetPlatformType(platformType string) (string, error)
- func IPPermissionsEquivalent(a ec2Types.IpPermission, b ec2Types.IpPermission) bool
- func PollImmediate(interval time.Duration, timeout time.Duration, condition func() (bool, error)) error
- func RandSeq(n int) string
- func RemoveTimestamps(strContainingTimestamps string) string
- func ValidateProvidedVariables(providedVarMap map[string]string, presetVarMap map[string]string, ...) error
Constants ¶
const ( PlatformAWS = "aws" // deprecated: use PlatformAWSClassic PlatformGCP = "gcp" // deprecated: use PlatformGCPClassic PlatformHostedCluster = "hostedcluster" // deprecated: use PlatformAWSHCP PlatformAWSClassic = "aws-classic" PlatformGCPClassic = "gcp-classic" PlatformAWSHCP = "aws-hcp" )
Enumerated type representing the platform underlying the cluster-under-test
Variables ¶
This section is empty.
Functions ¶
func CutBetween ¶ added in v0.4.11
CutBetween returns the part of s between startingToken and endingToken. If startingToken and/or endingToken cannot be found in s, or if there are no characters between the two tokens, this returns an empty string (""). If there are multiple occurrances of each token, the largest possible part of s will be returned (i.e., everything between the leftmost startingToken and the rightmost endingToken, a.k.a. greedy matching)
func DurationToBareSeconds ¶ added in v1.0.0
DurationToBareSeconds tries to parse a given string as a duration (e.g., "1m30s") and return the total floating-point number of seconds in the duration. Failing that, it tries to return the left- most number in the given string. Failing that (or given an empty string, NaN, or infinity), it returns 0
func ExtractRequiredVariablesDirective ¶ added in v0.4.11
ExtractRequiredVariablesDirective looks for a "directive line" in a YAML string resembling: # network-verifier-required-variables=VAR_X,VAR_Y,VAR_Z If such a string is found, the comma-separated values after the '=' are transformed into a slice of strings, e.g., ["VAR_X", "VAR_Y", "VAR_Z"]. That slice is returned alongside the original string, minus any directive lines. Only variables listed in the first (leftmost) directive line will be extracted/returned, but all directive lines will be removed
func FixLeadingZerosInJSON ¶ added in v0.4.11
fixLeadingZerosInJSON attempts to detect unsigned integers containing leading zeros (e.g, 061 or 000) in strings containing raw JSON and replace them with spec-compliant de-zeroed equivalents. Leading zeros are invalid in JSON, but curl v7.76 and below contain a bug (github.com/curl/curl/issues/6905) that emits them in status codes. Note that strContainingJSON can contain substrings that are not JSON, but such substrings will be subjected to the same regexes and may therefore be modified unintentionally
func GetPlatformType ¶ added in v0.4.8
func IPPermissionsEquivalent ¶ added in v0.4.5
func IPPermissionsEquivalent(a ec2Types.IpPermission, b ec2Types.IpPermission) bool
IPPermissionsEquivalent compares two AWS IpPermissions (used in security group rules) similarly to reflect.DeepEqual, except it only compares IP(v6) ports and CIDR ranges and ignores UserIdGroupPairs, PrefixListIds, and any Description fields
func PollImmediate ¶
func PollImmediate(interval time.Duration, timeout time.Duration, condition func() (bool, error)) error
PollImmediate calls the condition function at the specified interval up to the specified timeout until the condition function returns true or an error
func RemoveTimestamps ¶ added in v0.4.11
RemoveTimestamps attempts to detect and remove the bracketed ISO-8601 timestamps that AWS inexplicably inserts into the output of ec2.GetConsoleOutput() whenever a line exceeds a certain length. This function simply returns the input string after passing it through regexp.ReplaceAllLiteralString()
func ValidateProvidedVariables ¶ added in v0.4.11
func ValidateProvidedVariables(providedVarMap map[string]string, presetVarMap map[string]string, requiredVarSlice []string) error
ValidateProvidedVariables returns an error if either (a.) providedVarMap contains a key also present in presetVarMap, or (b.) requiredVarSlice contains a value not present in the union of providedVarMap's keys and presetVarMap's keys. IOW, this returns nil as long as providedVarMap.keys ∩ presetVarMap.keys = ∅ and requiredVarSlice ⊆ (providedVarMap.keys ∪ presetVarMap.keys)
Types ¶
This section is empty.