Documentation ¶
Index ¶
- func DetermineDeployType(imageName Image) string
- func GetPortProtocol(port int) string
- func ReadWtConfigAndLang(buildInfo *sources.RepostoryBuildInfo) (*code.WutongFileConfig, code.Lang, error)
- func SolveAdvice(actionType, message string) string
- type DockerComposeParse
- type DockerRunOrImageParse
- func (d *DockerRunOrImageParse) GetArgs() []string
- func (d *DockerRunOrImageParse) GetBranchs() []string
- func (d *DockerRunOrImageParse) GetEnvs() (envs []types.Env)
- func (d *DockerRunOrImageParse) GetImage() Image
- func (d *DockerRunOrImageParse) GetMemory() int
- func (d *DockerRunOrImageParse) GetPorts() (ports []types.Port)
- func (d *DockerRunOrImageParse) GetServiceInfo() []ServiceInfo
- func (d *DockerRunOrImageParse) GetValid() bool
- func (d *DockerRunOrImageParse) GetVolumes() (volumes []types.Volume)
- func (d *DockerRunOrImageParse) Parse() ParseErrorList
- func (d *DockerRunOrImageParse) ParseDockerun(cmd string)
- type GetServiceInfo
- type Image
- type Lang
- type ParseError
- type ParseErrorList
- type ParseErrorType
- type Parser
- type ServiceInfo
- type ServiceInfoFromDC
- type SourceCodeParse
- func (d *SourceCodeParse) GetArgs() []string
- func (d *SourceCodeParse) GetBranchs() []string
- func (d *SourceCodeParse) GetEnvs() (envs []types.Env)
- func (d *SourceCodeParse) GetImage() Image
- func (d *SourceCodeParse) GetLang() code.Lang
- func (d *SourceCodeParse) GetMemory() int
- func (d *SourceCodeParse) GetPorts() (ports []types.Port)
- func (d *SourceCodeParse) GetServiceInfo() []ServiceInfo
- func (d *SourceCodeParse) GetValid() bool
- func (d *SourceCodeParse) GetVolumes() (volumes []types.Volume)
- func (d *SourceCodeParse) Parse() ParseErrorList
- type ThirdPartyServiceParse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetermineDeployType ¶
DetermineDeployType Determine the deployment type if image like db image,return stateful type
func ReadWtConfigAndLang ¶
func ReadWtConfigAndLang(buildInfo *sources.RepostoryBuildInfo) (*code.WutongFileConfig, code.Lang, error)
ReadWtConfigAndLang read wutongfile and lang
Types ¶
type DockerComposeParse ¶
type DockerComposeParse struct {
// contains filtered or unexported fields
}
DockerComposeParse docker compose 文件解析
func (*DockerComposeParse) GetServiceInfo ¶
func (d *DockerComposeParse) GetServiceInfo() []ServiceInfo
GetServiceInfo 获取service info
type DockerRunOrImageParse ¶
type DockerRunOrImageParse struct {
// contains filtered or unexported fields
}
DockerRunOrImageParse docker run 命令解析或直接镜像名解析
func CreateDockerRunOrImageParse ¶
func CreateDockerRunOrImageParse(user, pass, source string, imageClient sources.ImageClient, logger event.Logger) *DockerRunOrImageParse
CreateDockerRunOrImageParse create parser
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 []types.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 []types.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 []types.Volume)
GetVolumes 获取存储列表
func (*DockerRunOrImageParse) Parse ¶
func (d *DockerRunOrImageParse) Parse() ParseErrorList
Parse 解码,获取镜像,解析镜像 eg. docker run -it -p 80:80 nginx
func (*DockerRunOrImageParse) ParseDockerun ¶
func (d *DockerRunOrImageParse) ParseDockerun(cmd string)
ParseDockerun parse docker run command
type GetServiceInfo ¶
GetServiceInfo GetServiceInfo
type Image ¶
type Image struct { Name string `json:"name"` Tag string `json:"tag"` // contains filtered or unexported fields }
Image 镜像
func (Image) GetSimpleName ¶
GetSimpleName get image name without tag and organizations
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 ¶
CreateDockerComposeParse create parser
func CreateSourceCodeParse ¶
CreateSourceCodeParse create parser
type ServiceInfo ¶
type ServiceInfo struct { ID string `json:"id,omitempty"` Ports []types.Port `json:"ports,omitempty"` Envs []types.Env `json:"envs,omitempty"` Volumes []types.Volume `json:"volumes,omitempty"` Image Image `json:"image,omitempty"` Args []string `json:"args,omitempty"` DependServices []string `json:"depends,omitempty"` ServiceType string `json:"service_type,omitempty"` Branchs []string `json:"branchs,omitempty"` Memory int `json:"memory,omitempty"` Lang code.Lang `json:"language,omitempty"` ImageAlias string `json:"image_alias,omitempty"` //For third party services Endpoints []*discovery.Endpoint `json:"endpoints,omitempty"` //os type,default linux OS string `json:"os"` Name string `json:"name,omitempty"` // module name Cname string `json:"cname,omitempty"` // service cname Packaging string `json:"packaging,omitempty"` }
ServiceInfo 智能获取的应用信息
type ServiceInfoFromDC ¶
type ServiceInfoFromDC struct {
// contains filtered or unexported fields
}
ServiceInfoFromDC service info from dockercompose
func (*ServiceInfoFromDC) GetEnvs ¶
func (d *ServiceInfoFromDC) GetEnvs() (envs []types.Env)
GetEnvs 环境变量
func (*ServiceInfoFromDC) GetPorts ¶
func (d *ServiceInfoFromDC) GetPorts() (ports []types.Port)
GetPorts 获取端口列表
func (*ServiceInfoFromDC) GetVolumes ¶
func (d *ServiceInfoFromDC) GetVolumes() (volumes []types.Volume)
GetVolumes 获取存储列表
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) GetBranchs ¶
func (d *SourceCodeParse) GetBranchs() []string
GetBranchs 获取分支列表
func (*SourceCodeParse) GetEnvs ¶
func (d *SourceCodeParse) GetEnvs() (envs []types.Env)
GetEnvs 环境变量
func (*SourceCodeParse) GetPorts ¶
func (d *SourceCodeParse) GetPorts() (ports []types.Port)
GetPorts 获取端口列表
func (*SourceCodeParse) GetServiceInfo ¶
func (d *SourceCodeParse) GetServiceInfo() []ServiceInfo
GetServiceInfo 获取service info
func (*SourceCodeParse) GetVolumes ¶
func (d *SourceCodeParse) GetVolumes() (volumes []types.Volume)
GetVolumes 获取存储列表
func (*SourceCodeParse) Parse ¶
func (d *SourceCodeParse) Parse() ParseErrorList
Parse 获取代码 解析代码 检验代码
type ThirdPartyServiceParse ¶
type ThirdPartyServiceParse struct {
// contains filtered or unexported fields
}
ThirdPartyServiceParse is one of the implematation of parser.Parser
func (*ThirdPartyServiceParse) GetImage ¶
func (t *ThirdPartyServiceParse) GetImage() Image
GetImage is a dummy method. there is no image for Third-party service.
func (*ThirdPartyServiceParse) GetServiceInfo ¶
func (t *ThirdPartyServiceParse) GetServiceInfo() []ServiceInfo
GetServiceInfo returns information of third-party service from the receiver *ThirdPartyServiceParse.
func (*ThirdPartyServiceParse) Parse ¶
func (t *ThirdPartyServiceParse) Parse() ParseErrorList
Parse blablabla