parser

package
v3.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: LGPL-3.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPortProtocol

func GetPortProtocol(port int) string

GetPortProtocol 获取端口协议

func SolveAdvice

func SolveAdvice(actionType, message string) string

SolveAdvice 构建a标签建议

Types

type DockerComposeParse

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

DockerComposeParse docker compose 文件解析

func (*DockerComposeParse) GetImage

func (d *DockerComposeParse) GetImage() Image

GetImage 获取镜像名

func (*DockerComposeParse) GetServiceInfo

func (d *DockerComposeParse) GetServiceInfo() []ServiceInfo

GetServiceInfo 获取service info

func (*DockerComposeParse) Parse

Parse 解码

type DockerRunOrImageParse

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

DockerRunOrImageParse docker run 命令解析或直接镜像名解析

func (*DockerRunOrImageParse) GetArgs

func (d *DockerRunOrImageParse) GetArgs() []string

GetArgs 启动参数

func (*DockerRunOrImageParse) GetBranchs

func (d *DockerRunOrImageParse) GetBranchs() []string

GetBranchs 获取分支列表

func (*DockerRunOrImageParse) GetEnvs

func (d *DockerRunOrImageParse) GetEnvs() (envs []Env)

GetEnvs 环境变量

func (*DockerRunOrImageParse) GetImage

func (d *DockerRunOrImageParse) GetImage() Image

GetImage 获取镜像

func (*DockerRunOrImageParse) GetMemory

func (d *DockerRunOrImageParse) GetMemory() int

GetMemory 获取内存

func (*DockerRunOrImageParse) GetPorts

func (d *DockerRunOrImageParse) GetPorts() (ports []Port)

GetPorts 获取端口列表

func (*DockerRunOrImageParse) GetServiceInfo

func (d *DockerRunOrImageParse) GetServiceInfo() []ServiceInfo

GetServiceInfo 获取service info

func (*DockerRunOrImageParse) GetValid

func (d *DockerRunOrImageParse) GetValid() bool

GetValid 获取源是否合法

func (*DockerRunOrImageParse) GetVolumes

func (d *DockerRunOrImageParse) GetVolumes() (volumes []Volume)

GetVolumes 获取存储列表

func (*DockerRunOrImageParse) Parse

Parse 解码,获取镜像,解析镜像 eg. docker run -it -p 80:80 nginx

type Env

type Env struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Env env desc

type GetServiceInfo

type GetServiceInfo struct {
	UUID   string `json:"uuid"`
	Source string `json:"source"`
}

GetServiceInfo GetServiceInfo

type Image

type Image struct {
	Name string `json:"name"`
	Tag  string `json:"tag"`
}

Image 镜像

func (Image) String

func (i Image) String() string

type Lang

type Lang string

Lang 语言类型

type ParseError

type ParseError struct {
	ErrorType   ParseErrorType `json:"error_type"`
	ErrorInfo   string         `json:"error_info"`
	SolveAdvice string         `json:"solve_advice"`
}

ParseError 错误信息

func ErrorAndSolve

func ErrorAndSolve(errtype ParseErrorType, errorInfo, SolveAdvice string) ParseError

ErrorAndSolve error create

func Errorf

func Errorf(errtype ParseErrorType, format string, a ...interface{}) ParseError

Errorf error create

func (ParseError) Error

func (p ParseError) Error() string

type ParseErrorList

type ParseErrorList []ParseError

ParseErrorList 错误列表

func (ParseErrorList) Error

func (ps ParseErrorList) Error() string

func (ParseErrorList) IsFatalError

func (ps ParseErrorList) IsFatalError() bool

IsFatalError 是否具有致命错误

type ParseErrorType

type ParseErrorType string

ParseErrorType 错误类型

var FatalError ParseErrorType = "FatalError"

FatalError 致命错误

var NegligibleError ParseErrorType = "NegligibleError"

NegligibleError 可忽略错误

type Parser

type Parser interface {
	Parse() ParseErrorList
	GetServiceInfo() []ServiceInfo
	GetImage() Image
}

Parser 解析器

func CreateDockerComposeParse

func CreateDockerComposeParse(source string, dockerclient *client.Client, logger event.Logger) Parser

CreateDockerComposeParse create parser

func CreateDockerRunOrImageParse

func CreateDockerRunOrImageParse(source string, dockerclient *client.Client, logger event.Logger) Parser

CreateDockerRunOrImageParse create parser

func CreateSourceCodeParse

func CreateSourceCodeParse(source string, logger event.Logger) Parser

CreateSourceCodeParse create parser

type Port

type Port struct {
	ContainerPort int    `json:"container_port"`
	Protocol      string `json:"protocol"`
}

Port 端口

type ServiceInfo

type ServiceInfo struct {
	Ports             []Port    `json:"ports"`
	Envs              []Env     `json:"envs"`
	Volumes           []Volume  `json:"volumes"`
	Image             Image     `json:"image"`
	Args              []string  `json:"args"`
	DependServices    []string  `json:"depends,omitempty"`
	ServiceDeployType string    `json:"deploy_type,omitempty"`
	Branchs           []string  `json:"branchs,omitempty"`
	Memory            int       `json:"memory"`
	Lang              code.Lang `json:"language"`
	Runtime           bool      `json:"runtime"`
	Dependencies      bool      `json:"dependencies"`
	Procfile          bool      `json:"procfile"`
	ImageAlias        string    `json:"image_alias"`
}

ServiceInfo 智能获取的应用信息

type SourceCodeParse

type SourceCodeParse struct {
	Lang         code.Lang
	Runtime      bool `json:"runtime"`
	Dependencies bool `json:"dependencies"`
	Procfile     bool `json:"procfile"`
	// contains filtered or unexported fields
}

SourceCodeParse docker run 命令解析或直接镜像名解析

func (*SourceCodeParse) GetArgs

func (d *SourceCodeParse) GetArgs() []string

GetArgs 启动参数

func (*SourceCodeParse) GetBranchs

func (d *SourceCodeParse) GetBranchs() []string

GetBranchs 获取分支列表

func (*SourceCodeParse) GetEnvs

func (d *SourceCodeParse) GetEnvs() (envs []Env)

GetEnvs 环境变量

func (*SourceCodeParse) GetImage

func (d *SourceCodeParse) GetImage() Image

GetImage 获取镜像

func (*SourceCodeParse) GetLang

func (d *SourceCodeParse) GetLang() code.Lang

GetLang 获取识别语言

func (*SourceCodeParse) GetMemory

func (d *SourceCodeParse) GetMemory() int

GetMemory 获取内存

func (*SourceCodeParse) GetPorts

func (d *SourceCodeParse) GetPorts() (ports []Port)

GetPorts 获取端口列表

func (*SourceCodeParse) GetRuntime

func (d *SourceCodeParse) GetRuntime() bool

GetRuntime GetRuntime

func (*SourceCodeParse) GetServiceInfo

func (d *SourceCodeParse) GetServiceInfo() []ServiceInfo

GetServiceInfo 获取service info

func (*SourceCodeParse) GetValid

func (d *SourceCodeParse) GetValid() bool

GetValid 获取源是否合法

func (*SourceCodeParse) GetVolumes

func (d *SourceCodeParse) GetVolumes() (volumes []Volume)

GetVolumes 获取存储列表

func (*SourceCodeParse) Parse

func (d *SourceCodeParse) Parse() ParseErrorList

Parse 获取代码 解析代码 检验代码

type Volume

type Volume struct {
	VolumePath string `json:"volume_path"`
	VolumeType string `json:"volume_type"`
}

Volume 存储地址

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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