Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 自定义扫描任务TOKEN没有展示到页面 #2703

Closed
wants to merge 96 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
100e845
feat: delimiter can identifying delimiter definitions syntax and deli…
winfredLIN Jul 4, 2024
63d9001
feat: block can match begin and end of some sql block
winfredLIN Jul 4, 2024
a02896e
feat: splitter can split sql text into sqls
winfredLIN Jul 4, 2024
ffad400
test: unit test for splitter
winfredLIN Jul 4, 2024
4988a79
modify: use splitter instead of origin parser to parse sql text
winfredLIN Jul 4, 2024
b977faa
ci: no lint this error check
winfredLIN Jul 4, 2024
f2aca99
ci: no error check of this method use
winfredLIN Jul 4, 2024
65907ff
chore: update dependency of parser
winfredLIN Sep 27, 2024
d93809e
rename: matcheDelimiterCommand to matchedDelimiterCommand
winfredLIN Sep 27, 2024
737ded1
modify: handle error while using reset method
winfredLIN Sep 27, 2024
0e0ea93
modify: handle error return by Parse()
winfredLIN Sep 29, 2024
3543efc
modify: the logic of judging delimiter
winfredLIN Sep 29, 2024
2a7f4c1
modify: optimize get and set delimiter value
winfredLIN Sep 29, 2024
5ad36b1
test: modify some test case that can not execute in fact
winfredLIN Oct 8, 2024
1ab78e0
test: exchange expected and actual results
winfredLIN Oct 8, 2024
ebb4809
modify: end pos is after the end of delimiter
winfredLIN Oct 8, 2024
19a9ed6
modify: jumping out of the beginning End statement block
winfredLIN Oct 8, 2024
5c85cef
modify: use parse one statement instead
winfredLIN Oct 8, 2024
eb80ec2
rename: matche -> match
winfredLIN Oct 8, 2024
6e5d77d
modify: correct words and resolve error
winfredLIN Oct 10, 2024
18133dc
modify: process sql totally in splitSqlText
winfredLIN Oct 10, 2024
5ef7b15
modify: splitSqlText will not return delimiter command so modify unit…
winfredLIN Oct 10, 2024
230c55e
fix: panic when instance is deleted
littleniannian Oct 16, 2024
7f13454
fix: get username err
littleniannian Oct 18, 2024
d083275
fix: init_config restart
littleniannian Oct 21, 2024
f681d62
api definition: get global workflow statistics
winfredLIN Oct 22, 2024
0670b5d
api definition: get global sql manage statistics and rename reply
winfredLIN Oct 22, 2024
7e291c6
api definition: get red dots of system modules
winfredLIN Oct 22, 2024
c079ab1
docs: make swagger
winfredLIN Oct 22, 2024
633f6e6
fix: customize audit plan cmd
littleniannian Oct 22, 2024
fa93b2a
rollback
littleniannian Oct 22, 2024
1c87a07
rollback
littleniannian Oct 22, 2024
1a36e23
Merge pull request #2702 from actiontech/issue-2675-1
iwanghc Oct 22, 2024
ed6ea7d
feat: implement of getting global workflow statistic
winfredLIN Oct 22, 2024
d55f996
router: export global sql manage statistic and global workflow statis…
winfredLIN Oct 22, 2024
00bdcac
optimize: if get nothing, no need load project and instance from dms
winfredLIN Oct 22, 2024
0ce3300
optimize: prevent accessing nil maps from causing panic
winfredLIN Oct 22, 2024
3970aea
docs: remove unused filter params
winfredLIN Oct 22, 2024
84b3352
Merge pull request #2705 from actiontech/issue-2675-2
taolx0 Oct 23, 2024
248191a
rename: GetGlobalWorkflowTotalNumByReq to GetGlobalWorkflowTotalNum
winfredLIN Oct 23, 2024
5109541
feat: implement of system module red dots
winfredLIN Oct 23, 2024
b08a56c
route: export system module red dots
winfredLIN Oct 23, 2024
a3991e0
docs: update swagger
winfredLIN Oct 23, 2024
f517b40
ci: declare variable
winfredLIN Oct 23, 2024
876da2f
optimize: filter logic
winfredLIN Oct 23, 2024
a6727f6
modify: remove permission
winfredLIN Oct 23, 2024
63bc042
modify: cancel OpPermissionTypeViewOthersWorkflow as project permission
winfredLIN Oct 23, 2024
a264d2e
rename: red dot to red dot notification
winfredLIN Oct 24, 2024
1d1f92b
modify: extract GetSingleSQLPriorityWithReasons for reusing
winfredLIN Oct 24, 2024
fb31a5e
modify: toComparedValue use only in GetSingleSQLPriorityWithReasons
winfredLIN Oct 24, 2024
adfbba1
modify: rename variable and function
winfredLIN Oct 24, 2024
c8d4d37
optimize: code structure
winfredLIN Oct 24, 2024
9d45d75
ci: delete unused code
winfredLIN Oct 24, 2024
5107abd
Merge pull request #2706 from actiontech/issue-2675-3
iwanghc Oct 24, 2024
c65918e
add: comments
winfredLIN Oct 24, 2024
e29e502
Merge pull request #2709 from actiontech/issue-2675-4
ColdWaterLW Oct 24, 2024
4b2fbc7
del CheckWorkflowCanCommit when create workflow
BugsGuru Oct 25, 2024
5710d6c
fix: comments
littleniannian Oct 25, 2024
a5eda0b
Merge pull request #2711 from actiontech/feat-quick-create-workflow-i…
taolx0 Oct 25, 2024
c50a8a3
fix: comments
littleniannian Oct 25, 2024
ecf046f
api definition: move 4 api to dashboard router group
winfredLIN Oct 25, 2024
0f29e69
docs: make swagger
winfredLIN Oct 25, 2024
d71eac5
Merge pull request #2715 from actiontech/issue-2675-6
ColdWaterLW Oct 25, 2024
08c4cd9
Merge pull request #2696 from actiontech/fix/get_username_err
ColdWaterLW Oct 25, 2024
9742078
Merge pull request #2688 from actiontech/fix_instance_not_existed
ColdWaterLW Oct 25, 2024
7fa0cff
chore:add app extract link tips
taolx0 Oct 24, 2024
40a9f70
chore:add token response
taolx0 Oct 25, 2024
c61eeea
Merge pull request #2716 from actiontech/ee-1907
ColdWaterLW Oct 25, 2024
939f0dc
comments for i18n fields
BugsGuru Oct 25, 2024
3617b1b
Merge pull request #2717 from actiontech/comment-for-i18n
ColdWaterLW Oct 28, 2024
1e59b63
feat: database compare api definition
iwanghc Oct 28, 2024
81b55a8
chore:plugin and driver interface define for database compare
iwanghc Oct 28, 2024
65f7bc5
chore: driver grpc interface define for  database compare
iwanghc Oct 28, 2024
9abe70a
chore: driver test and mysql driver function for ce
iwanghc Oct 28, 2024
e0f3171
feat:TDSQL support link cmd
taolx0 Oct 28, 2024
f2d33a5
Merge pull request #2720 from actiontech/issue-2718
winfredLIN Oct 28, 2024
e6bc8a0
use util.Fingerprint to fix panic ce
BugsGuru Oct 29, 2024
c2838d1
modify: add database compare grpc interface to optional model
iwanghc Oct 29, 2024
cf248d7
modify: database comparsion api define modify
iwanghc Oct 29, 2024
443120b
gen swagger: database compare api gen swagger
iwanghc Oct 29, 2024
3802127
Merge pull request #2722 from actiontech/fix-fingerprint-panic-ce
winfredLIN Oct 29, 2024
e14f526
modify: cancel use of formatted sql and format sql in origin sql
winfredLIN Oct 29, 2024
b18c039
fix:word spelling mistake
iwanghc Oct 30, 2024
74668bb
Merge pull request #2636 from actiontech/issue-2406
sjjian Oct 30, 2024
10f49be
modify: database comprison api define modify
iwanghc Oct 31, 2024
24862d8
gen swagger: database comparsion api define modify
iwanghc Oct 31, 2024
c49644a
chore:remove unless Endpoints
taolx0 Oct 31, 2024
59f7960
chore:metric support string array type
taolx0 Oct 31, 2024
5855230
chore:add new string array merged and sort
taolx0 Oct 31, 2024
1113cb5
Merge pull request #2724 from actiontech/database_compare_ce
LordofAvernus Oct 31, 2024
31891ff
Merge pull request #2725 from actiontech/ee-2616-0
iwanghc Oct 31, 2024
e9d4683
fix: init_config restart
littleniannian Oct 21, 2024
26feb0f
fix: customize audit plan cmd
littleniannian Oct 22, 2024
d541ec3
rollback
littleniannian Oct 22, 2024
31e99ff
rollback
littleniannian Oct 22, 2024
ffd6dde
Merge remote-tracking branch 'origin/fix/customize_audit_plan_cmd' in…
littleniannian Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ replace (
cloud.google.com/go/compute/metadata => cloud.google.com/go/compute/metadata v0.1.0
github.com/labstack/echo/v4 => github.com/labstack/echo/v4 v4.6.1
github.com/pingcap/log => github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9
github.com/pingcap/parser => github.com/sjjian/parser v0.0.0-20240305095250-688ad439ef31
github.com/pingcap/parser => github.com/sjjian/parser v0.0.0-20240704052347-b6199b7bccae
github.com/swaggo/swag => github.com/swaggo/swag v1.6.7
google.golang.org/grpc => google.golang.org/grpc v1.29.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sjjian/parser v0.0.0-20240305095250-688ad439ef31 h1:E3JSX1FjUlg8ep8XQlLkdTFbZhM4tmecpdfZhUuubLs=
github.com/sjjian/parser v0.0.0-20240305095250-688ad439ef31/go.mod h1:Qq2tnreUXwVo7NAKAHmbWFsgqpDUkxwhJCClY+ZCudA=
github.com/sjjian/parser v0.0.0-20240704052347-b6199b7bccae h1:rTwogc7Uq0/7zMHNhpQTqjtGKdccVh8Z8vHReIlsXG0=
github.com/sjjian/parser v0.0.0-20240704052347-b6199b7bccae/go.mod h1:Qq2tnreUXwVo7NAKAHmbWFsgqpDUkxwhJCClY+ZCudA=
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down
17 changes: 12 additions & 5 deletions sqle/api/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti
v1ProjectOpRouter.POST("/:project_name/pipelines", v1.CreatePipeline)
v1ProjectOpRouter.DELETE("/:project_name/pipelines/:pipeline_id/", v1.DeletePipeline)
v1ProjectOpRouter.PATCH("/:project_name/pipelines/:pipeline_id/", v1.UpdatePipeline)

// database_compare
v1ProjectOpRouter.POST("/:project_name/database_comparison/execute_comparison", v1.ExecuteDatabaseComparison)
v1ProjectOpRouter.POST("/:project_name/database_comparison/comparison_statements", v1.GetComparisonStatement)
v1ProjectOpRouter.POST("/:project_name/database_comparison/modify_sql_statements", v1.GenDatabaseDiffModifySQLs)
}

