rainbond: github.com/goodrain/rainbond/builder/parser Index | Files | Directories

package parser

import "github.com/goodrain/rainbond/builder/parser"

Index

Package Files

docker_compose.go docker_run.go parser.go source_code.go third_party_service.go

func DetermineDeployType Uses

func DetermineDeployType(imageName Image) string

DetermineDeployType Determine the deployment type if image like db image,return stateful type

func GetPortProtocol Uses

func GetPortProtocol(port int) string

GetPortProtocol 获取端口协议

func ReadRbdConfigAndLang Uses

func ReadRbdConfigAndLang(buildInfo *sources.RepostoryBuildInfo) (*code.RainbondFileConfig, code.Lang, error)

ReadRbdConfigAndLang read rainbondfile and lang

func SolveAdvice Uses

func SolveAdvice(actionType, message string) string

SolveAdvice 构建a标签建议

type DockerComposeParse Uses

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

DockerComposeParse docker compose 文件解析

func (*DockerComposeParse) GetImage Uses

func (d *DockerComposeParse) GetImage() Image

GetImage 获取镜像名

func (*DockerComposeParse) GetServiceInfo Uses

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

GetServiceInfo 获取service info

func (*DockerComposeParse) Parse Uses

func (d *DockerComposeParse) Parse() ParseErrorList

Parse 解码

type DockerRunOrImageParse Uses

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

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

func (*DockerRunOrImageParse) GetArgs Uses

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

GetArgs 启动参数

func (*DockerRunOrImageParse) GetBranchs Uses

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

GetBranchs 获取分支列表

func (*DockerRunOrImageParse) GetEnvs Uses

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

GetEnvs 环境变量

func (*DockerRunOrImageParse) GetImage Uses

func (d *DockerRunOrImageParse) GetImage() Image

GetImage 获取镜像

func (*DockerRunOrImageParse) GetMemory Uses

func (d *DockerRunOrImageParse) GetMemory() int

GetMemory 获取内存

func (*DockerRunOrImageParse) GetPorts Uses

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

GetPorts 获取端口列表

func (*DockerRunOrImageParse) GetServiceInfo Uses

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

GetServiceInfo 获取service info

func (*DockerRunOrImageParse) GetValid Uses

func (d *DockerRunOrImageParse) GetValid() bool

GetValid 获取源是否合法

func (*DockerRunOrImageParse) GetVolumes Uses

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

GetVolumes 获取存储列表

func (*DockerRunOrImageParse) Parse Uses

func (d *DockerRunOrImageParse) Parse() ParseErrorList

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

type GetServiceInfo Uses

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

GetServiceInfo GetServiceInfo

type Image Uses

type Image struct {
    Name string `json:"name"`
    Tag  string `json:"tag"`
    // contains filtered or unexported fields
}

Image 镜像

func ParseImageName Uses

func ParseImageName(s string) (i Image)

ParseImageName parse image name

func (Image) GetDomain Uses

func (i Image) GetDomain() string

GetDomain get image registry domain

func (Image) GetRepostory Uses

func (i Image) GetRepostory() string

GetRepostory get repostory

func (Image) GetSimpleName Uses

func (i Image) GetSimpleName() string

GetSimpleName get image name without tag and organizations

func (Image) GetTag Uses

func (i Image) GetTag() string

GetTag get tag

func (Image) IsOfficial Uses

func (i Image) IsOfficial() bool

IsOfficial is official image

func (Image) String Uses

func (i Image) String() string

String -

type Lang Uses

type Lang string

Lang 语言类型

type ParseError Uses

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

ParseError 错误信息

func ErrorAndSolve Uses

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

ErrorAndSolve error create

func Errorf Uses

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

Errorf error create

func (ParseError) Error Uses

func (p ParseError) Error() string

type ParseErrorList Uses

type ParseErrorList []ParseError

ParseErrorList 错误列表

func (ParseErrorList) Error Uses

func (ps ParseErrorList) Error() string

