utils

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Encode

func Base64Encode(s1, s2 string) string

Returns base64 encoding of two strings for use with Basic Auth

func CheckDate

func CheckDate(t string) error

Checks a string to see if it contains a valid date. Returns error if not valid

func Marshal added in v1.6.3

func Marshal(payload any) ([]byte, error)

Takes a payload and returns JSON

func MarshalIndent added in v1.6.3

func MarshalIndent(payload any) ([]byte, error)

Takes a payload and returns indented JSON

func TruncateString added in v1.6.0

func TruncateString(s string, n int) string

Takes a string, s, and returns n bytes of it. If s is of n bytes or less, then s is returned back

func Unmarshal

func Unmarshal[T any](payload []byte) (T, error)

Takes a JSON payload and copies it into a struct T Used in utils_test.go

func ValidateInstanceID added in v1.1.0

func ValidateInstanceID(InstanceID string) error

ValidateInstanceID checks if the instance ID is valid and returns an error if not

func ValidateSnapshotID added in v1.8.0

func ValidateSnapshotID(snapshotID string) error

ValidateSnapshotID checks if the tenant ID is valid and returns an error if not

func ValidateTenantID added in v1.0.5

func ValidateTenantID(tenantID string) error

ValidateTenantID checks if the tenant ID is valid and returns an error if not

Types

This section is empty.

Jump to

Keyboard shortcuts

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