func main()

in example/etl/etl_example.go [22:69]


func main() {
	// create the client with ak and endpoint
	client := sls.CreateNormalInterface(endpoint, accessKeyId, accessKeySecret, securityToken)

	// create the ETL Job
	if err := client.CreateETL(projectName, getETLJob(etlJobName, etlScript)); err != nil {
		fmt.Println(err)
	}

	// get the ETL job
	if etlJob, err := client.GetETL(projectName, etlJobName); err != nil {
		fmt.Println(err)
	} else {
		detail, _ := json.Marshal(etlJob)
		fmt.Println(string(detail))

		etlJob.Configuration.Script = "e_set(\"k\", \"v\")"
		// update the ETL Job
		if err := client.UpdateETL(projectName, *etlJob); err != nil {
			fmt.Println(err)
		}

		// update and restart the ETL Job
		if err := client.RestartETL(projectName, *etlJob); err != nil {
			fmt.Println(err)
		}
	}

	// list the ETL jobs under the project
	if etlJobs, err := client.ListETL(projectName, 0, 10); err != nil {
		fmt.Println(err)
	} else {
		detail, _ := json.Marshal(etlJobs.Results)
		fmt.Println(string(detail))
		fmt.Println(etlJobs.Total)
		fmt.Println(etlJobs.Count)
	}

	// stop the ETL Job
	if err := client.StopETL(projectName, etlJobName); err != nil {
		fmt.Println(err)
	}

	// start the ETL Job
	if err := client.StartETL(projectName, etlJobName); err != nil {
		fmt.Println(err)
	}
}