util

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandIfFeatureFlag

func AddCommandIfFeatureFlag(rootCmd *cobra.Command, cmd *cobra.Command, featureFlag FeatureFlag)

func ConfirmCommand added in v0.1.5

func ConfirmCommand(message string, bypass bool) error

this function will add an interactive comfirmation with the message provided

func ExtractJwtClaims added in v0.0.14

func ExtractJwtClaims(tokenStr string) (jwt.MapClaims, error)

func Filter added in v0.0.14

func Filter[T any](ss []T, test func(T) bool) (ret []T)

Inspired from here: https://stackoverflow.com/questions/37562873/most-idiomatic-way-to-select-elements-from-an-array-in-golang This allows us to filter a slice of any type using a function that returns a bool

func GetClusterTier

func GetClusterTier(tierCli string) (string, error)

func GetCustomRoleFeatureFlagDisabledError added in v0.1.7

func GetCustomRoleFeatureFlagDisabledError() string

func GetSensitivePermissionsConfirmationMessage added in v0.1.12

func GetSensitivePermissionsConfirmationMessage() string

func IsFeatureFlagEnabled added in v0.0.14

func IsFeatureFlagEnabled(featureFlag FeatureFlag) bool

func IsJwtTokenExpired added in v0.0.14

func IsJwtTokenExpired(tokenStr string) (bool, error)

func IsJwtTokenExpiredWithTime added in v0.0.14

func IsJwtTokenExpiredWithTime(tokenStr string, now time.Time) (bool, error)

func SetDefaultRegion added in v0.1.17

func SetDefaultRegion(clusterRegionInfo []ybmclient.ClusterRegionInfo, defaultRegion string) error

func SetPreferredRegion added in v0.1.17

func SetPreferredRegion(clusterRegionInfo []ybmclient.ClusterRegionInfo, preferredRegion string) error

func SplitAndIgnoreEmpty added in v0.0.17

func SplitAndIgnoreEmpty(str string, sep string) []string

func ValidateCIDR added in v0.0.13

func ValidateCIDR(cidr string) (bool, error)

func ValidateNumFaultsToTolerate added in v0.1.16

func ValidateNumFaultsToTolerate(numFaultsToTolerate int32, faultTolerance ybmclient.ClusterFaultTolerance) (bool, error)

Types

type FeatureFlag

type FeatureFlag string
const (
	CDC                 FeatureFlag = "CDC"
	CONFIGURE_URL       FeatureFlag = "CONFIGURE_URL"
	NODE_OP             FeatureFlag = "NODE_OPS"
	TOOLS               FeatureFlag = "TOOLS"
	AZURE_CIDR_ALLOWED  FeatureFlag = "AZURE_CIDR_ALLOWED"
	ENTERPRISE_SECURITY FeatureFlag = "ENTERPRISE_SECURITY"
	DB_AUDIT_LOGS       FeatureFlag = "DB_AUDIT_LOGS"
)

func (FeatureFlag) String

func (f FeatureFlag) String() string

Jump to

Keyboard shortcuts

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