// project member router
Expand Down Expand Up @@ -428,12 +433,8 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti

v1Router.POST("/rule_templates/parse", v1.ParseProjectRuleTemplateFile)
v1Router.GET("/import_rule_template", v1.GetImportRuleTemplateFile)

// 全局 sql manage
v1Router.GET("/sql_manages", v1.GetGlobalSqlManageList)


// 全局 workflow
v1Router.GET("/workflows", v1.GetGlobalWorkflowsV1)
v1Router.GET("/rule_knowledge/db_types/:db_type/rules/:rule_name/", v1.GetRuleKnowledge)
v1Router.GET("/rule_knowledge/db_types/:db_type/custom_rules/:rule_name/", v1.GetCustomRuleKnowledge)
v1Router.GET("/workflows/statistic_of_instances", v1.GetWorkflowStatisticOfInstances)
Expand Down Expand Up @@ -463,6 +464,11 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti

// dashboard
v1Router.GET("/dashboard", v1.Dashboard)
// 全局 sql manage
v1Router.GET("/dashboard/sql_manages", v1.GetGlobalSqlManageList)
v1Router.GET("/dashboard/sql_manages/statistics", v1.GetGlobalSqlManageStatistics)
v1Router.GET("/dashboard/workflows", v1.GetGlobalWorkflowsV1)
v1Router.GET("/dashboard/workflows/statistics", v1.GetGlobalWorkflowStatistics)

