Documentation ¶
Overview ¶
* * @Author: xhzhang * @Date: 2019-04-25 11:13
Index ¶
- Constants
- func Get(fs *common.StoreServer, path string) (string, error)
- func Kv(ceStruct CoulsonError) string
- func NewCmdError(thisCMD, thisErr string) *cmdError
- func NewFileOwnerError(thisfile, thisOwner, thisErr string) *fileOwnerError
- func NewGetCodeError(thisUrl, thisErr string) *getCodeError
- func NewJsonFromService(s Service) (string, error)
- func NewPathError(thisPath, thisErr string) *pathError
- func Upload(fs *common.StoreServer, src, path string) error
- type Client
- type CoulsonError
- type Driver
- func (d *Driver) BackupService(tmpdst, uploadpath string) error
- func (d *Driver) GetBinPath(cmd string) (string, error)
- func (d *Driver) GetCode() (string, error)
- func (d *Driver) GetMetaScript() (string, error)
- func (d *Driver) ReadServiceVerion() (string, error)
- func (d *Driver) RunCMD(cmdString string) error
- type FileHandler
- type FtpFileHandler
- type HttpFileHandler
- type Identiy
- type Result
- type ResultStep
- type S3FileHandler
- type Service
- type Task
- type User
Constants ¶
View Source
const ( StepCheckEnv string = "checkenv" StepCreateUser = "CreateUser" StepCreateTmpDir = "CreateTmpDir" StepGetCode = "getcode" StepDeploy = "deploy" StepBackup = "backup" StepUpgrade = "upgrade" StepRoll = "rollback" StepCheck = "check" StepGetPid = "getpid" StepStart = "start" StepStop = "stop" StepRegister = "register" )
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(fs *common.StoreServer, path string) (string, error)
path is a path with filename
func Kv ¶
func Kv(ceStruct CoulsonError) string
func NewCmdError ¶
func NewCmdError(thisCMD, thisErr string) *cmdError
func NewFileOwnerError ¶
func NewFileOwnerError(thisfile, thisOwner, thisErr string) *fileOwnerError
func NewGetCodeError ¶
func NewGetCodeError(thisUrl, thisErr string) *getCodeError
func NewJsonFromService ¶
convert Service to json string
func NewPathError ¶
func NewPathError(thisPath, thisErr string) *pathError
Types ¶
type Client ¶
type Client struct { //source filepath Src string Addr string Type string Handler FileHandler //the username for http basic authorization or FTP. // if s3 is used, Pass is AWSAccessKeyId. User string //the base64.StdEncoding.EncodeToString([]byte(password)) for http basic authorization or FTP. // if s3 is used, Pass is base64.StdEncoding.EncodeToString([]byte(AWSSecretAccessKey)). Pass string //RelativePath is path+file for Get //RelativePath is path for Upload RelativePath string // aws s3 region S3Region string // aws s3 bucket S3Bucket string }
type CoulsonError ¶
type Driver ¶
func (*Driver) BackupService ¶
Backup service dir to temporary file and upload to file server
func (*Driver) GetBinPath ¶
Get the execution path of command
func (*Driver) GetMetaScript ¶
Get the meta script path which will be executed
func (*Driver) ReadServiceVerion ¶
Read the PathFile file and get the backup path in the FileServer
type FileHandler ¶
type FileHandler interface { // upload file to file server Upload() error //download file from file server, it returns a dir where Stores the unzipped package Get() (string, error) // SetClient allows a filehandler to know it's client // in order to access client's Get&Upload functions or // progress tracking. SetClient(*Client) }
type FtpFileHandler ¶
type FtpFileHandler struct {
// contains filtered or unexported fields
}
type HttpFileHandler ¶
type HttpFileHandler struct { // HTTPClient is the http.HTTPClient to use for Get requests. // This defaults to a cleanhttp.DefaultClient if left unset. HTTPClient *http.Client // contains filtered or unexported fields }
func (*HttpFileHandler) Get ¶
func (hu *HttpFileHandler) Get() (string, error)
func (*HttpFileHandler) Upload ¶
func (hu *HttpFileHandler) Upload() error
type Result ¶
type Result struct { Identiy ReturnCode common.ExecuteReturnCode `json:"rcode"` ReturnMsg string `json:"rmsg"` StepInfo []ResultStep `json:"rsteps"` }
func (*Result) AppendFailedStep ¶
Build StepInfo
func (*Result) AppendSuccessStep ¶
func (*Result) ToJsonString ¶
type ResultStep ¶
type S3FileHandler ¶
type S3FileHandler struct {
// contains filtered or unexported fields
}
func (*S3FileHandler) Get ¶
func (sss *S3FileHandler) Get() (string, error)
func (*S3FileHandler) Upload ¶
func (sss *S3FileHandler) Upload() error
type Service ¶
type Service struct { ServiceID string `json:"serviceid"` OsUser string `json:"serviceosuser"` Dir string `json:"servicedir"` ModuleName string `json:"servicemodulename"` CodePattern []string `json:"servicecodepattern"` PidFile string `json:"servicepidfile"` StartCMD string `json:"servicestartcmd"` StopCMD string `json:"servicestopcmd"` }
Service
func NewServiceFromJson ¶
Build a Service with ServiceID from json string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.