parser

package
v0.0.0-...-a3a5c94 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineDeployType

func DetermineDeployType(imageName Image) string

DetermineDeployType if image like db image, return stateful type

func GetPortProtocol

func GetPortProtocol(port int) string

GetPortProtocol

func ReadRbdConfigAndLang

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

ReadRbdConfigAndLang read katofile and lang

func SolveAdvice

func SolveAdvice(actionType, message string) string

SolveAdvice

Types

type DockerComposeParse

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

DockerComposeParse docker compose - file analysis

func (*DockerComposeParse) GetImage

func (d *DockerComposeParse) GetImage() Image

GetImage

func (*DockerComposeParse) GetServiceInfo

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

GetServiceInfo

func (*DockerComposeParse) Parse

Parse

type DockerRunOrImageParse

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

DockerRunOrImageParse docker run - command resolution or direct image name resolution

func CreateDockerRunOrImageParse

func CreateDockerRunOrImageParse(user, pass, source string, dockerclient *client.Client, 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

func (*DockerRunOrImageParse) GetValid

func (d *DockerRunOrImageParse) GetValid() bool

GetValid

func (*DockerRunOrImageParse) GetVolumes

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

GetVolumes

func (*DockerRunOrImageParse) Parse

Parse - decode, get the image, resolve the image eg. docker run -it -p 80:80 nginx

func (*DockerRunOrImageParse) ParseDockerun

func (d *DockerRunOrImageParse) ParseDockerun(cmd string)

ParseDockerun

type GetServiceInfo

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

GetServiceInfo

type Image

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

Image

func ParseImageName

func ParseImageName(s string) (i Image)

ParseImageName

func (Image) GetDomain

func (i Image) GetDomain() string

GetDomain get image registry domain

func (Image) GetRepostory

func (i Image) GetRepostory() string

GetRepostory

func (Image) GetSimpleName

func (i Image) GetSimpleName() string

GetSimpleName get image name without tag and organizations

func (Image) GetTag

func (i Image) GetTag() string

GetTag

func (Image) IsOfficial

func (i Image) IsOfficial() bool

IsOfficial

func (Image) Source

func (i Image) Source() string

Source return the name before resolution

func (Image) String

func (i Image) String() 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, user, pass string, logger event.Logger) Parser

CreateDockerComposeParse

func CreateSourceCodeParse

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

CreateSourceCodeParse create parser

func CreateThirdPartyServiceParse

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

CreateThirdPartyServiceParse creates a new ThirdPartyServiceParse.

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 Command resolution or direct image name resolution

func (*SourceCodeParse) GetArgs

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

GetArgs Startup parameters

func (*SourceCodeParse) GetBranchs

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

GetBranchs Get a list of branches

func (*SourceCodeParse) GetEnvs

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

GetEnvs Environment variable

func (*SourceCodeParse) GetImage

func (d *SourceCodeParse) GetImage() Image

GetImage Get mirror

func (*SourceCodeParse) GetLang

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

GetLang Get recognition language

func (*SourceCodeParse) GetMemory

func (d *SourceCodeParse) GetMemory() int

GetMemory Get memory

func (*SourceCodeParse) GetPorts

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

GetPorts Get port list

func (*SourceCodeParse) GetServiceInfo

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

GetServiceInfo Get service info

func (*SourceCodeParse) GetValid

func (d *SourceCodeParse) GetValid() bool

GetValid Is the source legal?

func (*SourceCodeParse) GetVolumes

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

GetVolumes Get storage list

func (*SourceCodeParse) Parse

func (d *SourceCodeParse) Parse() ParseErrorList

Parse Get the code - Analyze the code - Verify the code

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

Parse blablabla

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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