util

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 12 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) *http.Client

CreateHTTPClient returns a new HTTP client with the timeout set to timeoutMS milliseconds, or 300 milliseconds if timeoutMS <= 0

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 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

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