本文整理匯總了Golang中github.com/nofdev/fastforward/provisioning.Provisioning函數的典型用法代碼示例。如果您正苦於以下問題:Golang Provisioning函數的具體用法?Golang Provisioning怎麽用?Golang Provisioning使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Provisioning函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PutFile
// PutFile copies one or more local files to the remote host, using scp. localfiles can contain wildcards, and remotefile can be either a directory or a file.
// Args: {'User': 'USERNAME', 'Host': 'REMOTESERVER', 'LocalFile': 'FILENAME', 'RemoteFile': 'FILENAME'}
// Optional Args: {'Password': 'PASS', 'KeyFiles': 'IDRSA', 'DisplayOutput': true, 'AbortOnError': true}
func (p *Provisioning) PutFile(r *http.Request, args *Args, result *Result) error {
checkFile(r, args, result)
i := provisioning.Provisioning(args)
*result = i.PutFile(args.LocalFile, args.RemoteFile)
log.Printf("Request: %s, Method: PutFile, Args: %s, Result: %s", *r, *args, *result)
return nil
}
示例2: Exec
// Exec takes a command to be executed from API on the remote server.
// Args: {'User': 'USERNAME', 'Host': 'REMOTESERVER', 'CmdLine': 'CMD'}
// Optional Args: {'AptCache': true, 'UseSudo': true, 'Password': 'PASS', 'KeyFiles': 'IDRSA', 'DisplayOutput': true, 'AbortOnError': true}
func (p *Provisioning) Exec(r *http.Request, args *Args, result *Result) error {
cmd := provisioning.Cmd{AptCache: args.AptCache, UseSudo: args.UseSudo, CmdLine: args.CmdLine}
i := provisioning.Provisioning(args)
*result, _ = i.Execute(cmd)
log.Printf("Request: %s, Method: Exec, Args: %s, Result: %s", *r, *args, *result)
return nil
}
示例3: GetFile
// GetFile copies the file from the remote host to the local FastForward server, using scp. Wildcards are not currently supported.
func (p *Provisioning) GetFile(r *http.Request, args *Args, result *Result) error {
if args.RemoteFile == "" || args.LocalFile == "" {
*result = "RemoteFile or LocalFile are needed."
log.Printf("Request: %s, Error: %s", *r, *result)
}
i := provisioning.Provisioning(args)
*result = i.GetFile(args.RemoteFile, args.LocalFile)
log.Printf("Request: %s, Method: GetFile, Args: %s, Result: %s", *r, *args, *result)
return nil
}
示例4: Self
// Self executes a command on the FastForward API server.
// Args: {'CmdLine': 'CMD'}
func (p *Provisioning) Self(r *http.Request, args *Args, result *Result) error {
i := provisioning.Provisioning(args)
*result, _ = i.Self(args.Cmd)
log.Printf("Request: %s, Method: Self, Args: %s, Result: %s", *r, *args, *result)
return nil
}
示例5: PutString
// PutString generates a new file on the remote host containing data. The file is created with mode 0644.
// Args: {'User': 'USERNAME', 'Host': 'REMOTESERVER', 'Data': 'STRING', 'RemoteFile': 'FILENAME'}
// Optional Args: {'Password': 'PASS', 'KeyFiles': 'IDRSA', 'DisplayOutput': true, 'AbortOnError': true}
func (p *Provisioning) PutString(r *http.Request, args *Args, result *Result) error {
i := provisioning.Provisioning(args)
*result = i.PutString(args.Data, args.RemoteFile)
log.Printf("Request: %s, Method: PutString, Args: %s, Result: %s", *r, *args, *result)
return nil
}
示例6: PutFile
// PutFile copies one or more local files to the remote host, using scp. localfiles can contain wildcards, and remotefile can be either a directory or a file.
func (p *Provisioning) PutFile(r *http.Request, args *Args, result *Result) error {
checkFile(r, args, result)
i := provisioning.Provisioning(args)
*result = i.PutFile(args.LocalFile, args.RemoteFile)
return nil
}