// configurations
v1Router.GET("/configurations/drivers", v1.GetDrivers)
Expand All @@ -483,6 +489,7 @@ func StartApi(net *gracenet.Net, exitChan chan struct{}, config *config.SqleOpti
v1Router.GET("/company_notice", v1.GetCompanyNotice)
// 系统功能开关
v1Router.GET("/system/module_status", v1.GetSystemModuleStatus)
v1Router.GET("/system/module_red_dots", v1.GetSystemModuleRedDots)
}

// enterprise customized apis
Expand Down
140 changes: 140 additions & 0 deletions sqle/api/controller/v1/database_compare.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package v1

import (
"github.com/actiontech/sqle/sqle/api/controller"
"github.com/actiontech/sqle/sqle/model"
"github.com/labstack/echo/v4"
)

type GetDatabaseComparisonReqV1 struct {
BaseDBObject *DatabaseComparisonObject `json:"base_db_object" query:"base_db_object"`
ComparisonDBObject *DatabaseComparisonObject `json:"comparison_db_object" query:"comparison_db_object"`
}

type DatabaseComparisonObject struct {
InstanceId string `json:"instance_id" query:"instance_id"`
SchemaName *string `json:"schema_name,omitempty" query:"schema_name"`
}
type DatabaseComparisonResV1 struct {
controller.BaseRes
Data []*SchemaObject `json:"data"`
}

