Documentation ¶
Index ¶
- Constants
- Variables
- func AbsPathCheck(dirPath string) error
- func AddressCheck(address string, ipv6 bool) error
- func ArrayToString(arr []string, delimiter string) string
- func CanReadAccessDir(dirPath string) error
- func CanWriteAccessDir(dirPath string) int
- func CheckAllEmptyOrNonEmpty(vars ...string) bool
- func CheckMissingFields(object any) error
- func CheckNotEmpty(a string) bool
- func CheckPathExist(filePath string) bool
- func CopyFile(sourcePath, destinationPath string, perm fs.FileMode) error
- func CopyMap[K comparable, V any](original map[K]V) map[K]V
- func CopySlice[T any](original []T) []T
- func FillInDefaultTimeForEndTimestamp(dateonly *string) *time.Time
- func FillInDefaultTimeForStartTimestamp(dateonly *string) *time.Time
- func FilterMapByKey[M ~map[K]V, K comparable, V any](m M, n []K) M
- func GenVNodeName(vnodes map[string]string, dbName string, hostCount int) (string, bool)
- func GetCleanPath(path string) string
- func GetCurrentUsername() (string, error)
- func GetEnv(key, fallback string) string
- func GetEonFlagMsg(message string) string
- func GetJSONLogErrors(responseContent string, responseObj any, opName string, logger vlog.Printer) error
- func GetOptionalFlagMsg(message string) string
- func GetPathPrefix(path string) string
- func IsAbsPath(path string) bool
- func IsEmptyOrValidTimeStr(layout string, value *string) (*time.Time, error)
- func IsIPv4(ip string) bool
- func IsIPv6(ip string) bool
- func IsOptionSet(f *flag.FlagSet, optionName string) bool
- func IsTimeEqualOrAfter(start, end time.Time) bool
- func MapKeyDiff[M ~map[K]V, K comparable, V any](m, n M) []K
- func Max[T constraints.Ordered](a, b T) T
- func NmaCertsLookup(f FetchAllEnvVars)
- func NmaSecretLookup(f FetchAllEnvVars)
- func ParamNotSetErrorMsg(param string) error
- func ParseConfigParams(configParamListStr string) (map[string]string, error)
- func ParseKeyValueListStr(listStr, opt string) (map[string]string, error)
- func ResolveRawHostsToAddresses(rawHosts []string, ipv6 bool) ([]string, error)
- func ResolveToAbsPath(path string) (string, error)
- func ResolveToIPAddrs(hostname string, ipv6 bool) ([]string, error)
- func ResolveToOneIP(hostname string, ipv6 bool) (string, error)
- func SetParserUsage(parser *flag.FlagSet, op string)
- func SliceDiff[K comparable](m, n []K) []K
- func SplitHosts(hosts string) ([]string, error)
- func StringInArray(str string, list []string) bool
- func TrimSpace(str string) string
- func ValidateAbsPath(path *string, pathName string) error
- func ValidateCommunalStorageLocation(location string) error
- func ValidateDBName(dbName string) error
- func ValidateName(name, obj string) error
- func ValidateRequiredAbsPath(path *string, pathName string) error
- func ValidateUsernameAndPassword(opName string, useHTTPPassword bool, userName string) error
- type FetchAllEnvVars
Constants ¶
const ( DefaultClientPort = 5433 DefaultHTTPPortOffset = 3010 DefaultHTTPPort = DefaultClientPort + DefaultHTTPPortOffset DefaultControlAddressFamily = "ipv4" IPv6ControlAddressFamily = "ipv6" DefaultRestartPolicy = "ksafe" DefaultDBDir = "/opt/vertica" DefaultLicenseKey = DefaultShareDir + "/license.key" DefaultConfigDir = DefaultDBDir + "/config" DefaultRetryCount = 3 DefaultTimeoutSeconds = 300 DefaultLoadCatalogTimeoutSeconds = 3600 DefaultStatePollingTimeout = 1200 DefaultLargeCluster = -1 MaxLargeCluster = 120 MinDepotSize = 0 MaxDepotSize = 100 DefaultDrainSeconds = 60 NodeUpState = "UP" NodeDownState = "DOWN" SuppressHelp = "SUPPRESS_HELP" )
this file defines basic default values
const ( FileExist = 0 FileNotExist = 1 NoWritePerm = 2 )
const (
AWSAuthKey = "awsauth"
)
const DefaultDateOnlyFormat = time.DateOnly
default date only format: this omits time within a date
const DefaultDateTimeFormat = time.DateTime
default date time format: this omits nanoseconds but is still able to parse those out
const DefaultDateTimeNanoSecFormat = time.DateTime + ".000000000"
default date time format: this includes nanoseconds
Variables ¶
var RestartPolicyList = []string{"never", DefaultRestartPolicy, "always"}
Functions ¶
func AbsPathCheck ¶
func AddressCheck ¶
func ArrayToString ¶
convert an array to a string by joining the elements in the array using the given delimiter
func CanReadAccessDir ¶
Check whether the directory is read accessible by trying to open the file
func CanWriteAccessDir ¶ added in v1.0.0
Check whether the directory is read accessible
func CheckAllEmptyOrNonEmpty ¶
func CheckMissingFields ¶
func CheckNotEmpty ¶
func CheckPathExist ¶
func CopyMap ¶
func CopyMap[K comparable, V any](original map[K]V) map[K]V
CopyMap returns a copy of a map.
func FillInDefaultTimeForEndTimestamp ¶
Read date only string from argument, fill in time, overwrite argument by date time string, and return parsed time, the filled in time will indicate the end of a day (right before the beginning of the following day)
func FillInDefaultTimeForStartTimestamp ¶
Read date only string from argument, fill in time, overwrite argument by date time string, and return parsed time, the filled in time will indicate the beginning of a day
func FilterMapByKey ¶
func FilterMapByKey[M ~map[K]V, K comparable, V any](m M, n []K) M
FilterMapByKey, given a map and a slice of keys, returns a map, which is a subset of the original, that contains only keys in from the given slice.
func GenVNodeName ¶
GenVNodeName generates a vnode and returns it after checking it is not already taken by an existing node.
func GetCleanPath ¶
replace all '//' to be '/', trim the path string
func GetCurrentUsername ¶
func GetEonFlagMsg ¶
func GetJSONLogErrors ¶
func GetOptionalFlagMsg ¶ added in v1.0.0
func GetPathPrefix ¶
GetPathPrefix returns a path prefix for a (catalog/data/depot) path of a node
func IsAbsPath ¶
have this util function so no need to import file/path for every command that needs check file path
func IsEmptyOrValidTimeStr ¶
import time package in this util file so other files don't need to import time wrapper function to handle empty input string, returns an error if the time is invalid caller responsible for passing in correct layout
func IsOptionSet ¶
check if an option is passed in
func IsTimeEqualOrAfter ¶
func MapKeyDiff ¶
func MapKeyDiff[M ~map[K]V, K comparable, V any](m, n M) []K
calculate diff of map keys: m-n
func Max ¶
func Max[T constraints.Ordered](a, b T) T
Max works on all sane types, not just float64 like the math package funcs. Can be removed after upgrade to go 1.21 (VER-90410) as min/max become builtins.
func NmaCertsLookup ¶
func NmaCertsLookup(f FetchAllEnvVars)
NmaCertsLookup retrieves kubernetes certs.
func NmaSecretLookup ¶
func NmaSecretLookup(f FetchAllEnvVars)
NmaSecretLookup retrieves kubernetes secrets.
func ParamNotSetErrorMsg ¶
func ParseConfigParams ¶ added in v1.0.0
ParseConfigParams builds and returns a map from a comma-separated list of params.
func ParseKeyValueListStr ¶ added in v1.0.0
ParseKeyValueListStr converts a comma-separated list of key-value pairs into a map. Ex: key1=val1,key2=val2 ---> map[string]string{key1: val1, key2: val2}
func ResolveRawHostsToAddresses ¶
resolve RawHosts to be IP addresses
func ResolveToAbsPath ¶
func SetParserUsage ¶
suppress help message for hidden options
func SplitHosts ¶ added in v1.0.0
func StringInArray ¶
func ValidateAbsPath ¶
func ValidateCommunalStorageLocation ¶
ValidateCommunalStorageLocation can identify some invalid communal storage locations
func ValidateDBName ¶
func ValidateName ¶
ValidateName will validate the name of an obj, the obj can be database, subcluster, etc. when a name is provided, make sure no special chars are in it
func ValidateRequiredAbsPath ¶
ValidateRequiredAbsPath check whether a required path is set then validate it