util

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Hostname is a constant refers to the hostname part of the url
	Hostname urlPart = "Hostname"
	// Password is a constant that refers to a password portion of the url if there is one
	Password urlPart = "Password"
)

Variables

This section is empty.

Functions

func CreateHTTPClient

func CreateHTTPClient(timeout time.Duration, unsafeSsl bool) *http.Client

CreateHTTPClient returns a new HTTP client with the timeout set to timeoutMS milliseconds, or 300 milliseconds if timeoutMS <= 0. unsafeSsl parameter allows to avoid tls cert validation if it's required

func MaskPartOfURL

func MaskPartOfURL(s string, part urlPart) (string, error)

MaskPartOfURL will parse a url and returned a masked version or an error

func NewTLSConfig

func NewTLSConfig(clientCert, clientKey, caCert string) (*tls.Config, error)

NewTLSConfig returns a *tls.Config using the given ceClient cert, ceClient key, and CA certificate. If none are appropriate, a nil *tls.Config is returned.

func NewTLSConfigWithPassword added in v2.8.0

func NewTLSConfigWithPassword(clientCert, clientKey, clientKeyPassword, caCert string) (*tls.Config, error)

NewTLSConfigWithPassword returns a *tls.Config using the given ceClient cert, ceClient key, and CA certificate. If clientKeyPassword is not empty the provided password will be used to decrypt the given key. If none are appropriate, a nil *tls.Config is returned.

func NormalizeString

func NormalizeString(s string) string

NormalizeString will replace all slashes, dots, colons and percent signs with dashes

func ParseGVKR

func ParseGVKR(restMapper meta.RESTMapper, apiVersion string, kind string) (kedav1alpha1.GroupVersionKindResource, error)

ParseGVKR returns GroupVersionKindResource for specified apiVersion (groupVersion) and Kind

func ResolveOsEnvDuration added in v2.8.0

func ResolveOsEnvDuration(envName string) (*time.Duration, error)

func ResolveOsEnvInt added in v2.5.0

func ResolveOsEnvInt(envName string, defaultValue int) (int, error)

Types

type HTTPDoer

type HTTPDoer interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPDoer is an interface that matches the Do method on (net/http).Client. It should be used in function signatures instead of raw *http.Clients wherever possible

type K8sVersion

type K8sVersion struct {
	Version       *version.Info
	MinorVersion  int
	PrettyVersion string
	Parsed        bool
}

K8sVersion holds parsed data from a K8s version

func NewK8sVersion

func NewK8sVersion(version *version.Info) K8sVersion

NewK8sVersion will parse a version info and return a struct

Jump to

Keyboard shortcuts

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