utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultContainerDetachKeys container's default attach keys string.
	DefaultContainerDetachKeys = "ctrl-p,ctrl-q"
)

Variables

View Source
var (
	// ErrEmptyVolDest empty volume destination error.
	ErrEmptyVolDest = errors.New("volume destination cannot be empty")
	// ErrTopPodNotRunning top error while pod not running.
	ErrTopPodNotRunning = errors.New("pods top can only be used on running pods")
	// ErrInvalidIPAddress invalid IP address error.
	ErrInvalidIPAddress = errors.New("invalid IP address")
	// ErrInvalidDNSAddress invalid DNS server address error.
	ErrInvalidDNSAddress = errors.New("invalid DNS address")
)

Functions

func CreatedToStr

func CreatedToStr(duration int64) string

CreatedToStr converts duration to human readable format.

func DefineCreateDefaults added in v0.9.0

func DefineCreateDefaults(opts *entities.ContainerCreateOptions)

DefineCreateDefaults sets default container create options.

func GetJSONOutput

func GetJSONOutput(v interface{}) (string, error)

GetJSONOutput converts interface to json output.

func PortsToString

func PortsToString(ports []types.PortMapping) string

PortsToString converts the ports used to a string of the from "port1, port2" and also groups a continuous list of ports into a readable format. The format is IP:HostPort(-Range)->ContainerPort(-Range)/Proto.

func PrintJSON

func PrintJSON(data []interface{}) (string, error)

PrintJSON convert data interface to json string.

func SizeToStr

func SizeToStr(size int64) string

SizeToStr converts size to human readable format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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