func (ParseErrorList) IsFatalError Uses

func (ps ParseErrorList) IsFatalError() bool

IsFatalError 是否具有致命错误

type ParseErrorType Uses

type ParseErrorType string

ParseErrorType 错误类型

var FatalError ParseErrorType = "FatalError"

FatalError 致命错误

var NegligibleError ParseErrorType = "NegligibleError"

NegligibleError 可忽略错误

type Parser Uses

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

Parser 解析器

func CreateDockerComposeParse Uses

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

CreateDockerComposeParse create parser

func CreateDockerRunOrImageParse Uses

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

CreateDockerRunOrImageParse create parser

func CreateSourceCodeParse Uses

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

CreateSourceCodeParse create parser

func CreateThirdPartyServiceParse Uses

func CreateThirdPartyServiceParse(sourceBody string, logger event.Logger) Parser

CreateThirdPartyServiceParse creates a new ThirdPartyServiceParse.

type ServiceInfo Uses

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"`
    ServiceDeployType string         `json:"deploy_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"`

    Name      string `json:"name,omitempty"`  // module name
    Cname     string `json:"cname,omitempty"` // service cname
    Packaging string `json:"packaging,omitempty"`
}

ServiceInfo 智能获取的应用信息

type ServiceInfoFromDC Uses

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

ServiceInfoFromDC service info from dockercompose

func (*ServiceInfoFromDC) GetEnvs Uses

func (d *ServiceInfoFromDC) GetEnvs() (envs []types.Env)

GetEnvs 环境变量

func (*ServiceInfoFromDC) GetPorts Uses

func (d *ServiceInfoFromDC) GetPorts() (ports []types.Port)

GetPorts 获取端口列表

func (*ServiceInfoFromDC) GetVolumes Uses

func (d *ServiceInfoFromDC) GetVolumes() (volumes []types.Volume)

GetVolumes 获取存储列表

type SourceCodeParse Uses

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 Uses

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

GetArgs 启动参数

func (*SourceCodeParse) GetBranchs Uses

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

GetBranchs 获取分支列表

func (*SourceCodeParse) GetEnvs Uses

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

GetEnvs 环境变量

func (*SourceCodeParse) GetImage Uses

func (d *SourceCodeParse) GetImage() Image

GetImage 获取镜像

func (*SourceCodeParse) GetLang Uses

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

GetLang 获取识别语言

func (*SourceCodeParse) GetMemory Uses

func (d *SourceCodeParse) GetMemory() int

GetMemory 获取内存

func (*SourceCodeParse) GetPorts Uses

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

GetPorts 获取端口列表

func (*SourceCodeParse) GetServiceInfo Uses

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

GetServiceInfo 获取service info

func (*SourceCodeParse) GetValid Uses

func (d *SourceCodeParse) GetValid() bool

GetValid 获取源是否合法

func (*SourceCodeParse) GetVolumes Uses

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

GetVolumes 获取存储列表

func (*SourceCodeParse) Parse Uses

func (d *SourceCodeParse) Parse() ParseErrorList

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

type ThirdPartyServiceParse Uses

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

ThirdPartyServiceParse is one of the implematation of parser.Parser

func (*ThirdPartyServiceParse) GetImage Uses

func (t *ThirdPartyServiceParse) GetImage() Image

GetImage is a dummy method. there is no image for Third-party service.

func (*ThirdPartyServiceParse) GetServiceInfo Uses

func (t *ThirdPartyServiceParse) GetServiceInfo() []ServiceInfo

GetServiceInfo returns information of third-party service from the receiver *ThirdPartyServiceParse.

func (*ThirdPartyServiceParse) Parse Uses

func (t *ThirdPartyServiceParse) Parse() ParseErrorList

Parse blablabla

Directories

PathSynopsis
code
code/multisvc
compose
discovery
types

Package parser imports 22 packages (graph) and is imported by 1 packages. Updated 2019-06-28. Refresh now. Tools for package owners.