util

package
v0.0.0-...-f0fce53 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstancePoolActionAdd    = "add"
	InstancePoolActionDelete = "delete"
)
View Source
const (
	TopologyFormatCSV     = "csv"
	TopologyFormatMermaid = "mermaid"

	MermaidFlowOrientationTB = "TB"
	MermaidFlowOrientationLR = "LR"

	MermaidFlowShapeRectangle        = "rectangle"
	MermaidFlowShapeRoundEdges       = "roundEdges"
	MermaidFlowShapeStadium          = "stadium"
	MermaidFlowShapeSubroutine       = "subroutine"
	MermaidFlowShapeCylindrical      = "cylindrical"
	MermaidFlowShapeCircle           = "circle"
	MermaidFlowShapeAsymmetric       = "asymmetric"
	MermaidFlowShapeRhombus          = "rhombus"
	MermaidFlowShapeHexagon          = "hexagon"
	MermaidFlowShapeParallelogram    = "parallelogram"
	MermaidFlowShapeParallelogramAlt = "parallelogramAlt"
	MermaidFlowShapeTrapezoid        = "trapezoid"
	MermaidFlowShapeTrapezoidAlt     = "trapezoidAlt"

	MermaidFlowLinkTypeNormal = "normal"
	MermaidFlowLinkTypeThick  = "thick"
	MermaidFlowLinkTypeDotted = "dotted"

	MermaidFlowArrowRound    = "round"
	MermaidFlowArrowTriangle = "triangle"
	MermaidFlowArrowFork     = "fork"
)

Variables

This section is empty.

Functions

func AddInstancePoolItem

func AddInstancePoolItem(dataDir, host, instanceName, instanceUid string) (int, error)

func CheckIPAddressType

func CheckIPAddressType(ip string) bool

func EncodeMD5

func EncodeMD5(value string) string

EncodeMD5 md5 encryption

func GenerateToken

func GenerateToken(username, password string) (string, error)

GenerateToken generate tokens used for auth

func GetInstancePoolItem

func GetInstancePoolItem(dataDir, host, instanceName, instanceUid string) (int, error)

func RemoteSshCommand

func RemoteSshCommand(host string, user string, password string, port uint16, command string) (result string, err error)

func RemoveInstancePoolItem

func RemoveInstancePoolItem(dataDir, host, instanceName, instanceUid string) (int, error)

func RenderMermaidFlowChart

func RenderMermaidFlowChart(obj MermaidFlow) (string, error)

func RunCommand

func RunCommand(comm string)

func Setup

func Setup()

Setup Initialize the util

func Tailf

func Tailf(ctx context.Context, path string) (<-chan string, error)

Types

type CSVWriter

type CSVWriter struct {
	// contains filtered or unexported fields
}

func NewCSVWriter

func NewCSVWriter(headers []string) CSVWriter

func (CSVWriter) String

func (w CSVWriter) String() string

func (*CSVWriter) WriteRow

func (w *CSVWriter) WriteRow(cells []string) error

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

ParseToken parsing token

type GPUInfo

type GPUInfo struct {
	ID     int
	Model  string
	UUID   string
	Memory int
}

func GetGPUInfo

func GetGPUInfo(host string, user string, password string, port uint16) ([]GPUInfo, error)

type MachineInfo

type MachineInfo struct {
	OS         string
	CPUCores   int
	MemorySize int
	DiskSize   int
}

func GetMachineInfo

func GetMachineInfo(host string, user string, password string, port uint16) (MachineInfo, error)

type MermaidFlow

type MermaidFlow struct {
	Orientation string
	Nodes       map[string]MermaidFlowNode
	Links       []MermaidFlowLink
	SubGraphs   map[string]MermaidFlowSubGraph
}
type MermaidFlowLink struct {
	Src      MermaidFlowLinkEndpoint
	Dst      MermaidFlowLinkEndpoint
	LinkType string
	LinkText string
}

type MermaidFlowLinkEndpoint

type MermaidFlowLinkEndpoint struct {
	Name  string
	Arrow string
}

type MermaidFlowNode

type MermaidFlowNode struct {
	Desc  string
	Shape string
}

type MermaidFlowSubGraph

type MermaidFlowSubGraph struct {
	Nodes map[string]MermaidFlowNode
	Links []MermaidFlowLink
}

Jump to

Keyboard shortcuts

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