阶段性提交

This commit is contained in:
GoEdgeLab
2020-09-13 20:37:28 +08:00
parent 84868c1a0b
commit dc79c661d7
89 changed files with 1364 additions and 12899 deletions

View File

@@ -1 +1,25 @@
package models
import (
"encoding/json"
"errors"
)
// 解析SSH登录参数
func (this *NodeLogin) DecodeSSHParams() (*NodeLoginSSHParams, error) {
if this.Type != NodeLoginTypeSSH {
return nil, errors.New("invalid login type '" + this.Type + "'")
}
if len(this.Params) == 0 || this.Params == "null" {
return nil, errors.New("'params' should not be empty")
}
params := &NodeLoginSSHParams{}
err := json.Unmarshal([]byte(this.Params), params)
if err != nil {
return nil, err
}
return params, nil
}