Documentation ¶
Index ¶
- func DefaultBool(b *bool, def bool) bool
- func DefaultIP(i *net.IP, def string) string
- func DefaultInt64(i *int64, def int64) int64
- func DefaultString(s *string, def string) string
- func EllipString(s string, maxLen int) string
- func GetInstancesAttachedToEIP(ctx context.Context, client *v2.Client, elasticIPID, zone string) ([]*v2.Instance, error)
- func GetInstancesInSecurityGroup(ctx context.Context, client *v2.Client, securityGroupID, zone string) ([]*v2.Instance, error)
- func IsEmptyStringPtr(s *string) bool
- func IsInList(list []string, v string) bool
- func NonEmptyStringPtr(s string) *string
- func RandStringBytes(n int) (string, error)
- func SliceToMap(v []string) (map[string]string, error)
- func VersionIsNewer(old, new string) bool
- func VersionMajor(version string) uint32
- func VersionMinor(version string) uint32
- func VersionsAreEquivalent(a, b string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBool ¶ added in v1.65.0
DefaultBool returns the value of the bool pointer b if not nil, otherwise the default value specified.
func DefaultIP ¶ added in v1.65.0
DefaultIP returns the IP as string if not nil, otherwise the default value specified.
func DefaultInt64 ¶ added in v1.65.0
DefaultInt64 returns the value of the int64 pointer b if not nil, otherwise the default value specified.
func DefaultString ¶ added in v1.65.0
DefaultString returns the value of the string pointer s if not nil, otherwise the default value specified.
func EllipString ¶ added in v1.65.0
EllipString truncates the string s with an ellipsis character if longer than maxLen.
func GetInstancesAttachedToEIP ¶ added in v1.66.0
func GetInstancesInSecurityGroup ¶ added in v1.65.0
func IsEmptyStringPtr ¶ added in v1.65.0
func IsInList ¶ added in v1.65.0
IsInList returns true if v exists in the specified list, false otherwise.
func NonEmptyStringPtr ¶ added in v1.65.0
NonEmptyStringPtr returns a non-nil pointer to s if the string is not empty, otherwise nil.
func RandStringBytes ¶
RandStringBytes Generate random string of n bytes
func SliceToMap ¶ added in v1.65.0
SliceToMap returns a map[string]string from a slice of KEY=VALUE formatted strings. This function is used to obtain a map[string]string from CLI flags, as the current CLI flags parsing module used (github.com/spf13/pflag) implements a "StringToString" type flag but doesn't support passing empty values, which we need in some cases (e.g. resetting labels).
func VersionIsNewer ¶ added in v1.65.0
VersionIsNewer returns true if new version has potential deprecation
func VersionMajor ¶ added in v1.65.0
VersionMajor returns major part of a version number (given "x.y(.z)", returns "x"). If the input version is not in semver format, returns 0.
func VersionMinor ¶ added in v1.65.0
VersionMinor returns minor part of a version number (given "x.y(.z)", returns "y"). If the input version is not in semver format, returns 0.
func VersionsAreEquivalent ¶ added in v1.65.0
VersionsAreEquivalent returns true if new and old versions both have same major and minor numbers
Types ¶
This section is empty.