當前位置: 首頁>>代碼示例>>Golang>>正文


Golang provisioning.Provisioning函數代碼示例

本文整理匯總了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
}
開發者ID:CodAdam,項目名稱:coco,代碼行數:10,代碼來源:server.go

示例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
}
開發者ID:CodAdam,項目名稱:coco,代碼行數:10,代碼來源:server.go

示例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
}
開發者ID:honghong75042,項目名稱:fastforward,代碼行數:11,代碼來源:server.go

示例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
}
開發者ID:CodAdam,項目名稱:coco,代碼行數:8,代碼來源:server.go

示例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
}
開發者ID:CodAdam,項目名稱:coco,代碼行數:9,代碼來源:server.go

示例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
}
開發者ID:honghong75042,項目名稱:fastforward,代碼行數:7,代碼來源:server.go


注:本文中的github.com/nofdev/fastforward/provisioning.Provisioning函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。