type SchemaObject struct {
BaseSchemaName string `json:"base_schema_name"`
ComparisonSchemaName string `json:"comparison_schema_name"`
ComparisonResult string `json:"comparison_result" enums:"same,inconsistent,base_not_exist,comparison_not_exist"`
DatabaseDiffObjects []*DatabaseDiffObject `json:"database_diff_objects,omitempty"`
InconsistentNum int `json:"inconsistent_num"`
}

type DatabaseDiffObject struct {
InconsistentNum int `json:"inconsistent_num"`
ObjectType string `json:"object_type" enums:"TABLE,VIEW,PROCEDURE,TIGGER,EVENT,FUNCTION"`
ObjectsDiffResults []*ObjectDiffResult `json:"objects_diff_result,omitempty"`
}

type ObjectDiffResult struct {
ComparisonResult string `json:"comparison_result" enums:"same,inconsistent,base_not_exist,comparison_not_exist"`
ObjectName string `json:"object_name"`
}

// @Summary 执行数据库结构对比并获取结果
// @Description get database comparison
// @Id executeDatabaseComparisonV1
// @Tags database_comparison
// @Security ApiKeyAuth
// @Accept json
// @Param project_name path string true "project name"
// @Param database_comparison body v1.GetDatabaseComparisonReqV1 true "get database comparison request"
// @Success 200 {object} v1.DatabaseComparisonResV1
// @router /v1/projects/{project_name}/database_comparison/execute_comparison [post]
func ExecuteDatabaseComparison(c echo.Context) error {

return getDatabaseComparison(c)
}

type DatabaseObject struct {
ObjectName string `json:"object_name"`
ObjectType string `json:"object_type" enums:"TABLE,VIEW,PROCEDURE,TIGGER,EVENT,FUNCTION"`
}

type GetComparisonStatementsReqV1 struct {
DatabaseComparisonObject GetDatabaseComparisonReqV1 `json:"database_comparison_object"`
DatabaseObject *DatabaseObject `json:"database_object"`
}

