本文整理匯總了Golang中github.com/tsuru/tsuru/iaas.Machine.FormatNodeAddress方法的典型用法代碼示例。如果您正苦於以下問題:Golang Machine.FormatNodeAddress方法的具體用法?Golang Machine.FormatNodeAddress怎麽用?Golang Machine.FormatNodeAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tsuru/tsuru/iaas.Machine
的用法示例。
在下文中一共展示了Machine.FormatNodeAddress方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addNodeForParams
func addNodeForParams(params map[string]string, isRegister bool) (map[string]string, error) {
response := make(map[string]string)
var address string
if isRegister {
address, _ = params["address"]
delete(params, "address")
} else {
iaasName, _ := params["iaas"]
desc, err := iaas.Describe(iaasName)
if err != nil {
return response, err
}
response["description"] = desc
var m *iaas.Machine
if iaasName != "" {
m, err = iaas.CreateMachineForIaaS(iaasName, params)
} else {
m, err = iaas.CreateMachine(params)
}
if err != nil {
return response, err
}
nodeAddress, err := m.FormatNodeAddress()
if err != nil {
return response, err
}
params["iaas"] = m.Iaas
address = nodeAddress
}
err := validateNodeAddress(address)
if err != nil {
return response, err
}
err = dockerCluster().Register(address, params)
if err != nil {
return response, err
}
return response, err
}