util

package
v0.0.0-...-13bb9b6 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Raw            string = "raw"
	JSON           string = "json"
	FormData       string = "form-data"
	FormURLEncoded string = "form-urlencoded"
)

Variables

View Source
var CharsetAliases = map[string]string{
	"iso-8859-1": "latin1",
	"iso88591":   "latin1",
	"iso8859-1":  "latin1",
}
View Source
var Encoding = []string{"ascii", "utf8", "utf-8", "utf16le", "ucs2", "ucs-2", "base64", "base64url", "latin1", "binary", "hex"}

Functions

func Base64ToJWK

func Base64ToJWK(privateKey string) (jwk jose.JSONWebKey, err error)

func EcdsaToJWK

func EcdsaToJWK(key any) (*jose.JSONWebKey, error)

func GenerateKeys

func GenerateKeys() (*jose.JSONWebKey, *jose.JSONWebKey, error)

func GeneratePARJWT

func GeneratePARJWT(orgId int64, runnerId string, privateKey *ecdsa.PrivateKey, extraClaims map[string]any) (string, error)

func JWKToPEM

func JWKToPEM(pubJWK *jose.JSONWebKey) (string, error)

func MakeRunnerURN

func MakeRunnerURN(region string, orgID int64, runnerID string) string

func ParseResponseBody

func ParseResponseBody(
	contentType string,
	data []byte,
	responseParsing string,
	responseEncoding string,
	statusCode int,
) (interface{}, error)

Types

type CircuitBreaker

type CircuitBreaker struct {
	// contains filtered or unexported fields
}

CircuitBreaker is a rudimentary circuit breaker that performs retries using exponential backoff.

func NewCircuitBreaker

func NewCircuitBreaker(name string, minBackoff, maxBackoff, waitBeforeRetry time.Duration, maxAttempts int32) *CircuitBreaker

func (*CircuitBreaker) Do

func (breaker *CircuitBreaker) Do(ctx context.Context, fn func() error)

type FormDataField

type FormDataField struct {
	Filename string
	Name     string
	Type     string
	Data     interface{}
}

type PARError

type PARError struct {
	*aperrorpb.ActionPlatformError
}

func DefaultActionError

func DefaultActionError(e error) PARError

DefaultActionError generates the default PAR action error with a default action error code.

func DefaultActionErrorWithDisplayError

func DefaultActionErrorWithDisplayError(e error, displayError string) PARError

DefaultActionErrorWithDisplayError generates the default PAR action error with a default action error code and display error.

func DefaultPARError

func DefaultPARError(e error) PARError

DefaultPARError generates the default PAR error with a default error code, and default internal error message.

func NewPARError

func NewPARError(code aperrorpb.ActionPlatformErrorCode, e error) PARError

NewPARError creates a general PAR error with default config.

func NewPARErrorWithDisplayError

func NewPARErrorWithDisplayError(code aperrorpb.ActionPlatformErrorCode, e error, displayError string) PARError

NewPARErrorWithDisplayError creates a general PAR error with display error.

func (PARError) Error

func (pe PARError) Error() string

type RunnerURNParts

type RunnerURNParts struct {
	Region   string
	OrgID    int64
	RunnerID string
}

func ParseRunnerURN

func ParseRunnerURN(urn string) (RunnerURNParts, error)

Jump to

Keyboard shortcuts

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