type DatabaseComparisonStatementsResV1 struct {
controller.BaseRes
Data *DatabaseComparisonStatements `json:"data"`
}

type DatabaseComparisonStatements struct {
BaseSQL *SQLStatementWithAuditResult `json:"base_sql"`
ComparisondSQL *SQLStatementWithAuditResult `json:"comparison_sql"`
}

type SQLStatementWithAuditResult struct {
SQLStatement string `json:"sql_statement"`
AuditResults []*SQLAuditResult `json:"audit_results"`
}

type SQLAuditResult struct {
Level string `json:"level" example:"warn"`
Message string `json:"message" example:"避免使用不必要的内置函数md5()"`
RuleName string `json:"rule_name"`
DbType string `json:"db_type"`
I18nAuditResultInfo model.I18nAuditResultInfo `json:"i18n_audit_result_info"`
}

// @Summary 获取对比语句
// @Description get database comparison detail
// @Id getComparisonStatementV1
// @Tags database_comparison
// @Security ApiKeyAuth
// @Accept json
// @Param project_name path string true "project name"
// @Param database_comparison_object body v1.GetComparisonStatementsReqV1 true "get database comparison statement request"
// @Success 200 {object} v1.DatabaseComparisonStatementsResV1
// @router /v1/projects/{project_name}/database_comparison/comparison_statements [post]
func GetComparisonStatement(c echo.Context) error {

return getComparisonStatement(c)
}

type GenModifylSQLReqV1 struct {
BaseInstanceId string `json:"base_instance_id"`
ComparisonInstanceId string `json:"comparison_instance_id"`
DatabaseSchemaObjects []*DatabaseSchemaObject `json:"database_schema_objects"`
}

type DatabaseSchemaObject struct {
BaseSchemaName string `json:"base_schema_name"`
ComparisonSchemaName string `json:"comparison_schema_name"`
DatabaseObjects []*DatabaseObject `json:"database_objects"`
}

type GenModifySQLResV1 struct {
controller.BaseRes
Data []*DatabaseDiffModifySQL `json:"data"`
}

type DatabaseDiffModifySQL struct {
SchemaName string `json:"schema_name"`
ModifySQLs []*SQLStatementWithAuditResult `json:"modify_sqls"`
}

// @Summary 生成变更SQL
// @Description generate database diff modify sqls
// @Id genDatabaseDiffModifySQLsV1
// @Tags database_comparison
// @Security ApiKeyAuth
// @Accept json
// @Param project_name path string true "project name"
// @Param gen_modify_sql body v1.GenModifylSQLReqV1 true "generate database diff modify sqls request"
// @Success 200 {object} v1.GenModifySQLResV1
// @router /v1/projects/{project_name}/database_comparison/modify_sql_statements [post]
func GenDatabaseDiffModifySQLs(c echo.Context) error {

return genDatabaseDiffModifySQLs(c)
}
25 changes: 25 additions & 0 deletions sqle/api/controller/v1/database_compare_ce.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build !enterprise
// +build !enterprise

package v1

import (
e "errors"

"github.com/actiontech/sqle/sqle/errors"
"github.com/labstack/echo/v4"
)

var ErrCommunityEditionNotSupportDatabaseStructComparison = errors.New(errors.EnterpriseEditionFeatures, e.New("database struct comparison is enterprise version feature"))

func getDatabaseComparison(c echo.Context) error {
return ErrCommunityEditionNotSupportDatabaseStructComparison
}

func getComparisonStatement(c echo.Context) error {
return ErrCommunityEditionNotSupportDatabaseStructComparison
}

func genDatabaseDiffModifySQLs(c echo.Context) error {
return ErrCommunityEditionNotSupportDatabaseStructComparison
}
51 changes: 34 additions & 17 deletions sqle/api/controller/v1/instance_audit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ type AuditPlanTypeResBase struct {
AuditPlanId uint `json:"audit_plan_id"`
AuditPlanType string `json:"type"`
AuditPlanTypeDesc string `json:"desc"`
Token string `json:"token"`
}

