Documentation
¶
Index ¶
- func ArrContains(a, b []string) bool
- func CalculatePercentageInt32(part, total int32) int32
- func DecodeCidr(ipCidr string) string
- func DecodeString(content string, keyVal map[string]string) string
- func DecodeYaml(yamlContent string, keyVal map[string]string) string
- func DeserializeFromBase64(data string, msg proto.Message) error
- func DownloadFile(rawURL string) (string, error)
- func GenerateCIDR(ip string, prefixLen int) (string, error)
- func GenerateSubnet(vpcCIDR string, exitsSubnets []string) (string, error)
- func GenerateSubnets(vpcCIDR string, subnetCount int) ([]string, error)
- func GetFilePathAndName(path string) (string, string)
- func GetFromContext(ctx context.Context) map[string]string
- func GetFromContextByKey(ctx context.Context, key MatedataKey) string
- func GetLogFilePath() string
- func GetServerStoragePathByNames(packageNames ...string) string
- func Int64Ptr(i int64) *int64
- func IsFileExist(path string) bool
- func IsSubnetOverlap(cidr1, cidr2 string) (bool, error)
- func IsValidKubernetesName(name string) bool
- func LabelsToMap(labels string) map[string]string
- func MapToLabels(m map[string]string) string
- func MapToString(m map[string]string) string
- func Md5(str string) string
- func MergeMaps(maps ...map[string]string) map[string]string
- func NewLog(conf *conf.Bootstrap) *logtool
- func RangeIps(startIp, endIp string) []string
- func ReadLastNLines(file *os.File, n int) (string, error)
- func RemoveDuplicatesInt64(slice []int64) []int64
- func SerializeToBase64(msg proto.Message) (string, error)
- func StringPtr(s string) *string
- func StringToMap(s string) map[string]string
- func StringValue(s *string) string
- func StructTransform(a, b any) error
- func TransferredMeaning(data any, fileDetailPath string) (tmpFile string, err error)
- func TransferredMeaningString(data any, fileDetailPath string) (string, error)
- func WriteFile(filePath, content string) error
- type Bash
- type File
- type GrpcConn
- type MatedataKey
- type RemoteBash
- func (s *RemoteBash) ExecShell(shellName string, args ...string) (stdout string, err error)
- func (s *RemoteBash) ExecShellLogging(shellName string, args ...string) error
- func (s *RemoteBash) GetRootHome() (string, error)
- func (s *RemoteBash) GetUserHome() (string, error)
- func (s *RemoteBash) Run(command string, args ...string) (stdout string, err error)
- func (s *RemoteBash) RunWithLogging(command string, args ...string) error
- func (s *RemoteBash) SftpFile(localFile, remoteFile string) error
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrContains ¶
func DecodeCidr ¶
func DownloadFile ¶
func GetFilePathAndName ¶
func GetFromContextByKey ¶
func GetFromContextByKey(ctx context.Context, key MatedataKey) string
func GetLogFilePath ¶
func GetLogFilePath() string
func IsFileExist ¶
func IsSubnetOverlap ¶
func IsValidKubernetesName ¶
check string '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
func LabelsToMap ¶
labels (string) to map[string]string
func MapToLabels ¶
map[string]string to labels (string)
func MapToString ¶
MapToString converts a map[string]string to a comma-separated string
func MergeMaps ¶
MergeMaps combines multiple string maps into a single map. If there are duplicate keys, the value from the later map takes precedence.
func RangeIps ¶
example: startIp 192.168.0.1 endIp 192.168.0.254, return 192.168.0.1 192.168.0.2 .... 192.168.0.254
func ReadLastNLines ¶
ReadLastNLines reads the last n lines from a file.
func RemoveDuplicatesInt64 ¶
func StringToMap ¶
StringToMap converts a comma-separated string back to map[string]string
func StringValue ¶
func StructTransform ¶
func TransferredMeaning ¶
Types ¶
type Bash ¶
type Bash struct {
// contains filtered or unexported fields
}
func (*Bash) RunCommand ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) ClearFileContent ¶
func (*File) GetFileFullPath ¶
func (*File) GetFileName ¶
func (*File) GetFilePath ¶
type GrpcConn ¶
type GrpcConn struct {
Conn *grpcConnect.ClientConn
Ctx context.Context
}
type MatedataKey ¶
type MatedataKey string
const ( ServiceNameKey MatedataKey = "service" ServiceVersionKey MatedataKey = "version" RuntimeKey MatedataKey = "runtime" OSKey MatedataKey = "os" ArchKey MatedataKey = "arch" ConfKey MatedataKey = "conf" ConfDirKey MatedataKey = "confdir" )
func (MatedataKey) String ¶
func (m MatedataKey) String() string
type RemoteBash ¶
type RemoteBash struct {
// contains filtered or unexported fields
}
func NewRemoteBash ¶
func NewRemoteBash(server Server, shellDir string, log *log.Helper) *RemoteBash
func (*RemoteBash) ExecShell ¶
func (s *RemoteBash) ExecShell(shellName string, args ...string) (stdout string, err error)
func (*RemoteBash) ExecShellLogging ¶
func (s *RemoteBash) ExecShellLogging(shellName string, args ...string) error
func (*RemoteBash) GetRootHome ¶
func (s *RemoteBash) GetRootHome() (string, error)
func (*RemoteBash) GetUserHome ¶
func (s *RemoteBash) GetUserHome() (string, error)
func (*RemoteBash) Run ¶
func (s *RemoteBash) Run(command string, args ...string) (stdout string, err error)
func (*RemoteBash) RunWithLogging ¶
func (s *RemoteBash) RunWithLogging(command string, args ...string) error
RunWithLogging runs a command and logs its output
func (*RemoteBash) SftpFile ¶
func (s *RemoteBash) SftpFile(localFile, remoteFile string) error
Click to show internal directories.
Click to hide internal directories.