util

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomString

func RandomString() string

Alphanumeric. Specifics may change and it isn't guaranteed to be cryptographically secure

func RedactURLForLog

func RedactURLForLog(rawURL string) string

A {ctx.*} placeholder can resolve to a live credential, so logged URLs must pass through this. Unparseable ones are replaced

func Ternary

func Ternary[T any](cond bool, a T, b T) T

cond ? a : b

Types

type ClientFailure

type ClientFailure struct {
	Cause    string
	Timeout  bool
	Canceled bool
	// The original message with the URL passed through RedactURLForLog. Only for debug logs.
	Detail string
}

ClientFailure summarizes an http.Client error. The upstream URL can hold an operator's credentials, and the hostname can too, so Cause and Timeout never include either.

func DescribeClientError

func DescribeClientError(err error) ClientFailure

DescribeClientError is meant for errors from http.Client.Do, which are always a *url.Error.

Jump to

Keyboard shortcuts

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