util

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyToObject

func BodyToObject(r *http.Request, object interface{}) error

BodyToObject will convert the incoming HTTP request into the passed in 'object'

func ExecCmd

func ExecCmd(cmd string) (string, error)

ExecCmd executes a command and returns the stdout + error, if any

func Fetch

func Fetch(u string) (string, error)

Fetch will do an HTTP GET to the passed in URL, returning HTTP Body of the response or any error

func FetchObject

func FetchObject(u string, object interface{}) error

FetchObject will do an HTTP GET to the passed in URL, returning the response parsed as a JSON object, or any error

func GenerateSHA

func GenerateSHA(input string) string

GenerateSHA generates the sha224 value from the given string the function is used to provide a string length less than 63 characters, this string is used in label of resource sha algorithm cannot be changed in the future because of backward compatibles

func ResponseBodyToObject

func ResponseBodyToObject(r *http.Response, object interface{}) error

ResponseBodyToObject will reading the HTTP response into the passed in 'object'

func WaitForServiceCatalogCRDs

func WaitForServiceCatalogCRDs(restConfig *restclient.Config) error

WaitForServiceCatalogCRDs waits for Service Catalog CRDs to be activated in main api-server because it may take some time before Catalog CRDs registration shows up. It is useful to ensure that CRDs are ready before creating Service Catalog clients/informers.

func WriteErrorResponse

func WriteErrorResponse(w http.ResponseWriter, code int, err error)

WriteErrorResponse will serialize 'object' to the HTTP ResponseWriter with JSON formatted error response using the 'code' as the HTTP status code

func WriteResponse

func WriteResponse(w http.ResponseWriter, code int, object interface{})

WriteResponse will serialize 'object' to the HTTP ResponseWriter using the 'code' as the HTTP status code

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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