util

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 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 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 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)

Types

type FeatureFlag

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

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
JackTT - Gopher 🇻🇳