util

package
v0.0.0-...-81f7ef9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFromYAML

func ConvertFromYAML(yaml string, entity interface{}) error

ConvertFromYAML transforms yaml into the structure of the entity

func ConvertToYAML

func ConvertToYAML(entity interface{}) (string, error)

ConvertToYAML show entity as yaml

func ConvertYAMLToJSON

func ConvertYAMLToJSON(input []byte) ([]byte, error)

ConvertYAMLToJSON converts YAML to JSON

func Debug

func Debug() bool

Debug indicates if debug mode has been requested

func DumpYAML

func DumpYAML(entity interface{})

DumpYAML writes the entity as yaml data to the console

func LoadFile

func LoadFile(filename string) (data string, err error)

LoadFile reads string from a file

func LoadYAML

func LoadYAML(filename string, entity interface{}) (err error)

LoadYAML reads yaml from a file and transforms into the structure of the entity

func LogDebug

func LogDebug(context string, module string, info string)

LogDebug logs debug information

func LogError

func LogError(context string, module string, info string)

LogError logs error information

func LogFatal

func LogFatal(context string, module string, info string)

LogFatal logs fatal information

func LogInfo

func LogInfo(context string, module string, info string)

LogInfo logs info information

func LogLevel

func LogLevel(level string)

LogLevel sets the LogLevel

func LogPanic

func LogPanic(context string, module string, info string)

LogPanic logs panic information

func LogWarn

func LogWarn(context string, module string, info string)

LogWarn logs warning information

func ParseCommandLineOptions

func ParseCommandLineOptions()

ParseCommandLineOptions parses the options of the CLI

func Print

func Print(format string, args ...interface{})

Print outputs a message

func PullImage

func PullImage(image string, version string) error

PullImage retrieves an image into the local repository

func SaveFile

func SaveFile(filename string, data string) (err error)

SaveFile writes string to a file

func SaveYAML

func SaveYAML(filename string, entity interface{}) error

SaveYAML writes the entity as yaml data to a file

func StartContainer

func StartContainer(image string, version string) (port int, err error)

StartContainer starts a new container

func StartLogging

func StartLogging()

StartLogging initiate logging

func StopContainer

func StopContainer(image string, version string) (err error)

StopContainer stops a container

func UUID

func UUID() string

UUID creates a universal unique id

Types

type Configuration

type Configuration struct {
	MSG         MsgConfiguration
	CORE        CoreConfiguration
	CONTROLLERS []string // list of controller tags of the format "image-name:version"
}

Configuration holds all configuration information for the application

func GetConfiguration

func GetConfiguration() (*Configuration, error)

GetConfiguration retrieves the configuration.

func ReadConfiguration

func ReadConfiguration(path string) (*Configuration, error)

ReadConfiguration reads a file from a specific path into a Configuration object

type ContainerPort

type ContainerPort struct {
	IP          string `yaml:"IP"          json:"IP"`
	PrivatePort int    `yaml:"PrivatePort" json:"PrivatePort"`
	PublicPort  int    `yaml:"PublicPort"  json:"PublicPort"`
	Type        string `yaml:"Type"        json:"Type"`
}

ContainerPort list details related to a container port

type ContainerSummmary

type ContainerSummmary struct {
	ID     string            `yaml:"Id"     json:"Id"`
	Image  string            `yaml:"Image"  json:"Image"`
	Names  []string          `yaml:"Names"  json:"Names"`
	Ports  []ContainerPort   `yaml:"Ports"  json:"Ports"`
	Labels map[string]string `yaml:"Labels" json:"Labels"`
	State  string            `yaml:"State"  json:"State"`
}

ContainerSummmary has the details of a container

func ListContainers

func ListContainers() ([]ContainerSummmary, error)

ListContainers lists all available containers

type CoreConfiguration

type CoreConfiguration struct {
	Identifier string
	LogLevel   string
}

CoreConfiguration holds all configuration information related to the orchestrator

type ImageSummary

type ImageSummary struct {
	ID       string            `yaml:"Id"       json:"Id"`
	Labels   map[string]string `yaml:"Labels"   json:"Labels"`
	RepoTags []string          `yaml:"RepoTags" json:"RepoTags"`
}

ImageSummary list details related to an image

func ListImages

func ListImages() ([]ImageSummary, error)

ListImages lists all available images

type MsgConfiguration

type MsgConfiguration struct {
	Notifications string
	Monitoring    string
	Address       string
}

MsgConfiguration holds all configuration information for the MSG module

Jump to

Keyboard shortcuts

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