utils

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v1.9.0

func Contains[T comparable](vs []T, x T) bool

Contains returns true if vs contains x.

func CreateContainerName added in v0.2.0

func CreateContainerName(serviceContainerName string, dockerNetwork string) string

func CreateDirectory added in v0.3.0

func CreateDirectory(dir string) error

func GetContainerRuntimeCmd added in v1.9.0

func GetContainerRuntimeCmd(containerRuntime string) string

GetContainerRuntimeCmd returns a valid container runtime to be used by CLI operations. If the input is a valid container runtime, it is returned as is. Otherwise the default container runtime, docker, is returned.

func GetDefaultRegistry added in v1.7.0

func GetDefaultRegistry(githubContainerRegistryName, dockerContainerRegistryName string) (string, error)

func GetEnv added in v1.9.0

func GetEnv(envName string, defaultValue string) string

GetEnv get value from environment variable.

func GetSocket added in v1.5.0

func GetSocket(path, appID, protocol string) string

func GetVariantVersion added in v1.9.0

func GetVariantVersion(version, imageVariant string) string

func IsAddressLegal added in v1.4.0

func IsAddressLegal(address string) bool

func IsDaprListeningOnPort added in v0.11.0

func IsDaprListeningOnPort(port int, timeout time.Duration) error

IsDaprListeningOnPort checks if Dapr is litening to a given port.

func IsDaprListeningOnSocket added in v1.5.0

func IsDaprListeningOnSocket(socket string, timeout time.Duration) error

func IsDockerInstalled added in v0.8.0

func IsDockerInstalled() bool

IsDockerInstalled checks whether docker is installed/running.

func IsPodmanInstalled added in v1.9.0

func IsPodmanInstalled() bool

func IsValidContainerRuntime added in v1.9.0

func IsValidContainerRuntime(containerRuntime string) bool

IsValidContainerRuntime checks if the input is a valid container runtime. Valid container runtimes are docker and podman.

func MarshalAndWriteTable added in v1.0.0

func MarshalAndWriteTable(writer io.Writer, in interface{}) error

func PrintDetail added in v1.0.0

func PrintDetail(writer io.Writer, outputFormat string, list interface{}) error

func PrintTable

func PrintTable(csvContent string)

PrintTable to print in the table format.

func RunCmdAndWait

func RunCmdAndWait(name string, args ...string) (string, error)

func TruncateString

func TruncateString(str string, maxLength int) string

func ValidateImageVariant added in v1.9.0

func ValidateImageVariant(imageVariant string) error

func WriteTable added in v1.0.0

func WriteTable(writer io.Writer, csvContent string)

WriteTable writes the csv table to writer.

Types

type ContainerRuntime added in v1.9.0

type ContainerRuntime string
const (
	DOCKER ContainerRuntime = "docker"
	PODMAN ContainerRuntime = "podman"
)

Jump to

Keyboard shortcuts

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