type GetInstanceAuditPlansReqV1 struct {
Expand Down Expand Up @@ -519,7 +520,7 @@ func GetInstanceAuditPlans(c echo.Context) error {
typeBases := make([]AuditPlanTypeResBase, 0, len(auditPlanIds))
for _, auditPlanId := range auditPlanIds {
if auditPlanId != "" {
typeBase, err := ConvertAuditPlanTypeToResByID(c.Request().Context(), auditPlanId)
typeBase, err := ConvertAuditPlanTypeToResByID(c.Request().Context(), auditPlanId, v.Token)
if err != nil {
return controller.JSONBaseErrorReq(c, err)
}
Expand Down Expand Up @@ -547,7 +548,7 @@ func GetInstanceAuditPlans(c echo.Context) error {
})
}

func ConvertAuditPlanTypeToResByID(ctx context.Context, id string) (AuditPlanTypeResBase, error) {
func ConvertAuditPlanTypeToResByID(ctx context.Context, id string, token string) (AuditPlanTypeResBase, error) {
auditPlanID, err := strconv.Atoi(id)
if err != nil {
return AuditPlanTypeResBase{}, err
Expand All @@ -566,6 +567,7 @@ func ConvertAuditPlanTypeToResByID(ctx context.Context, id string) (AuditPlanTyp
AuditPlanType: auditPlan.Type,
AuditPlanTypeDesc: locale.Bundle.LocalizeMsgByCtx(ctx, meta.Desc),
AuditPlanId: auditPlan.ID,
Token: token,
}, nil
}
}
Expand Down Expand Up @@ -822,6 +824,11 @@ func GetAuditPlanExecCmd(projectName string, iap *model.InstanceAuditPlan, ap *m
return ""
}

if ap.Type == "default" {
cmdTpl := "--project=%s --audit_plan_id=%d --token=%s"
return fmt.Sprintf(cmdTpl, iap.ProjectId, ap.ID, iap.Token)
}

address := config.GetOptions().SqleOptions.DMSServerAddress
parsedURL, err := url.Parse(address)
if err != nil {
Expand All @@ -834,22 +841,32 @@ func GetAuditPlanExecCmd(projectName string, iap *model.InstanceAuditPlan, ap *m
return ""
}

scannerd, err := scannerCmd.GetScannerdCmd(ap.Type)
if err != nil {
logger.Infof("get scannerd %s failed %s", ap.Type, err)
return ""
}
cmd, err := scannerd.GenCommand("./scannerd", map[string]string{
scannerCmd.FlagHost: ip,
scannerCmd.FlagPort: port,
scannerCmd.FlagProject: projectName,
scannerCmd.FlagToken: iap.Token,
scannerCmd.FlagAuditPlanID: fmt.Sprint(ap.ID),
})
if err != nil {
logger.Infof("generate scannerd %s command failed %s", ap.Type, err)
return ""
var cmd string
switch ap.Type {
case auditplan.TypeAllAppExtract:
cmd = fmt.Sprintf(`SQLE_PROJECT_NAME=%s \
PROJECT_APP_NAME=<Please provide the business parameters here> \
java -<Please provide the java agent name parameters here> \
-jar <Please provide the java app name parameters here>`, projectName)
default:
scannerd, err := scannerCmd.GetScannerdCmd(ap.Type)
if err != nil {
logger.Infof("get scannerd %s failed %s", ap.Type, err)
return ""
}
cmd, err = scannerd.GenCommand("./scannerd", map[string]string{
scannerCmd.FlagHost: ip,
scannerCmd.FlagPort: port,
scannerCmd.FlagProject: projectName,
scannerCmd.FlagToken: iap.Token,
scannerCmd.FlagAuditPlanID: fmt.Sprint(ap.ID),
})
if err != nil {
logger.Infof("generate scannerd %s command failed %s", ap.Type, err)
return ""
}
}

return cmd
}

Expand Down
Loading
Loading