utils

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToFloat64

func ConvertToFloat64(value interface{}) (result float64, err error)

ConvertToFloat64 converts value to a float64 or errors out.

func GetCurrentTime

func GetCurrentTime() string

GetCurrentTime return the current time (time.Now()), with location set to UTC, as a string formatted with the RFC3339 layout. This should be the format of all timestamps returned by the SDK.

The SDK uses this function to generate all of its timestamps. It is highly recommended that plugins use this as well for timestamp generation.

func ParseRFC3339

func ParseRFC3339(timestamp string) (t time.Time, err error)

ParseRFC3339 parses a timestamp string in RFC3339 format into a Time struct. If it is given an empty string, it will return the zero-value for a Time instance. You can check if it is a zero time with the Time's `IsZero` method.

func RedactPasswords

func RedactPasswords(obj interface{}) (redacted interface{}, err error)

RedactPasswords redacts any map fields where the key contains the substring "pass" (case-insensitive). It traverses through any slice or map within to search for fields to redact.

This does not make any attempt to find other potential passwords as magic strings. via regex, or via entropy. This is just meant to cover the basic case of "pass": "foo" within various config locations where it is likely to exist and should not be leaked out into logs.

This function is likely very inefficient due to the interface casting and the need to copy the lists/maps provided so that it does not overwrite the original list/map.

Types

This section is empty.

Jump to

Keyboard shortcuts

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