From 0e11b4b4f32663c80167aeac277e61ffaf2e8101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=93=E9=80=B8?= Date: Wed, 23 Apr 2025 15:28:02 +0800 Subject: [PATCH 1/3] add lang and datasets --- client_etl.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client_etl.go b/client_etl.go index dc01a8cc..4d87c2c7 100644 --- a/client_etl.go +++ b/client_etl.go @@ -28,7 +28,8 @@ type ETLConfiguration struct { RoleArn string `json:"roleArn,omitempty"` Script string `json:"script"` ToTime int32 `json:"toTime,omitempty"` - Version int8 `json:"version"` + Lang int8 `json:"version"` + Version int8 `json:"lang"` ETLSinks []ETLSink `json:"sinks"` } @@ -45,6 +46,7 @@ type ETLSink struct { Project string `json:"project"` RoleArn string `json:"roleArn,omitempty"` Type string `json:"type,omitempty"` + DataSets string `json:"datasets"` } type ListETLResponse struct { From aa13ab13798d7d4d99f114deaebf2b3afdafe078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=93=E9=80=B8?= Date: Wed, 23 Apr 2025 16:07:43 +0800 Subject: [PATCH 2/3] fix parameter --- client_etl.go | 22 +++++++++++----------- example/etl/etl_example.go | 6 +++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client_etl.go b/client_etl.go index 4d87c2c7..15d12079 100644 --- a/client_etl.go +++ b/client_etl.go @@ -28,8 +28,8 @@ type ETLConfiguration struct { RoleArn string `json:"roleArn,omitempty"` Script string `json:"script"` ToTime int32 `json:"toTime,omitempty"` - Lang int8 `json:"version"` - Version int8 `json:"lang"` + Version int8 `json:"version"` + Lang string `json:"lang"` ETLSinks []ETLSink `json:"sinks"` } @@ -38,15 +38,15 @@ type ETLSchedule struct { } type ETLSink struct { - AccessKeyId string `json:"accessKeyId"` - AccessKeySecret string `json:"accessKeySecret"` - Endpoint string `json:"endpoint"` - Logstore string `json:"logstore"` - Name string `json:"name"` - Project string `json:"project"` - RoleArn string `json:"roleArn,omitempty"` - Type string `json:"type,omitempty"` - DataSets string `json:"datasets"` + AccessKeyId string `json:"accessKeyId"` + AccessKeySecret string `json:"accessKeySecret"` + Endpoint string `json:"endpoint"` + Logstore string `json:"logstore"` + Name string `json:"name"` + Project string `json:"project"` + RoleArn string `json:"roleArn,omitempty"` + Type string `json:"type,omitempty"` + DataSets []string `json:"datasets"` } type ListETLResponse struct { diff --git a/example/etl/etl_example.go b/example/etl/etl_example.go index 11337ede..858714ae 100644 --- a/example/etl/etl_example.go +++ b/example/etl/etl_example.go @@ -76,7 +76,10 @@ func getETLJob(etlJobName string, etlScript string) sls.ETL { AccessKeySecret: accessKeySecret, Endpoint: endpoint, Project: projectName, - Logstore: "target_logstore_name", + DataSets: []string{ + "__UNNAMED__", + }, + Logstore: "target_logstore_name", } config := sls.ETLConfiguration{ @@ -86,6 +89,7 @@ func getETLJob(etlJobName string, etlScript string) sls.ETL { Logstore: logStoreName, FromTime: time.Now().Unix(), Script: etlScript, + Lang: "SPL", Parameters: map[string]string{}, ETLSinks: []sls.ETLSink{sink}, } From fb4214c1af760c6aef92734df788a52b9b7220ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=93=E9=80=B8?= Date: Wed, 23 Apr 2025 16:30:51 +0800 Subject: [PATCH 3/3] fix parameter --- client_etl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client_etl.go b/client_etl.go index 15d12079..ae3d047e 100644 --- a/client_etl.go +++ b/client_etl.go @@ -46,7 +46,7 @@ type ETLSink struct { Project string `json:"project"` RoleArn string `json:"roleArn,omitempty"` Type string `json:"type,omitempty"` - DataSets []string `json:"datasets"` + DataSets []string `json:"datasets,omitempty"` } type ListETLResponse struct {