"github.com/volcengine/volc-sdk-golang/service/tls"
func CreateImportTosTaskDemo() (*tls.CreateImportTaskResponse, error) {
// Initialize the client. It is recommended to dynamically obtain identity authentication information such as the Volcano Engine key through environment variables to avoid data security risks caused by hard-coding the AccessKey. For detailed instructions, please refer to https://www.volcengine.com/docs/6470/1166455
// When using STS, both ak and sk use temporary keys and set VOLCENGINE_TOKEN; when not using STS, the VOLCENGINE_TOKEN part is passed empty.
client := tls.NewClient(os.Getenv("VOLCENGINE_ENDPOINT"), os.Getenv("VOLCENGINE_ACCESS_KEY_ID"), os.Getenv("VOLCENGINE_ACCESS_KEY_SECRET"), os.Getenv("VOLCENGINE_TOKEN"), os.Getenv("VOLCENGINE_REGION"))
//Create a data import task.
//For a description of the CreateImportTask API request parameters, see https://www.volcengine.com/docs/6470/1333757.
createImportTaskResp, err := client.CreateImportTask(&tls.CreateImportTaskRequest{
TaskName: "task-name-1",
Description: "this is a task",
ImportSourceInfo: &tls.ImportSourceInfo{
TosSourceInfo: &tls.TosSourceInfo{
TargetInfo: &tls.TargetInfo{
ExtractRule: &tls.ImportExtractRule{
ExtractRule: &tls.ExtractRule{
return createImportTaskResp, nil