增加lua调试功能

This commit is contained in:
algotao
2025-09-02 15:45:56 +08:00
parent ed06c46bde
commit fff023b56d
10 changed files with 200 additions and 10 deletions

View File

@@ -8,7 +8,6 @@ const (
columnWritePath = "/saas/column_write"
taskCreatePath = "/saas/task/create"
taskListPath = "/saas/task/list"
taskCancelPath = "/saas/task/delete"
taskInfoPath = "/saas/task/info"
taskUploadPath = "/saas/task/upload"
taskDownloadPath = "/saas/task/download"
@@ -17,6 +16,7 @@ const (
targetListPath = "/saas/target/list"
bindSetPath = "/saas/bind/set"
bindDeletePath = "/saas/bind/delete"
scriptRunPath = "/saas/script/run"
)
type ApiUrls struct {
@@ -35,6 +35,7 @@ type ApiUrls struct {
TargetListPath string
BindSetPath string
BindDeletePath string
ScriptRunPath string
}
func InitAPIUrl(c *ApiUrls) *ApiUrls {
@@ -129,6 +130,12 @@ func InitAPIUrl(c *ApiUrls) *ApiUrls {
r.BindDeletePath = bindDeletePath
}
if c.ScriptRunPath != "" {
r.ScriptRunPath = c.ScriptRunPath
} else {
r.ScriptRunPath = scriptRunPath
}
return r
}

View File

@@ -103,6 +103,11 @@ func (c *SaasClient) BindDelete(saasReq *saasapi.SaasReq) (saasRes *saasapi.Saas
return c.post(postUrl, saasReq)
}
func (c *SaasClient) ScriptRun(saasReq *saasapi.SaasReq) (saasRes *saasapi.SaasRes, err error) {
postUrl := c.makeUrl(c.ApiUrls.BaseUrl, c.ApiUrls.ScriptRunPath)
return c.post(postUrl, saasReq)
}
func (c *SaasClient) makeUrl(baseUrl, path string, params ...string) string {
url, err := url.Parse(baseUrl)
if err != nil {