saastool增加docker/daemon模式
This commit is contained in:
@@ -17,6 +17,8 @@ const (
|
||||
bindSetPath = "/saas/bind/set"
|
||||
bindDeletePath = "/saas/bind/delete"
|
||||
scriptRunPath = "/saas/script/run"
|
||||
expListPath = "/saas/exp/list"
|
||||
expGetPath = "/saas/exp/get"
|
||||
)
|
||||
|
||||
type ApiUrls struct {
|
||||
@@ -36,6 +38,8 @@ type ApiUrls struct {
|
||||
BindSetPath string
|
||||
BindDeletePath string
|
||||
ScriptRunPath string
|
||||
ExpListPath string
|
||||
ExpGetPath string
|
||||
}
|
||||
|
||||
func InitAPIUrl(c *ApiUrls) *ApiUrls {
|
||||
@@ -136,6 +140,18 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls {
|
||||
r.ScriptRunPath = scriptRunPath
|
||||
}
|
||||
|
||||
if c.ExpListPath != "" {
|
||||
r.ExpListPath = c.ExpListPath
|
||||
} else {
|
||||
r.ExpListPath = expListPath
|
||||
}
|
||||
|
||||
if c.ExpGetPath != "" {
|
||||
r.ExpGetPath = c.ExpGetPath
|
||||
} else {
|
||||
r.ExpGetPath = expGetPath
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,16 @@ func (c *SaasClient) ScriptRun(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasR
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) ExpList(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
|
||||
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ExpListPath)
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) ExpGet(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
|
||||
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ExpGetPath)
|
||||
return c.post(postUrl, saasReq)
|
||||
}
|
||||
|
||||
func (c *SaasClient) makeUrl(baseUrl, path string, params ...string) string {
|
||||
url, err := url.Parse(baseUrl)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user