From 1a6ec56125cb435e84183785f75f126ef26ce80b Mon Sep 17 00:00:00 2001 From: mikatong Date: Wed, 15 Oct 2025 18:02:23 +0800 Subject: [PATCH 1/3] add datasource --- tencentcloud/provider.go | 10 + tencentcloud/provider.md | 10 + .../data_source_tc_wedata_downstream_tasks.go | 255 ++++ .../data_source_tc_wedata_downstream_tasks.md | 10 + ..._source_tc_wedata_downstream_tasks_test.go | 31 + .../data_source_tc_wedata_resource_files.go | 197 +++ .../data_source_tc_wedata_resource_files.md | 10 + ...ta_source_tc_wedata_resource_files_test.go | 33 + .../wedata/data_source_tc_wedata_task_code.go | 118 ++ .../wedata/data_source_tc_wedata_task_code.md | 10 + .../data_source_tc_wedata_task_code_test.go | 31 + .../data_source_tc_wedata_task_version.go | 1251 +++++++++++++++++ .../data_source_tc_wedata_task_version.md | 10 + ...data_source_tc_wedata_task_version_test.go | 31 + .../data_source_tc_wedata_task_versions.go | 184 +++ .../data_source_tc_wedata_task_versions.md | 10 + ...ata_source_tc_wedata_task_versions_test.go | 31 + .../wedata/data_source_tc_wedata_tasks.go | 374 +++++ .../wedata/data_source_tc_wedata_tasks.md | 9 + .../data_source_tc_wedata_tasks_test.go | 30 + .../data_source_tc_wedata_upstream_tasks.go | 255 ++++ .../data_source_tc_wedata_upstream_tasks.md | 10 + ...ta_source_tc_wedata_upstream_tasks_test.go | 31 + .../data_source_tc_wedata_workflow_folders.go | 138 ++ .../data_source_tc_wedata_workflow_folders.md | 10 + ..._source_tc_wedata_workflow_folders_test.go | 33 + .../wedata/data_source_tc_wedata_workflows.go | 271 ++++ .../wedata/data_source_tc_wedata_workflows.md | 10 + .../data_source_tc_wedata_workflows_test.go | 33 + ...esource_tc_wedata_submit_task_operation.go | 124 ++ ...esource_tc_wedata_submit_task_operation.md | 11 + ...ce_tc_wedata_submit_task_operation_test.go | 32 + .../wedata/service_tencentcloud_wedata.go | 500 +++++++ .../d/wedata_downstream_tasks.html.markdown | 37 + .../d/wedata_resource_files.html.markdown | 43 + website/docs/d/wedata_task_code.html.markdown | 37 + .../docs/d/wedata_task_version.html.markdown | 38 + .../docs/d/wedata_task_versions.html.markdown | 40 + website/docs/d/wedata_tasks.html.markdown | 51 + .../d/wedata_upstream_tasks.html.markdown | 37 + .../d/wedata_workflow_folders.html.markdown | 37 + website/docs/d/wedata_workflows.html.markdown | 44 + ...wedata_submit_task_operation.html.markdown | 40 + website/tencentcloud.erb | 30 + 44 files changed, 4537 insertions(+) create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_resource_files.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_resource_files.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_resource_files_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_code.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_code.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_code_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_version.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_version.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_version_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_versions.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_versions.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_task_versions_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_tasks.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_tasks.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_tasks_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders_test.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_workflows.go create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_workflows.md create mode 100644 tencentcloud/services/wedata/data_source_tc_wedata_workflows_test.go create mode 100644 tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.go create mode 100644 tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.md create mode 100644 tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation_test.go create mode 100644 website/docs/d/wedata_downstream_tasks.html.markdown create mode 100644 website/docs/d/wedata_resource_files.html.markdown create mode 100644 website/docs/d/wedata_task_code.html.markdown create mode 100644 website/docs/d/wedata_task_version.html.markdown create mode 100644 website/docs/d/wedata_task_versions.html.markdown create mode 100644 website/docs/d/wedata_tasks.html.markdown create mode 100644 website/docs/d/wedata_upstream_tasks.html.markdown create mode 100644 website/docs/d/wedata_workflow_folders.html.markdown create mode 100644 website/docs/d/wedata_workflows.html.markdown create mode 100644 website/docs/r/wedata_submit_task_operation.html.markdown diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index b8fa36c4f5..8cbb968015 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -1158,6 +1158,15 @@ func Provider() *schema.Provider { "tencentcloud_eb_platform_event_patterns": eb.DataSourceTencentCloudEbPlatformEventPatterns(), "tencentcloud_eb_platform_products": eb.DataSourceTencentCloudEbPlatformProducts(), "tencentcloud_eb_plateform_event_template": eb.DataSourceTencentCloudEbPlateformEventTemplate(), + "tencentcloud_wedata_resource_files": wedata.DataSourceTencentCloudWedataResourceFiles(), + "tencentcloud_wedata_workflow_folders": wedata.DataSourceTencentCloudWedataWorkflowFolders(), + "tencentcloud_wedata_workflows": wedata.DataSourceTencentCloudWedataWorkflows(), + "tencentcloud_wedata_tasks": wedata.DataSourceTencentCloudWedataTasks(), + "tencentcloud_wedata_task_versions": wedata.DataSourceTencentCloudWedataTaskVersions(), + "tencentcloud_wedata_upstream_tasks": wedata.DataSourceTencentCloudWedataUpstreamTasks(), + "tencentcloud_wedata_downstream_tasks": wedata.DataSourceTencentCloudWedataDownstreamTasks(), + "tencentcloud_wedata_task_code": wedata.DataSourceTencentCloudWedataTaskCode(), + "tencentcloud_wedata_task_version": wedata.DataSourceTencentCloudWedataTaskVersion(), "tencentcloud_wedata_rule_templates": wedata.DataSourceTencentCloudWedataRuleTemplates(), "tencentcloud_wedata_ops_workflows": wedata.DataSourceTencentCloudWedataOpsWorkflows(), "tencentcloud_wedata_ops_workflow": wedata.DataSourceTencentCloudWedataOpsWorkflow(), @@ -2285,6 +2294,7 @@ func Provider() *schema.Provider { "tencentcloud_waf_bot_status_config": waf.ResourceTencentCloudWafBotStatusConfig(), "tencentcloud_waf_bot_scene_ucb_rule": waf.ResourceTencentCloudWafBotSceneUCBRule(), "tencentcloud_waf_attack_white_rule": waf.ResourceTencentCloudWafAttackWhiteRule(), + "tencentcloud_wedata_submit_task_operation": wedata.ResourceTencentCloudWedataSubmitTaskOperation(), "tencentcloud_wedata_rule_template": wedata.ResourceTencentCloudWedataRuleTemplate(), "tencentcloud_wedata_datasource": wedata.ResourceTencentCloudWedataDatasource(), "tencentcloud_wedata_function": wedata.ResourceTencentCloudWedataFunction(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index d8deedf0b8..3bc9ca7331 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -2220,6 +2220,15 @@ tencentcloud_waf_attack_white_rule Wedata Data Source +tencentcloud_wedata_resource_files +tencentcloud_wedata_workflow_folders +tencentcloud_wedata_workflows +tencentcloud_wedata_tasks +tencentcloud_wedata_task_versions +tencentcloud_wedata_upstream_tasks +tencentcloud_wedata_downstream_tasks +tencentcloud_wedata_task_code +tencentcloud_wedata_task_version tencentcloud_wedata_rule_templates tencentcloud_wedata_ops_workflows tencentcloud_wedata_ops_workflow @@ -2233,6 +2242,7 @@ tencentcloud_wedata_task_instance_executions tencentcloud_wedata_data_source_list Resource +tencentcloud_wedata_submit_task_operation tencentcloud_wedata_datasource tencentcloud_wedata_function tencentcloud_wedata_script diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.go b/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.go new file mode 100644 index 0000000000..7d67bb104c --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.go @@ -0,0 +1,255 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataDownstreamTasks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataDownstreamTasksRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Describes the downstream dependency details.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + "task_name": { + Type: schema.TypeString, + Required: true, + Description: "Task name.", + }, + "workflow_id": { + Type: schema.TypeString, + Required: true, + Description: "Workflow id.", + }, + "workflow_name": { + Type: schema.TypeString, + Required: true, + Description: "Workflow name.", + }, + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + "status": { + Type: schema.TypeString, + Required: true, + Description: "Task Status:\n\n* N: New\n\n* Y: Scheduling\n\n* F: Offline\n\n* O: Paused\n\n* T: Offlining (in the process of being taken offline)\n\nI* NVALID: Invalid.", + }, + "task_type_id": { + Type: schema.TypeInt, + Required: true, + Description: "Task type id.", + }, + "task_type_desc": { + Type: schema.TypeString, + Required: true, + Description: "Task type description.\n-20: universal data synchronization.\n - 25: ETLTaskType\n - 26: ETLTaskType\n - 30: python\n - 31: pyspark\n - 34: hivesql\n - 35: shell\n - 36: sparksql\n - 21: jdbcsql\n - 32: dlc\n - 33: ImpalaTaskType\n - 40: CDWTaskType\n - 41: kettle\n - 42: TCHouse-X\n - 43: TCHouse-X SQL\n - 46: dlcsparkTaskType\n - 47: TiOneMachineLearningTaskType\n - 48: Trino\n - 50: DLCPyspark\n - 23: TencentDistributedSQL\n - 39: spark\n - 92: MRTaskType\n - 38: ShellScript\n - 70: HiveSQLScrip\n-130: branch.\n-131: merge.\n-132: Notebook \n-133: SSH node.\n - 134: StarRocks\n - 137: For-each\n-10000: custom business common.", + }, + "schedule_desc": { + Type: schema.TypeString, + Required: true, + Description: "Specifies scheduling plan display description information.", + }, + "start_time": { + Type: schema.TypeString, + Required: true, + Description: "Task start time.", + }, + "end_time": { + Type: schema.TypeString, + Required: true, + Description: "Task end time.", + }, + "delay_time": { + Type: schema.TypeInt, + Required: true, + Description: "Delay time.", + }, + "cycle_type": { + Type: schema.TypeString, + Required: true, + Description: "Cycle Type, Default: D\nSupported types:\n* O: One-time\n\n* Y: Yearly\n\n* M: Monthly\n\n* W: Weekly\n\n* D: Daily\n\n* H: Hourly\n\n* I: Minute\n\n* C: Crontab expression type.", + }, + "owner_uin": { + Type: schema.TypeString, + Required: true, + Description: "Owner ID.", + }, + "task_action": { + Type: schema.TypeString, + Required: true, + Description: "Elastic cycle configuration.", + }, + "init_strategy": { + Type: schema.TypeString, + Required: true, + Description: "Initialization strategy for scheduling.", + }, + "crontab_expression": { + Type: schema.TypeString, + Required: true, + Description: "crontab expression.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataDownstreamTasksRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_downstream_tasks.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_id"); ok { + paramMap["TaskId"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.TaskDependDto + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataDownstreamTasksByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.TaskId != nil { + itemsMap["task_id"] = items.TaskId + ids = append(ids, *items.TaskId) + } + + if items.TaskName != nil { + itemsMap["task_name"] = items.TaskName + } + + if items.WorkflowId != nil { + itemsMap["workflow_id"] = items.WorkflowId + } + + if items.WorkflowName != nil { + itemsMap["workflow_name"] = items.WorkflowName + } + + if items.ProjectId != nil { + itemsMap["project_id"] = items.ProjectId + } + + if items.Status != nil { + itemsMap["status"] = items.Status + } + + if items.TaskTypeId != nil { + itemsMap["task_type_id"] = items.TaskTypeId + } + + if items.TaskTypeDesc != nil { + itemsMap["task_type_desc"] = items.TaskTypeDesc + } + + if items.ScheduleDesc != nil { + itemsMap["schedule_desc"] = items.ScheduleDesc + } + + if items.StartTime != nil { + itemsMap["start_time"] = items.StartTime + } + + if items.EndTime != nil { + itemsMap["end_time"] = items.EndTime + } + + if items.DelayTime != nil { + itemsMap["delay_time"] = items.DelayTime + } + + if items.CycleType != nil { + itemsMap["cycle_type"] = items.CycleType + } + + if items.OwnerUin != nil { + itemsMap["owner_uin"] = items.OwnerUin + } + + if items.TaskAction != nil { + itemsMap["task_action"] = items.TaskAction + } + + if items.InitStrategy != nil { + itemsMap["init_strategy"] = items.InitStrategy + } + + if items.CrontabExpression != nil { + itemsMap["crontab_expression"] = items.CrontabExpression + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.md b/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.md new file mode 100644 index 0000000000..1a04b432e7 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_downstream_tasks + +Example Usage + +```hcl +data "tencentcloud_wedata_downstream_tasks" "wedata_downstream_tasks" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks_test.go new file mode 100644 index 0000000000..cff09977de --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_downstream_tasks_test.go @@ -0,0 +1,31 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataDownstreamTasksDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataDownstreamTasksDataSource, + Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_downstream_tasks.wedata_downstream_tasks")), + }}, + }) +} + +const testAccWedataDownstreamTasksDataSource = ` + +data "tencentcloud_wedata_downstream_tasks" "wedata_downstream_tasks" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_resource_files.go b/tencentcloud/services/wedata/data_source_tc_wedata_resource_files.go new file mode 100644 index 0000000000..f07f50adea --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_resource_files.go @@ -0,0 +1,197 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataResourceFiles() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataResourceFilesRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "resource_name": { + Type: schema.TypeString, + Optional: true, + Description: "Resource file name (fuzzy search keyword).", + }, + + "parent_folder_path": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies the path of the file's parent folder (for example /a/b/c, querying resource files under the folder c).", + }, + + "create_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Creator ID. obtain through the DescribeCurrentUserInfo API.", + }, + + "modify_time_start": { + Type: schema.TypeString, + Optional: true, + Description: "Update time range. specifies the start time in yyyy-MM-dd HH:MM:ss format.", + }, + + "modify_time_end": { + Type: schema.TypeString, + Optional: true, + Description: "Update time range. specifies the end time in yyyy-MM-dd HH:MM:ss format.", + }, + + "create_time_start": { + Type: schema.TypeString, + Optional: true, + Description: "Create time range. specifies the start time in yyyy-MM-dd HH:MM:ss format.", + }, + + "create_time_end": { + Type: schema.TypeString, + Optional: true, + Description: "Create time range. specifies the termination time in yyyy-MM-dd HH:MM:ss format.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Retrieve the resource file list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_id": { + Type: schema.TypeString, + Required: true, + Description: "Resource file ID.", + }, + "resource_name": { + Type: schema.TypeString, + Required: true, + Description: "Resource file name.", + }, + "file_extension_type": { + Type: schema.TypeString, + Required: true, + Description: "Specifies the resource file type.", + }, + "local_path": { + Type: schema.TypeString, + Required: true, + Description: "Resource path.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataResourceFilesRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_resource_files.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("resource_name"); ok { + paramMap["ResourceName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("parent_folder_path"); ok { + paramMap["ParentFolderPath"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("create_user_uin"); ok { + paramMap["CreateUserUin"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("modify_time_start"); ok { + paramMap["ModifyTimeStart"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("modify_time_end"); ok { + paramMap["ModifyTimeEnd"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("create_time_start"); ok { + paramMap["CreateTimeStart"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("create_time_end"); ok { + paramMap["CreateTimeEnd"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.ResourceFileItem + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataResourceFilesByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.ResourceId != nil { + ids = append(ids, *items.ResourceId) + itemsMap["resource_id"] = items.ResourceId + } + + if items.ResourceName != nil { + itemsMap["resource_name"] = items.ResourceName + } + + if items.FileExtensionType != nil { + itemsMap["file_extension_type"] = items.FileExtensionType + } + + if items.LocalPath != nil { + itemsMap["local_path"] = items.LocalPath + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_resource_files.md b/tencentcloud/services/wedata/data_source_tc_wedata_resource_files.md new file mode 100644 index 0000000000..07467e0eb0 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_resource_files.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_resource_files + +Example Usage + +```hcl +data "tencentcloud_wedata_resource_files" "wedata_resource_files" { + project_id = 2905622749543821312 + resource_name = "tftest.txt" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_resource_files_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_resource_files_test.go new file mode 100644 index 0000000000..ec047aba11 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_resource_files_test.go @@ -0,0 +1,33 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataResourceFilesDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataResourceFilesDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_resource_files.wedata_resource_files"), + resource.TestCheckResourceAttrSet("data.tencentcloud_wedata_resource_files.wedata_resource_files", "data.#"), + ), + }}, + }) +} + +const testAccWedataResourceFilesDataSource = ` +data "tencentcloud_wedata_resource_files" "wedata_resource_files" { + project_id = 2905622749543821312 + resource_name = "tftest.txt" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_code.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_code.go new file mode 100644 index 0000000000..605489474d --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_code.go @@ -0,0 +1,118 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataTaskCode() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataTaskCodeRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "The project id.", + }, + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Retrieves the task code result.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code_info": { + Type: schema.TypeString, + Required: true, + Description: "Code content.", + }, + "code_file_size": { + Type: schema.TypeString, + Required: true, + Description: "Code file size. unit: KB.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataTaskCodeRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_task_code.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + var ( + projectId string + taskId string + ) + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + projectId = v.(string) + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_id"); ok { + taskId = v.(string) + paramMap["TaskId"] = helper.String(v.(string)) + } + + var respData *wedatav20250806.TaskCodeResult + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataTaskCodeByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + dataMap := map[string]interface{}{} + + if respData.CodeInfo != nil { + dataMap["code_info"] = respData.CodeInfo + } + + if respData.CodeFileSize != nil { + dataMap["code_file_size"] = respData.CodeFileSize + } + + _ = d.Set("data", []interface{}{dataMap}) + + d.SetId(projectId + tccommon.FILED_SP + taskId) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), dataMap); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_code.md b/tencentcloud/services/wedata/data_source_tc_wedata_task_code.md new file mode 100644 index 0000000000..b98892326f --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_code.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_task_code + +Example Usage + +```hcl +data "tencentcloud_wedata_task_code" "wedata_task_code" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_code_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_code_test.go new file mode 100644 index 0000000000..1a8cf2c5d7 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_code_test.go @@ -0,0 +1,31 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataTaskCodeDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataTaskCodeDataSource, + Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_task_code.wedata_task_code")), + }}, + }) +} + +const testAccWedataTaskCodeDataSource = ` + +data "tencentcloud_wedata_task_code" "wedata_task_code" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go new file mode 100644 index 0000000000..16621682c2 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go @@ -0,0 +1,1251 @@ +// Code generated by iacg; DO NOT EDIT. +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataTaskVersion() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataTaskVersionRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + + "version_id": { + Type: schema.TypeString, + Optional: true, + Description: "Submit version ID. If not specified, the latest submit version will be used by default.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Version detail.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "create_time": { + Type: schema.TypeString, + Required: true, + Description: "Creation time.", + }, + "version_num": { + Type: schema.TypeString, + Required: true, + Description: "Version number.", + }, + "create_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Specifies the version creator.", + }, + "version_id": { + Type: schema.TypeString, + Required: true, + Description: "Specifies the version Id to save.", + }, + "version_remark": { + Type: schema.TypeString, + Required: true, + Description: "Version description.", + }, + "approve_status": { + Type: schema.TypeString, + Required: true, + Description: "Approval status (only for submit version).", + }, + "approve_time": { + Type: schema.TypeString, + Required: true, + Description: "Production status (only for submit version).", + }, + "task": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Description: "Describes the task detail of the version.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "task_base_attribute": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Description: "Describes the basic attributes of the task.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + "task_type_id": { + Type: schema.TypeInt, + Required: true, + Description: "Specifies the task type ID.\n\n* 21:JDBC SQL\n* 23:TDSQL-PostgreSQL\n* 26:OfflineSynchronization\n* 30:Python\n* 31:PySpark\n* 33:Impala\n* 34:Hive SQL\n* 35:Shell\n* 36:Spark SQL\n* 38:Shell Form Mode\n* 39:Spark\n* 40:TCHouse-P\n* 41:Kettle\n* 42:Tchouse-X\n* 43:TCHouse-X SQL\n* 46:DLC Spark\n* 47:TiOne\n* 48:Trino\n* 50:DLC PySpark\n* 92:MapReduce\n* 130:Branch Node\n* 131:Merged Node\n* 132:Notebook\n* 133:SSH\n* 134:StarRocks\n* 137:For-each\n* 138:Setats SQL.", + }, + "workflow_id": { + Type: schema.TypeString, + Required: true, + Description: "Workflow ID.", + }, + "task_name": { + Type: schema.TypeString, + Optional: true, + Description: "Task name.", + }, + "task_latest_version_no": { + Type: schema.TypeString, + Optional: true, + Description: "Last save version number.", + }, + "task_latest_submit_version_no": { + Type: schema.TypeString, + Optional: true, + Description: "Last submit version number.", + }, + "workflow_name": { + Type: schema.TypeString, + Optional: true, + Description: "Workflow name.", + }, + "status": { + Type: schema.TypeString, + Optional: true, + Description: "Task Status:\n\n* N: New\n* Y: Scheduling\n* F: Offline\n* O: Paused\n* T: Offlining (in the process of being taken offline)\n* INVALID: Invalid.", + }, + "submit": { + Type: schema.TypeBool, + Optional: true, + Description: "Latest submission status of the task. Specifies whether it has been submitted: true/false.", + }, + "create_time": { + Type: schema.TypeString, + Optional: true, + Description: "Task creation time. example: 2022-02-12 11:13:41.", + }, + "last_update_time": { + Type: schema.TypeString, + Optional: true, + Description: "Last update time. example: 2025-08-13 16:34:06.", + }, + "last_update_user_name": { + Type: schema.TypeString, + Optional: true, + Description: "Last Updated By (Name).", + }, + "last_ops_time": { + Type: schema.TypeString, + Optional: true, + Description: "Last operation time.", + }, + "last_ops_user_name": { + Type: schema.TypeString, + Optional: true, + Description: "Last operator name.", + }, + "owner_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Task owner ID.", + }, + "task_description": { + Type: schema.TypeString, + Optional: true, + Description: "Task description.", + }, + "update_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Last Updated User ID.", + }, + "create_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Created By User ID.", + }, + }, + }, + }, + "task_configuration": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Description: "Task configurations.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code_content": { + Type: schema.TypeString, + Optional: true, + Description: "Base64 encoding of the code content.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "task_ext_configuration_list": { + Type: schema.TypeList, + Optional: true, + Description: "Extended attribute configuration list of the task.\nNote: This field may return null, indicating that no valid values can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "param_key": { + Type: schema.TypeString, + Required: true, + Description: "Parameter name.", + }, + "param_value": { + Type: schema.TypeString, + Required: true, + Description: "Parameter value.", + }, + }, + }, + }, + "data_cluster": { + Type: schema.TypeString, + Optional: true, + Description: "Cluster ID\n\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "broker_ip": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies the specified running node.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "yarn_queue": { + Type: schema.TypeString, + Optional: true, + Description: "Resource pool queue name. need to pass through DescribeProjectClusterQueues to obtain.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "source_service_id": { + Type: schema.TypeString, + Optional: true, + Description: "Source data source ID, separated by;, obtained through DescribeDataSourceWithoutInfo.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "source_service_type": { + Type: schema.TypeString, + Optional: true, + Description: "Data source type. use semicolon to separate. need to pass through DescribeDataSourceWithoutInfo to obtain.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "source_service_name": { + Type: schema.TypeString, + Optional: true, + Description: "Data source name. use semicolons to separate. need to pass through DescribeDataSourceWithoutInfo to obtain.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "target_service_id": { + Type: schema.TypeString, + Optional: true, + Description: "TargetTarget data source ID, separated by semicolons. need to pass through DescribeDataSourceWithoutInfo to obtain.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "target_service_type": { + Type: schema.TypeString, + Optional: true, + Description: "Target data source type. uses ; for separation. needs to pass through DescribeDataSourceWithoutInfo for retrieval.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "target_service_name": { + Type: schema.TypeString, + Optional: true, + Description: "Target data source name. use semicolon to separate. need to pass through DescribeDataSourceWithoutInfo to obtain.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "resource_group": { + Type: schema.TypeString, + Optional: true, + Description: "Resource group ID: need to pass through DescribeNormalSchedulerExecutorGroups to obtain ExecutorGroupId.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "resource_group_name": { + Type: schema.TypeString, + Optional: true, + Description: "Resource group name: need to pass through DescribeNormalSchedulerExecutorGroups to obtain ExecutorGroupName.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "task_scheduling_parameter_list": { + Type: schema.TypeList, + Optional: true, + Description: "Specifies the scheduling parameter.\nNote: This field may return null, indicating that no valid values can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "param_key": { + Type: schema.TypeString, + Required: true, + Description: "Parameter name.", + }, + "param_value": { + Type: schema.TypeString, + Required: true, + Description: "Parameter value.", + }, + }, + }, + }, + "bundle_id": { + Type: schema.TypeString, + Optional: true, + Description: "ID used by the Bundle.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + "bundle_info": { + Type: schema.TypeString, + Optional: true, + Description: "Bundle info.\nNote: This field may return null, indicating that no valid values can be obtained.", + }, + }, + }, + }, + "task_scheduler_configuration": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Description: "Specifies task scheduling configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cycle_type": { + Type: schema.TypeString, + Optional: true, + Description: "Period type. Supported types:\n\nONEOFF_CYCLE: specifies a one-time cycle.\nYEAR_CYCLE: specifies the year cycle.\nMONTH_CYCLE: specifies the monthly cycle.\nWEEK_CYCLE: specifies the week cycle.\nDAY_CYCLE: specifies the day cycle.\nHOUR_CYCLE: specifies the hour cycle.\nMINUTE_CYCLE: specifies the minute cycle.\nCRONTAB_CYCLE: specifies the crontab expression type.", + }, + "schedule_time_zone": { + Type: schema.TypeString, + Optional: true, + Description: "Time zone.", + }, + "crontab_expression": { + Type: schema.TypeString, + Optional: true, + Description: "0 2 3 1,L,2 * ?\t", + }, + "start_time": { + Type: schema.TypeString, + Optional: true, + Description: "Effective date.", + }, + "end_time": { + Type: schema.TypeString, + Optional: true, + Description: "End date", + }, + "execution_start_time": { + Type: schema.TypeString, + Optional: true, + Description: "Execution time. the left-closed interval.", + }, + "execution_end_time": { + Type: schema.TypeString, + Optional: true, + Description: "Execution time. right closed interval.", + }, + "schedule_run_type": { + Type: schema.TypeInt, + Optional: true, + Description: "Scheduling type: 0 for normal scheduling, 1 for dry-run scheduling.", + }, + "calendar_open": { + Type: schema.TypeString, + Optional: true, + Description: "Whether calendar scheduling is enabled. Valid values: 1 (enabled), 0 (disabled).", + }, + "calendar_id": { + Type: schema.TypeString, + Optional: true, + Description: "Calendar id.", + }, + "calendar_name": { + Type: schema.TypeString, + Optional: true, + Description: "Calendar name, which needs to be obtained from DescribeScheduleCalendarPageList API.", + }, + "self_depend": { + Type: schema.TypeString, + Optional: true, + Description: "Self-Dependent. Valid values: parallel, serial, orderly. Default value: serial. ", + }, + "upstream_dependency_config_list": { + Type: schema.TypeList, + Optional: true, + Description: "Specifies the upstream dependency array.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID", + }, + "main_cyclic_config": { + Type: schema.TypeString, + Required: true, + Description: "Main dependency configuration. Valid values:\n\n* CRONTAB\n* DAY\n* HOUR\n* LIST_DAY\n* LIST_HOUR\n* LIST_MINUTE\n* MINUTE\n* MONTH\n* RANGE_DAY\n* RANGE_HOUR\n* RANGE_MINUTE\n* WEEK\n* YEAR", + }, + "subordinate_cyclic_config": { + Type: schema.TypeString, + Optional: true, + Description: "Configures secondary dependencies. Valid values:\n* ALL_DAY_OF_YEAR\n* ALL_MONTH_OF_YEAR\n* CURRENT\n* CURRENT_DAY\n* CURRENT_HOUR\n* CURRENT_MINUTE\n* CURRENT_MONTH\n* CURRENT_WEEK\n* CURRENT_YEAR\n* PREVIOUS_BEGIN_OF_MONTH\n* PREVIOUS_DAY\n* PREVIOUS_DAY_LATER_OFFSET_HOUR\n* PREVIOUS_DAY_LATER_OFFSET_MINUTE\n* PREVIOUS_END_OF_MONTH\n* PREVIOUS_FRIDAY\n* PREVIOUS_HOUR\n* PREVIOUS_HOUR_CYCLE\n* PREVIOUS_HOUR_LATER_OFFSET_MINUTE\n* PREVIOUS_MINUTE_CYCLE\n* PREVIOUS_MONTH\n* PREVIOUS_WEEK\n* PREVIOUS_WEEKEND\n* RECENT_DATE", + }, + "offset": { + Type: schema.TypeString, + Optional: true, + Description: "Offset in Range/List Mode", + }, + "dependency_strategy": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Dependency Execution Policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "polling_null_strategy": { + Type: schema.TypeString, + Optional: true, + Description: "Wait upstream task instance policy: EXECUTING (execute); WAITING (wait).", + }, + "task_dependency_executing_strategies": { + Type: schema.TypeSet, + Optional: true, + Description: "This field is required only when PollingNullStrategy is set to EXECUTING.\nType: List\n\nNOT_EXIST (default) - In cases where minute depends on minute / hour depends on hour, the parent instance does not fall within the scheduling time range of the downstream instance.\n\nPARENT_EXPIRED - The parent instance failed.\n\nPARENT_TIMEOUT - The parent instance timed out.\n\nIf any of the above conditions are met, the dependency check for that parent task instance is considered satisfied. In all other cases, the system must wait for the parent instance.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "task_dependency_executing_timeout_value": { + Type: schema.TypeInt, + Optional: true, + Description: "This field is required only when TaskDependencyExecutingStrategies includes PARENT_TIMEOUT.\nSpecifies the timeout duration (in minutes) for the downstream task's dependency on the parent instance execution.", + }, + }, + }, + }, + }, + }, + }, + "down_stream_dependency_config_list": { + Type: schema.TypeList, + Optional: true, + Description: "SpecSpecifies the downstream dependency array.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID", + }, + "main_cyclic_config": { + Type: schema.TypeString, + Required: true, + Description: "Main dependency configuration. Valid values:\n\n* CRONTAB\n* DAY\n* HOUR\n* LIST_DAY\n* LIST_HOUR\n* LIST_MINUTE\n* MINUTE\n* MONTH\n* RANGE_DAY\n* RANGE_HOUR\n* RANGE_MINUTE\n* WEEK\n* YEAR", + }, + "subordinate_cyclic_config": { + Type: schema.TypeString, + Optional: true, + Description: "Configures secondary dependencies. Valid values:\n* ALL_DAY_OF_YEAR\n* ALL_MONTH_OF_YEAR\n* CURRENT\n* CURRENT_DAY\n* CURRENT_HOUR\n* CURRENT_MINUTE\n* CURRENT_MONTH\n* CURRENT_WEEK\n* CURRENT_YEAR\n* PREVIOUS_BEGIN_OF_MONTH\n* PREVIOUS_DAY\n* PREVIOUS_DAY_LATER_OFFSET_HOUR\n* PREVIOUS_DAY_LATER_OFFSET_MINUTE\n* PREVIOUS_END_OF_MONTH\n* PREVIOUS_FRIDAY\n* PREVIOUS_HOUR\n* PREVIOUS_HOUR_CYCLE\n* PREVIOUS_HOUR_LATER_OFFSET_MINUTE\n* PREVIOUS_MINUTE_CYCLE\n* PREVIOUS_MONTH\n* PREVIOUS_WEEK\n* PREVIOUS_WEEKEND\n* RECENT_DATE", + }, + "offset": { + Type: schema.TypeString, + Optional: true, + Description: "Offset in Range/List Mode", + }, + "dependency_strategy": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Dependency Execution Policy", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "polling_null_strategy": { + Type: schema.TypeString, + Optional: true, + Description: "Wait upstream task instance policy: EXECUTING (execute); WAITING (wait).", + }, + "task_dependency_executing_strategies": { + Type: schema.TypeSet, + Optional: true, + Description: "This field is required only when PollingNullStrategy is set to EXECUTING.\nType: List\n\nNOT_EXIST (default) - In cases where minute depends on minute / hour depends on hour, the parent instance does not fall within the scheduling time range of the downstream instance.\n\nPARENT_EXPIRED - The parent instance failed.\n\nPARENT_TIMEOUT - The parent instance timed out.\n\nIf any of the above conditions are met, the dependency check for that parent task instance is considered satisfied. In all other cases, the system must wait for the parent instance.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "task_dependency_executing_timeout_value": { + Type: schema.TypeInt, + Optional: true, + Description: "This field is required only when TaskDependencyExecutingStrategies includes PARENT_TIMEOUT.\nSpecifies the timeout duration (in minutes) for the downstream task's dependency on the parent instance execution.", + }, + }, + }, + }, + }, + }, + }, + "event_listener_list": { + Type: schema.TypeList, + Optional: true, + Description: "Array of Events", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "event_name": { + Type: schema.TypeString, + Required: true, + Description: "Event name", + }, + "event_sub_type": { + Type: schema.TypeString, + Required: true, + Description: "Event cycle. valid values: SECOND, MIN, HOUR, DAY.", + }, + "event_broadcast_type": { + Type: schema.TypeString, + Required: true, + Description: "Event BROADCAST type: SINGLE, BROADCAST.", + }, + "properties_list": { + Type: schema.TypeList, + Optional: true, + Description: "Extension Information\n", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "param_key": { + Type: schema.TypeString, + Required: true, + Description: "Parameter name.", + }, + "param_value": { + Type: schema.TypeString, + Required: true, + Description: "Parameter value.", + }, + }, + }, + }, + }, + }, + }, + "run_priority": { + Type: schema.TypeInt, + Optional: true, + Description: "Task scheduling priority. valid values: 4 (high), 5 (medium), 6 (low). default: 6.", + }, + "retry_wait": { + Type: schema.TypeInt, + Optional: true, + Description: "Retry policy. retry wait time in minutes. default: 5.", + }, + "max_retry_attempts": { + Type: schema.TypeInt, + Optional: true, + Description: "Specifies the maximum attempts of the retry policy. default: 4.", + }, + "execution_ttl": { + Type: schema.TypeInt, + Optional: true, + Description: "Timeout Handling Policy: Execution Timeout (in minutes), default: -1", + }, + "wait_execution_total_ttl": { + Type: schema.TypeString, + Optional: true, + Description: "Timeout Handling Policy: Wait Duration Timeout (in minutes), default: -1", + }, + "allow_redo_type": { + Type: schema.TypeString, + Optional: true, + Description: "Rerun & Refill Configuration: Default: ALL;\n\n* ALL: Rerun or refill is allowed regardless of whether the task succeeds or fails.\n\n* FAILURE: Rerun or refill is allowed only if the task fails; not allowed if the task succeeds.\n\n* NONE: Rerun or refill is not allowed regardless of success or failure.", + }, + "param_task_out_list": { + Type: schema.TypeList, + Optional: true, + Description: "Output parameter list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "param_key": { + Type: schema.TypeString, + Required: true, + Description: "Parameter name.", + }, + "param_value": { + Type: schema.TypeString, + Required: true, + Description: "Parameter definition.", + }, + }, + }, + }, + "param_task_in_list": { + Type: schema.TypeList, + Optional: true, + Description: "Input parameter list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "param_key": { + Type: schema.TypeString, + Required: true, + Description: "Parameter name.", + }, + "param_desc": { + Type: schema.TypeString, + Required: true, + Description: "Parameter Description: The format is ProjectIdentifier.TaskName.ParameterName\nExample: project_wedata_1.sh_250820_104107.pp_out", + }, + "from_task_id": { + Type: schema.TypeString, + Required: true, + Description: "Parent Task ID", + }, + "from_param_key": { + Type: schema.TypeString, + Required: true, + Description: "Parent task parameter key.", + }, + }, + }, + }, + "task_output_registry_list": { + Type: schema.TypeList, + Optional: true, + Description: "Output registration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "datasource_id": { + Type: schema.TypeString, + Required: true, + Description: "Data source ID.", + }, + "database_name": { + Type: schema.TypeString, + Required: true, + Description: "Database name.", + }, + "table_name": { + Type: schema.TypeString, + Required: true, + Description: "Table name", + }, + "partition_name": { + Type: schema.TypeString, + Required: true, + Description: "Partition name", + }, + "data_flow_type": { + Type: schema.TypeString, + Required: true, + Description: "Input output table data type.\nInput stream:\n UPSTREAM,\nOutput stream:\n DOWNSTREAM;.", + }, + "table_physical_id": { + Type: schema.TypeString, + Required: true, + Description: "Physical unique ID..", + }, + "db_guid": { + Type: schema.TypeString, + Optional: true, + Description: "Database unique id..", + }, + "table_guid": { + Type: schema.TypeString, + Optional: true, + Description: "Unique id of the table.", + }, + }, + }, + }, + "init_strategy": { + Type: schema.TypeString, + Optional: true, + Description: "**Instance generation policy**.\nT_PLUS_0: specifies t+0 generation. default policy.\nT_PLUS_1: specifies t+1 generation.", + }, + }, + }, + }, + }, + }, + }, + "approve_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Approver Id.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataTaskVersionRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_task_version.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + var ( + projectId string + taskId string + ) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + projectId = v.(string) + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_id"); ok { + taskId = v.(string) + paramMap["TaskId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("version_id"); ok { + paramMap["VersionId"] = helper.String(v.(string)) + } + + var respData *wedatav20250806.GetTaskVersionResponseParams + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataTaskVersionByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + dataMap := map[string]interface{}{} + + if respData.Data != nil { + if respData.Data.CreateTime != nil { + dataMap["create_time"] = respData.Data.CreateTime + } + + if respData.Data.VersionNum != nil { + dataMap["version_num"] = respData.Data.VersionNum + } + + if respData.Data.CreateUserUin != nil { + dataMap["create_user_uin"] = respData.Data.CreateUserUin + } + + if respData.Data.VersionId != nil { + dataMap["version_id"] = respData.Data.VersionId + } + + if respData.Data.VersionRemark != nil { + dataMap["version_remark"] = respData.Data.VersionRemark + } + + if respData.Data.ApproveStatus != nil { + dataMap["approve_status"] = respData.Data.ApproveStatus + } + + if respData.Data.ApproveTime != nil { + dataMap["approve_time"] = respData.Data.ApproveTime + } + + taskMap := map[string]interface{}{} + + if respData.Data.Task != nil { + taskBaseAttributeMap := map[string]interface{}{} + + if respData.Data.Task.TaskBaseAttribute != nil { + if respData.Data.Task.TaskBaseAttribute.TaskId != nil { + taskBaseAttributeMap["task_id"] = respData.Data.Task.TaskBaseAttribute.TaskId + } + + if respData.Data.Task.TaskBaseAttribute.TaskTypeId != nil { + taskBaseAttributeMap["task_type_id"] = respData.Data.Task.TaskBaseAttribute.TaskTypeId + } + + if respData.Data.Task.TaskBaseAttribute.WorkflowId != nil { + taskBaseAttributeMap["workflow_id"] = respData.Data.Task.TaskBaseAttribute.WorkflowId + } + + if respData.Data.Task.TaskBaseAttribute.TaskName != nil { + taskBaseAttributeMap["task_name"] = respData.Data.Task.TaskBaseAttribute.TaskName + } + + if respData.Data.Task.TaskBaseAttribute.TaskLatestVersionNo != nil { + taskBaseAttributeMap["task_latest_version_no"] = respData.Data.Task.TaskBaseAttribute.TaskLatestVersionNo + } + + if respData.Data.Task.TaskBaseAttribute.TaskLatestSubmitVersionNo != nil { + taskBaseAttributeMap["task_latest_submit_version_no"] = respData.Data.Task.TaskBaseAttribute.TaskLatestSubmitVersionNo + } + + if respData.Data.Task.TaskBaseAttribute.WorkflowName != nil { + taskBaseAttributeMap["workflow_name"] = respData.Data.Task.TaskBaseAttribute.WorkflowName + } + + if respData.Data.Task.TaskBaseAttribute.Status != nil { + taskBaseAttributeMap["status"] = respData.Data.Task.TaskBaseAttribute.Status + } + + if respData.Data.Task.TaskBaseAttribute.Submit != nil { + taskBaseAttributeMap["submit"] = respData.Data.Task.TaskBaseAttribute.Submit + } + + if respData.Data.Task.TaskBaseAttribute.CreateTime != nil { + taskBaseAttributeMap["create_time"] = respData.Data.Task.TaskBaseAttribute.CreateTime + } + + if respData.Data.Task.TaskBaseAttribute.LastUpdateTime != nil { + taskBaseAttributeMap["last_update_time"] = respData.Data.Task.TaskBaseAttribute.LastUpdateTime + } + + if respData.Data.Task.TaskBaseAttribute.LastUpdateUserName != nil { + taskBaseAttributeMap["last_update_user_name"] = respData.Data.Task.TaskBaseAttribute.LastUpdateUserName + } + + if respData.Data.Task.TaskBaseAttribute.LastOpsTime != nil { + taskBaseAttributeMap["last_ops_time"] = respData.Data.Task.TaskBaseAttribute.LastOpsTime + } + + if respData.Data.Task.TaskBaseAttribute.LastOpsUserName != nil { + taskBaseAttributeMap["last_ops_user_name"] = respData.Data.Task.TaskBaseAttribute.LastOpsUserName + } + + if respData.Data.Task.TaskBaseAttribute.OwnerUin != nil { + taskBaseAttributeMap["owner_uin"] = respData.Data.Task.TaskBaseAttribute.OwnerUin + } + + if respData.Data.Task.TaskBaseAttribute.TaskDescription != nil { + taskBaseAttributeMap["task_description"] = respData.Data.Task.TaskBaseAttribute.TaskDescription + } + + if respData.Data.Task.TaskBaseAttribute.UpdateUserUin != nil { + taskBaseAttributeMap["update_user_uin"] = respData.Data.Task.TaskBaseAttribute.UpdateUserUin + } + + if respData.Data.Task.TaskBaseAttribute.CreateUserUin != nil { + taskBaseAttributeMap["create_user_uin"] = respData.Data.Task.TaskBaseAttribute.CreateUserUin + } + + taskMap["task_base_attribute"] = []interface{}{taskBaseAttributeMap} + } + + taskConfigurationMap := map[string]interface{}{} + + if respData.Data.Task.TaskConfiguration != nil { + if respData.Data.Task.TaskConfiguration.CodeContent != nil { + taskConfigurationMap["code_content"] = respData.Data.Task.TaskConfiguration.CodeContent + } + + taskExtConfigurationListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskConfiguration.TaskExtConfigurationList)) + if respData.Data.Task.TaskConfiguration.TaskExtConfigurationList != nil { + for _, taskExtConfigurationList := range respData.Data.Task.TaskConfiguration.TaskExtConfigurationList { + taskExtConfigurationListMap := map[string]interface{}{} + + if taskExtConfigurationList.ParamKey != nil { + taskExtConfigurationListMap["param_key"] = taskExtConfigurationList.ParamKey + } + + if taskExtConfigurationList.ParamValue != nil { + taskExtConfigurationListMap["param_value"] = taskExtConfigurationList.ParamValue + } + + taskExtConfigurationListList = append(taskExtConfigurationListList, taskExtConfigurationListMap) + } + + taskConfigurationMap["task_ext_configuration_list"] = taskExtConfigurationListList + } + if respData.Data.Task.TaskConfiguration.DataCluster != nil { + taskConfigurationMap["data_cluster"] = respData.Data.Task.TaskConfiguration.DataCluster + } + + if respData.Data.Task.TaskConfiguration.BrokerIp != nil { + taskConfigurationMap["broker_ip"] = respData.Data.Task.TaskConfiguration.BrokerIp + } + + if respData.Data.Task.TaskConfiguration.YarnQueue != nil { + taskConfigurationMap["yarn_queue"] = respData.Data.Task.TaskConfiguration.YarnQueue + } + + if respData.Data.Task.TaskConfiguration.SourceServiceId != nil { + taskConfigurationMap["source_service_id"] = respData.Data.Task.TaskConfiguration.SourceServiceId + } + + if respData.Data.Task.TaskConfiguration.SourceServiceType != nil { + taskConfigurationMap["source_service_type"] = respData.Data.Task.TaskConfiguration.SourceServiceType + } + + if respData.Data.Task.TaskConfiguration.SourceServiceName != nil { + taskConfigurationMap["source_service_name"] = respData.Data.Task.TaskConfiguration.SourceServiceName + } + + if respData.Data.Task.TaskConfiguration.TargetServiceId != nil { + taskConfigurationMap["target_service_id"] = respData.Data.Task.TaskConfiguration.TargetServiceId + } + + if respData.Data.Task.TaskConfiguration.TargetServiceType != nil { + taskConfigurationMap["target_service_type"] = respData.Data.Task.TaskConfiguration.TargetServiceType + } + + if respData.Data.Task.TaskConfiguration.TargetServiceName != nil { + taskConfigurationMap["target_service_name"] = respData.Data.Task.TaskConfiguration.TargetServiceName + } + + if respData.Data.Task.TaskConfiguration.ResourceGroup != nil { + taskConfigurationMap["resource_group"] = respData.Data.Task.TaskConfiguration.ResourceGroup + } + + if respData.Data.Task.TaskConfiguration.ResourceGroupName != nil { + taskConfigurationMap["resource_group_name"] = respData.Data.Task.TaskConfiguration.ResourceGroupName + } + + taskSchedulingParameterListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskConfiguration.TaskSchedulingParameterList)) + if respData.Data.Task.TaskConfiguration.TaskSchedulingParameterList != nil { + for _, taskSchedulingParameterList := range respData.Data.Task.TaskConfiguration.TaskSchedulingParameterList { + taskSchedulingParameterListMap := map[string]interface{}{} + + if taskSchedulingParameterList.ParamKey != nil { + taskSchedulingParameterListMap["param_key"] = taskSchedulingParameterList.ParamKey + } + + if taskSchedulingParameterList.ParamValue != nil { + taskSchedulingParameterListMap["param_value"] = taskSchedulingParameterList.ParamValue + } + + taskSchedulingParameterListList = append(taskSchedulingParameterListList, taskSchedulingParameterListMap) + } + + taskConfigurationMap["task_scheduling_parameter_list"] = taskSchedulingParameterListList + } + if respData.Data.Task.TaskConfiguration.BundleId != nil { + taskConfigurationMap["bundle_id"] = respData.Data.Task.TaskConfiguration.BundleId + } + + if respData.Data.Task.TaskConfiguration.BundleInfo != nil { + taskConfigurationMap["bundle_info"] = respData.Data.Task.TaskConfiguration.BundleInfo + } + + taskMap["task_configuration"] = []interface{}{taskConfigurationMap} + } + + taskSchedulerConfigurationMap := map[string]interface{}{} + + if respData.Data.Task.TaskSchedulerConfiguration != nil { + if respData.Data.Task.TaskSchedulerConfiguration.CycleType != nil { + taskSchedulerConfigurationMap["cycle_type"] = respData.Data.Task.TaskSchedulerConfiguration.CycleType + } + + if respData.Data.Task.TaskSchedulerConfiguration.ScheduleTimeZone != nil { + taskSchedulerConfigurationMap["schedule_time_zone"] = respData.Data.Task.TaskSchedulerConfiguration.ScheduleTimeZone + } + + if respData.Data.Task.TaskSchedulerConfiguration.CrontabExpression != nil { + taskSchedulerConfigurationMap["crontab_expression"] = respData.Data.Task.TaskSchedulerConfiguration.CrontabExpression + } + + if respData.Data.Task.TaskSchedulerConfiguration.StartTime != nil { + taskSchedulerConfigurationMap["start_time"] = respData.Data.Task.TaskSchedulerConfiguration.StartTime + } + + if respData.Data.Task.TaskSchedulerConfiguration.EndTime != nil { + taskSchedulerConfigurationMap["end_time"] = respData.Data.Task.TaskSchedulerConfiguration.EndTime + } + + if respData.Data.Task.TaskSchedulerConfiguration.ExecutionStartTime != nil { + taskSchedulerConfigurationMap["execution_start_time"] = respData.Data.Task.TaskSchedulerConfiguration.ExecutionStartTime + } + + if respData.Data.Task.TaskSchedulerConfiguration.ExecutionEndTime != nil { + taskSchedulerConfigurationMap["execution_end_time"] = respData.Data.Task.TaskSchedulerConfiguration.ExecutionEndTime + } + + if respData.Data.Task.TaskSchedulerConfiguration.ScheduleRunType != nil { + taskSchedulerConfigurationMap["schedule_run_type"] = respData.Data.Task.TaskSchedulerConfiguration.ScheduleRunType + } + + if respData.Data.Task.TaskSchedulerConfiguration.CalendarOpen != nil { + taskSchedulerConfigurationMap["calendar_open"] = respData.Data.Task.TaskSchedulerConfiguration.CalendarOpen + } + + if respData.Data.Task.TaskSchedulerConfiguration.CalendarId != nil { + taskSchedulerConfigurationMap["calendar_id"] = respData.Data.Task.TaskSchedulerConfiguration.CalendarId + } + + if respData.Data.Task.TaskSchedulerConfiguration.CalendarName != nil { + taskSchedulerConfigurationMap["calendar_name"] = respData.Data.Task.TaskSchedulerConfiguration.CalendarName + } + + if respData.Data.Task.TaskSchedulerConfiguration.SelfDepend != nil { + taskSchedulerConfigurationMap["self_depend"] = respData.Data.Task.TaskSchedulerConfiguration.SelfDepend + } + + upstreamDependencyConfigListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskSchedulerConfiguration.UpstreamDependencyConfigList)) + if respData.Data.Task.TaskSchedulerConfiguration.UpstreamDependencyConfigList != nil { + for _, upstreamDependencyConfigList := range respData.Data.Task.TaskSchedulerConfiguration.UpstreamDependencyConfigList { + upstreamDependencyConfigListMap := map[string]interface{}{} + + if upstreamDependencyConfigList.TaskId != nil { + upstreamDependencyConfigListMap["task_id"] = upstreamDependencyConfigList.TaskId + } + + if upstreamDependencyConfigList.MainCyclicConfig != nil { + upstreamDependencyConfigListMap["main_cyclic_config"] = upstreamDependencyConfigList.MainCyclicConfig + } + + if upstreamDependencyConfigList.SubordinateCyclicConfig != nil { + upstreamDependencyConfigListMap["subordinate_cyclic_config"] = upstreamDependencyConfigList.SubordinateCyclicConfig + } + + if upstreamDependencyConfigList.Offset != nil { + upstreamDependencyConfigListMap["offset"] = upstreamDependencyConfigList.Offset + } + + dependencyStrategyMap := map[string]interface{}{} + + if upstreamDependencyConfigList.DependencyStrategy != nil { + if upstreamDependencyConfigList.DependencyStrategy.PollingNullStrategy != nil { + dependencyStrategyMap["polling_null_strategy"] = upstreamDependencyConfigList.DependencyStrategy.PollingNullStrategy + } + + if upstreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingStrategies != nil { + dependencyStrategyMap["task_dependency_executing_strategies"] = upstreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingStrategies + } + + if upstreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingTimeoutValue != nil { + dependencyStrategyMap["task_dependency_executing_timeout_value"] = upstreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingTimeoutValue + } + + upstreamDependencyConfigListMap["dependency_strategy"] = []interface{}{dependencyStrategyMap} + } + + upstreamDependencyConfigListList = append(upstreamDependencyConfigListList, upstreamDependencyConfigListMap) + } + + taskSchedulerConfigurationMap["upstream_dependency_config_list"] = upstreamDependencyConfigListList + } + downStreamDependencyConfigListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskSchedulerConfiguration.DownStreamDependencyConfigList)) + if respData.Data.Task.TaskSchedulerConfiguration.DownStreamDependencyConfigList != nil { + for _, downStreamDependencyConfigList := range respData.Data.Task.TaskSchedulerConfiguration.DownStreamDependencyConfigList { + downStreamDependencyConfigListMap := map[string]interface{}{} + + if downStreamDependencyConfigList.TaskId != nil { + downStreamDependencyConfigListMap["task_id"] = downStreamDependencyConfigList.TaskId + } + + if downStreamDependencyConfigList.MainCyclicConfig != nil { + downStreamDependencyConfigListMap["main_cyclic_config"] = downStreamDependencyConfigList.MainCyclicConfig + } + + if downStreamDependencyConfigList.SubordinateCyclicConfig != nil { + downStreamDependencyConfigListMap["subordinate_cyclic_config"] = downStreamDependencyConfigList.SubordinateCyclicConfig + } + + if downStreamDependencyConfigList.Offset != nil { + downStreamDependencyConfigListMap["offset"] = downStreamDependencyConfigList.Offset + } + + dependencyStrategyMap := map[string]interface{}{} + + if downStreamDependencyConfigList.DependencyStrategy != nil { + if downStreamDependencyConfigList.DependencyStrategy.PollingNullStrategy != nil { + dependencyStrategyMap["polling_null_strategy"] = downStreamDependencyConfigList.DependencyStrategy.PollingNullStrategy + } + + if downStreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingStrategies != nil { + dependencyStrategyMap["task_dependency_executing_strategies"] = downStreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingStrategies + } + + if downStreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingTimeoutValue != nil { + dependencyStrategyMap["task_dependency_executing_timeout_value"] = downStreamDependencyConfigList.DependencyStrategy.TaskDependencyExecutingTimeoutValue + } + + downStreamDependencyConfigListMap["dependency_strategy"] = []interface{}{dependencyStrategyMap} + } + + downStreamDependencyConfigListList = append(downStreamDependencyConfigListList, downStreamDependencyConfigListMap) + } + + taskSchedulerConfigurationMap["down_stream_dependency_config_list"] = downStreamDependencyConfigListList + } + eventListenerListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskSchedulerConfiguration.EventListenerList)) + if respData.Data.Task.TaskSchedulerConfiguration.EventListenerList != nil { + for _, eventListenerList := range respData.Data.Task.TaskSchedulerConfiguration.EventListenerList { + eventListenerListMap := map[string]interface{}{} + + if eventListenerList.EventName != nil { + eventListenerListMap["event_name"] = eventListenerList.EventName + } + + if eventListenerList.EventSubType != nil { + eventListenerListMap["event_sub_type"] = eventListenerList.EventSubType + } + + if eventListenerList.EventBroadcastType != nil { + eventListenerListMap["event_broadcast_type"] = eventListenerList.EventBroadcastType + } + + propertiesListList := make([]map[string]interface{}, 0, len(eventListenerList.PropertiesList)) + if eventListenerList.PropertiesList != nil { + for _, propertiesList := range eventListenerList.PropertiesList { + propertiesListMap := map[string]interface{}{} + + if propertiesList.ParamKey != nil { + propertiesListMap["param_key"] = propertiesList.ParamKey + } + + if propertiesList.ParamValue != nil { + propertiesListMap["param_value"] = propertiesList.ParamValue + } + + propertiesListList = append(propertiesListList, propertiesListMap) + } + + eventListenerListMap["properties_list"] = propertiesListList + } + eventListenerListList = append(eventListenerListList, eventListenerListMap) + } + + taskSchedulerConfigurationMap["event_listener_list"] = eventListenerListList + } + if respData.Data.Task.TaskSchedulerConfiguration.RunPriority != nil { + taskSchedulerConfigurationMap["run_priority"] = respData.Data.Task.TaskSchedulerConfiguration.RunPriority + } + + if respData.Data.Task.TaskSchedulerConfiguration.RetryWait != nil { + taskSchedulerConfigurationMap["retry_wait"] = respData.Data.Task.TaskSchedulerConfiguration.RetryWait + } + + if respData.Data.Task.TaskSchedulerConfiguration.MaxRetryAttempts != nil { + taskSchedulerConfigurationMap["max_retry_attempts"] = respData.Data.Task.TaskSchedulerConfiguration.MaxRetryAttempts + } + + if respData.Data.Task.TaskSchedulerConfiguration.ExecutionTTL != nil { + taskSchedulerConfigurationMap["execution_ttl"] = respData.Data.Task.TaskSchedulerConfiguration.ExecutionTTL + } + + if respData.Data.Task.TaskSchedulerConfiguration.WaitExecutionTotalTTL != nil { + taskSchedulerConfigurationMap["wait_execution_total_ttl"] = respData.Data.Task.TaskSchedulerConfiguration.WaitExecutionTotalTTL + } + + if respData.Data.Task.TaskSchedulerConfiguration.AllowRedoType != nil { + taskSchedulerConfigurationMap["allow_redo_type"] = respData.Data.Task.TaskSchedulerConfiguration.AllowRedoType + } + + paramTaskOutListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskSchedulerConfiguration.ParamTaskOutList)) + if respData.Data.Task.TaskSchedulerConfiguration.ParamTaskOutList != nil { + for _, paramTaskOutList := range respData.Data.Task.TaskSchedulerConfiguration.ParamTaskOutList { + paramTaskOutListMap := map[string]interface{}{} + + if paramTaskOutList.ParamKey != nil { + paramTaskOutListMap["param_key"] = paramTaskOutList.ParamKey + } + + if paramTaskOutList.ParamValue != nil { + paramTaskOutListMap["param_value"] = paramTaskOutList.ParamValue + } + + paramTaskOutListList = append(paramTaskOutListList, paramTaskOutListMap) + } + + taskSchedulerConfigurationMap["param_task_out_list"] = paramTaskOutListList + } + paramTaskInListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskSchedulerConfiguration.ParamTaskInList)) + if respData.Data.Task.TaskSchedulerConfiguration.ParamTaskInList != nil { + for _, paramTaskInList := range respData.Data.Task.TaskSchedulerConfiguration.ParamTaskInList { + paramTaskInListMap := map[string]interface{}{} + + if paramTaskInList.ParamKey != nil { + paramTaskInListMap["param_key"] = paramTaskInList.ParamKey + } + + if paramTaskInList.ParamDesc != nil { + paramTaskInListMap["param_desc"] = paramTaskInList.ParamDesc + } + + if paramTaskInList.FromTaskId != nil { + paramTaskInListMap["from_task_id"] = paramTaskInList.FromTaskId + } + + if paramTaskInList.FromParamKey != nil { + paramTaskInListMap["from_param_key"] = paramTaskInList.FromParamKey + } + + paramTaskInListList = append(paramTaskInListList, paramTaskInListMap) + } + + taskSchedulerConfigurationMap["param_task_in_list"] = paramTaskInListList + } + taskOutputRegistryListList := make([]map[string]interface{}, 0, len(respData.Data.Task.TaskSchedulerConfiguration.TaskOutputRegistryList)) + if respData.Data.Task.TaskSchedulerConfiguration.TaskOutputRegistryList != nil { + for _, taskOutputRegistryList := range respData.Data.Task.TaskSchedulerConfiguration.TaskOutputRegistryList { + taskOutputRegistryListMap := map[string]interface{}{} + + if taskOutputRegistryList.DatasourceId != nil { + taskOutputRegistryListMap["datasource_id"] = taskOutputRegistryList.DatasourceId + } + + if taskOutputRegistryList.DatabaseName != nil { + taskOutputRegistryListMap["database_name"] = taskOutputRegistryList.DatabaseName + } + + if taskOutputRegistryList.TableName != nil { + taskOutputRegistryListMap["table_name"] = taskOutputRegistryList.TableName + } + + if taskOutputRegistryList.PartitionName != nil { + taskOutputRegistryListMap["partition_name"] = taskOutputRegistryList.PartitionName + } + + if taskOutputRegistryList.DataFlowType != nil { + taskOutputRegistryListMap["data_flow_type"] = taskOutputRegistryList.DataFlowType + } + + if taskOutputRegistryList.TablePhysicalId != nil { + taskOutputRegistryListMap["table_physical_id"] = taskOutputRegistryList.TablePhysicalId + } + + if taskOutputRegistryList.DbGuid != nil { + taskOutputRegistryListMap["db_guid"] = taskOutputRegistryList.DbGuid + } + + if taskOutputRegistryList.TableGuid != nil { + taskOutputRegistryListMap["table_guid"] = taskOutputRegistryList.TableGuid + } + + taskOutputRegistryListList = append(taskOutputRegistryListList, taskOutputRegistryListMap) + } + + taskSchedulerConfigurationMap["task_output_registry_list"] = taskOutputRegistryListList + } + if respData.Data.Task.TaskSchedulerConfiguration.InitStrategy != nil { + taskSchedulerConfigurationMap["init_strategy"] = respData.Data.Task.TaskSchedulerConfiguration.InitStrategy + } + + taskMap["task_scheduler_configuration"] = []interface{}{taskSchedulerConfigurationMap} + } + + dataMap["task"] = []interface{}{taskMap} + } + + if respData.Data.ApproveUserUin != nil { + dataMap["approve_user_uin"] = respData.Data.ApproveUserUin + } + + _ = d.Set("data", []interface{}{dataMap}) + } + + d.SetId(projectId+tccommon.FILED_SP+ taskId) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), dataMap); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_version.md b/tencentcloud/services/wedata/data_source_tc_wedata_task_version.md new file mode 100644 index 0000000000..1c8f908c5e --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_version.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_task_version + +Example Usage + +```hcl +data "tencentcloud_wedata_task_version" "wedata_task_version" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_version_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_version_test.go new file mode 100644 index 0000000000..3ee5c388f4 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_version_test.go @@ -0,0 +1,31 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataTaskVersionDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataTaskVersionDataSource, + Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_task_version.wedata_task_version")), + }}, + }) +} + +const testAccWedataTaskVersionDataSource = ` + +data "tencentcloud_wedata_task_version" "wedata_task_version" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_versions.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_versions.go new file mode 100644 index 0000000000..481551e7cf --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_versions.go @@ -0,0 +1,184 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataTaskVersions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataTaskVersionsRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + + "task_version_type": { + Type: schema.TypeString, + Optional: true, + Description: "SAVE version.\nSUBMIT version.\nDefaults to SAVE.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Task version list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "create_time": { + Type: schema.TypeString, + Required: true, + Description: "Creation time.", + }, + "version_num": { + Type: schema.TypeString, + Required: true, + Description: "Version number.", + }, + "create_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Creator ID.", + }, + "version_id": { + Type: schema.TypeString, + Required: true, + Description: "Saved version ID.", + }, + "version_remark": { + Type: schema.TypeString, + Required: true, + Description: "Version description.", + }, + "approve_status": { + Type: schema.TypeString, + Required: true, + Description: "Approval status (only for submit version).", + }, + "status": { + Type: schema.TypeString, + Required: true, + Description: "Production status (only for submit version).", + }, + "approve_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Approver (only for submit version).", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataTaskVersionsRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_task_versions.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_id"); ok { + paramMap["TaskId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_version_type"); ok { + paramMap["TaskVersionType"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.TaskVersion + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataTaskVersionsByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.CreateTime != nil { + itemsMap["create_time"] = items.CreateTime + } + + if items.VersionNum != nil { + itemsMap["version_num"] = items.VersionNum + } + + if items.CreateUserUin != nil { + itemsMap["create_user_uin"] = items.CreateUserUin + } + + if items.VersionId != nil { + itemsMap["version_id"] = items.VersionId + } + + if items.VersionRemark != nil { + itemsMap["version_remark"] = items.VersionRemark + } + + if items.ApproveStatus != nil { + itemsMap["approve_status"] = items.ApproveStatus + } + + if items.Status != nil { + itemsMap["status"] = items.Status + } + + if items.ApproveUserUin != nil { + itemsMap["approve_user_uin"] = items.ApproveUserUin + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_versions.md b/tencentcloud/services/wedata/data_source_tc_wedata_task_versions.md new file mode 100644 index 0000000000..38efa89b31 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_versions.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_task_versions + +Example Usage + +```hcl +data "tencentcloud_wedata_task_versions" "wedata_task_versions" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_versions_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_versions_test.go new file mode 100644 index 0000000000..227630ca7f --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_versions_test.go @@ -0,0 +1,31 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataTaskVersionsDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataTaskVersionsDataSource, + Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_task_versions.wedata_task_versions")), + }}, + }) +} + +const testAccWedataTaskVersionsDataSource = ` + +data "tencentcloud_wedata_task_versions" "wedata_task_versions" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_tasks.go b/tencentcloud/services/wedata/data_source_tc_wedata_tasks.go new file mode 100644 index 0000000000..cc132d9be7 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_tasks.go @@ -0,0 +1,374 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataTasks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataTasksRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "task_name": { + Type: schema.TypeString, + Optional: true, + Description: "Task name.", + }, + + "workflow_id": { + Type: schema.TypeString, + Optional: true, + Description: "Workflow ID.", + }, + + "owner_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Owner ID.", + }, + + "task_type_id": { + Type: schema.TypeInt, + Optional: true, + Description: "Task type.", + }, + + "status": { + Type: schema.TypeString, + Optional: true, + Description: "Task Status:\n* N: New\n* Y: Scheduling\n* F: Offline\n* O: Paused\n* T: Offlining\n* INVALID: Invalid.", + }, + + "submit": { + Type: schema.TypeBool, + Optional: true, + Description: "Submission status.", + }, + + "bundle_id": { + Type: schema.TypeString, + Optional: true, + Description: "Bundle id.", + }, + + "create_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Creator ID.", + }, + + "modify_time": { + Type: schema.TypeSet, + Optional: true, + Description: "Modification time range (yyyy-MM-dd HH:mm:ss). Two time values must be provided in the array.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + + "create_time": { + Type: schema.TypeSet, + Optional: true, + Description: "Creation time range (yyyy-MM-dd HH:MM:ss). Two time values must be provided in the array.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Describes the task pagination information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + "task_type_id": { + Type: schema.TypeInt, + Required: true, + Description: "Specifies the task type ID.\n\n* 21:JDBC SQL\n* 23:TDSQL-PostgreSQL\n* 26:OfflineSynchronization\n* 30:Python\n* 31:PySpark\n* 33:Impala\n* 34:Hive SQL\n* 35:Shell\n* 36:Spark SQL\n* 38:Shell Form Mode\n* 39:Spark\n* 40:TCHouse-P\n* 41:Kettle\n* 42:Tchouse-X\n* 43:TCHouse-X SQL\n* 46:DLC Spark\n* 47:TiOne\n* 48:Trino\n* 50:DLC PySpark\n* 92:MapReduce\n* 130:Branch Node\n* 131:Merged Node\n* 132:Notebook\n* 133:SSH\n* 134:StarRocks\n* 137:For-each\n* 138:Setats SQL.", + }, + "workflow_id": { + Type: schema.TypeString, + Required: true, + Description: "Workflow ID.", + }, + "task_name": { + Type: schema.TypeString, + Optional: true, + Description: "Task name.", + }, + "task_latest_version_no": { + Type: schema.TypeString, + Optional: true, + Description: "Last save version number.", + }, + "task_latest_submit_version_no": { + Type: schema.TypeString, + Optional: true, + Description: "Last submit version number.", + }, + "workflow_name": { + Type: schema.TypeString, + Optional: true, + Description: "Workflow name.", + }, + "status": { + Type: schema.TypeString, + Optional: true, + Description: "Task Status:\n\n* N: New\n* Y: Scheduling\n* F: Offline\n* O: Paused\n* T: Offlining (in the process of being taken offline)\n* INVALID: Invalid.", + }, + "submit": { + Type: schema.TypeBool, + Optional: true, + Description: "Latest submission status of the task. Specifies whether it has been submitted: true/false.", + }, + "create_time": { + Type: schema.TypeString, + Optional: true, + Description: "Task creation time. example: 2022-02-12 11:13:41.", + }, + "last_update_time": { + Type: schema.TypeString, + Optional: true, + Description: "Last update time. example: 2025-08-13 16:34:06.", + }, + "last_update_user_name": { + Type: schema.TypeString, + Optional: true, + Description: "Last Updated By (Name).", + }, + "last_ops_time": { + Type: schema.TypeString, + Optional: true, + Description: "Last operation time.", + }, + "last_ops_user_name": { + Type: schema.TypeString, + Optional: true, + Description: "Last operator name.", + }, + "owner_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Task owner ID.", + }, + "task_description": { + Type: schema.TypeString, + Optional: true, + Description: "Task description.", + }, + "update_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Last Updated User ID.", + }, + "create_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Created By User ID.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataTasksRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_tasks.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_name"); ok { + paramMap["TaskName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("workflow_id"); ok { + paramMap["WorkflowId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("owner_uin"); ok { + paramMap["OwnerUin"] = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("task_type_id"); ok { + paramMap["TaskTypeId"] = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("status"); ok { + paramMap["Status"] = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("submit"); ok { + paramMap["Submit"] = helper.Bool(v.(bool)) + } + + if v, ok := d.GetOk("bundle_id"); ok { + paramMap["BundleId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("create_user_uin"); ok { + paramMap["CreateUserUin"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("modify_time"); ok { + modifyTimeList := []*string{} + modifyTimeSet := v.(*schema.Set).List() + for i := range modifyTimeSet { + modifyTime := modifyTimeSet[i].(string) + modifyTimeList = append(modifyTimeList, helper.String(modifyTime)) + } + paramMap["ModifyTime"] = modifyTimeList + } + + if v, ok := d.GetOk("create_time"); ok { + createTimeList := []*string{} + createTimeSet := v.(*schema.Set).List() + for i := range createTimeSet { + createTime := createTimeSet[i].(string) + createTimeList = append(createTimeList, helper.String(createTime)) + } + paramMap["CreateTime"] = createTimeList + } + + var respData []*wedatav20250806.TaskBaseAttribute + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataTasksByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.TaskId != nil { + itemsMap["task_id"] = items.TaskId + ids = append(ids, *items.TaskId) + } + + if items.TaskTypeId != nil { + itemsMap["task_type_id"] = items.TaskTypeId + } + + if items.WorkflowId != nil { + itemsMap["workflow_id"] = items.WorkflowId + } + + if items.TaskName != nil { + itemsMap["task_name"] = items.TaskName + } + + if items.TaskLatestVersionNo != nil { + itemsMap["task_latest_version_no"] = items.TaskLatestVersionNo + } + + if items.TaskLatestSubmitVersionNo != nil { + itemsMap["task_latest_submit_version_no"] = items.TaskLatestSubmitVersionNo + } + + if items.WorkflowName != nil { + itemsMap["workflow_name"] = items.WorkflowName + } + + if items.Status != nil { + itemsMap["status"] = items.Status + } + + if items.Submit != nil { + itemsMap["submit"] = items.Submit + } + + if items.CreateTime != nil { + itemsMap["create_time"] = items.CreateTime + } + + if items.LastUpdateTime != nil { + itemsMap["last_update_time"] = items.LastUpdateTime + } + + if items.LastUpdateUserName != nil { + itemsMap["last_update_user_name"] = items.LastUpdateUserName + } + + if items.LastOpsTime != nil { + itemsMap["last_ops_time"] = items.LastOpsTime + } + + if items.LastOpsUserName != nil { + itemsMap["last_ops_user_name"] = items.LastOpsUserName + } + + if items.OwnerUin != nil { + itemsMap["owner_uin"] = items.OwnerUin + } + + if items.TaskDescription != nil { + itemsMap["task_description"] = items.TaskDescription + } + + if items.UpdateUserUin != nil { + itemsMap["update_user_uin"] = items.UpdateUserUin + } + + if items.CreateUserUin != nil { + itemsMap["create_user_uin"] = items.CreateUserUin + } + + itemsList = append(itemsList, itemsMap) + + } + + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_tasks.md b/tencentcloud/services/wedata/data_source_tc_wedata_tasks.md new file mode 100644 index 0000000000..8dc96b9823 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_tasks.md @@ -0,0 +1,9 @@ +Use this data source to query detailed information of wedata wedata_tasks + +Example Usage + +```hcl +data "tencentcloud_wedata_tasks" "wedata_tasks" { + project_id = 2905622749543821312 +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_tasks_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_tasks_test.go new file mode 100644 index 0000000000..cea49f670c --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_tasks_test.go @@ -0,0 +1,30 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataTasksDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataTasksDataSource, + Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_tasks.wedata_tasks")), + }}, + }) +} + +const testAccWedataTasksDataSource = ` + +data "tencentcloud_wedata_tasks" "wedata_tasks" { + project_id = 2905622749543821312 +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.go b/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.go new file mode 100644 index 0000000000..1112bc2243 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.go @@ -0,0 +1,255 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataUpstreamTasks() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataUpstreamTasksRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Upstream task details.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "task_id": { + Type: schema.TypeString, + Required: true, + Description: "Task ID.", + }, + "task_name": { + Type: schema.TypeString, + Required: true, + Description: "Task name.", + }, + "workflow_id": { + Type: schema.TypeString, + Required: true, + Description: "Workflow id.", + }, + "workflow_name": { + Type: schema.TypeString, + Required: true, + Description: "Workflow name.", + }, + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + "status": { + Type: schema.TypeString, + Required: true, + Description: "Task Status:\n\n* N: New\n\n* Y: Scheduling\n\n* F: Offline\n\n* O: Paused\n\n* T: Offlining (in the process of being taken offline)\n\nI* NVALID: Invalid.", + }, + "task_type_id": { + Type: schema.TypeInt, + Required: true, + Description: "Task type id.", + }, + "task_type_desc": { + Type: schema.TypeString, + Required: true, + Description: "Task type description.\n-20: universal data synchronization.\n - 25: ETLTaskType\n - 26: ETLTaskType\n - 30: python\n - 31: pyspark\n - 34: hivesql\n - 35: shell\n - 36: sparksql\n - 21: jdbcsql\n - 32: dlc\n - 33: ImpalaTaskType\n - 40: CDWTaskType\n - 41: kettle\n - 42: TCHouse-X\n - 43: TCHouse-X SQL\n - 46: dlcsparkTaskType\n - 47: TiOneMachineLearningTaskType\n - 48: Trino\n - 50: DLCPyspark\n - 23: TencentDistributedSQL\n - 39: spark\n - 92: MRTaskType\n - 38: ShellScript\n - 70: HiveSQLScrip\n-130: branch.\n-131: merge.\n-132: Notebook \n-133: SSH node.\n - 134: StarRocks\n - 137: For-each\n-10000: custom business common.", + }, + "schedule_desc": { + Type: schema.TypeString, + Required: true, + Description: "Specifies scheduling plan display description information.", + }, + "start_time": { + Type: schema.TypeString, + Required: true, + Description: "Task start time.", + }, + "end_time": { + Type: schema.TypeString, + Required: true, + Description: "Task end time.", + }, + "delay_time": { + Type: schema.TypeInt, + Required: true, + Description: "Delay time.", + }, + "cycle_type": { + Type: schema.TypeString, + Required: true, + Description: "Cycle Type, Default: D\nSupported types:\n* O: One-time\n\n* Y: Yearly\n\n* M: Monthly\n\n* W: Weekly\n\n* D: Daily\n\n* H: Hourly\n\n* I: Minute\n\n* C: Crontab expression type.", + }, + "owner_uin": { + Type: schema.TypeString, + Required: true, + Description: "Owner ID.", + }, + "task_action": { + Type: schema.TypeString, + Required: true, + Description: "Elastic cycle configuration.", + }, + "init_strategy": { + Type: schema.TypeString, + Required: true, + Description: "Initialization strategy for scheduling.", + }, + "crontab_expression": { + Type: schema.TypeString, + Required: true, + Description: "crontab expression.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataUpstreamTasksRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_upstream_tasks.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_id"); ok { + paramMap["TaskId"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.TaskDependDto + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataUpstreamTasksByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.TaskId != nil { + itemsMap["task_id"] = items.TaskId + ids = append(ids, *items.TaskId) + } + + if items.TaskName != nil { + itemsMap["task_name"] = items.TaskName + } + + if items.WorkflowId != nil { + itemsMap["workflow_id"] = items.WorkflowId + } + + if items.WorkflowName != nil { + itemsMap["workflow_name"] = items.WorkflowName + } + + if items.ProjectId != nil { + itemsMap["project_id"] = items.ProjectId + } + + if items.Status != nil { + itemsMap["status"] = items.Status + } + + if items.TaskTypeId != nil { + itemsMap["task_type_id"] = items.TaskTypeId + } + + if items.TaskTypeDesc != nil { + itemsMap["task_type_desc"] = items.TaskTypeDesc + } + + if items.ScheduleDesc != nil { + itemsMap["schedule_desc"] = items.ScheduleDesc + } + + if items.StartTime != nil { + itemsMap["start_time"] = items.StartTime + } + + if items.EndTime != nil { + itemsMap["end_time"] = items.EndTime + } + + if items.DelayTime != nil { + itemsMap["delay_time"] = items.DelayTime + } + + if items.CycleType != nil { + itemsMap["cycle_type"] = items.CycleType + } + + if items.OwnerUin != nil { + itemsMap["owner_uin"] = items.OwnerUin + } + + if items.TaskAction != nil { + itemsMap["task_action"] = items.TaskAction + } + + if items.InitStrategy != nil { + itemsMap["init_strategy"] = items.InitStrategy + } + + if items.CrontabExpression != nil { + itemsMap["crontab_expression"] = items.CrontabExpression + } + + itemsList = append(itemsList, itemsMap) + } + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.md b/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.md new file mode 100644 index 0000000000..395247cef3 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_upstream_tasks + +Example Usage + +```hcl +data "tencentcloud_wedata_upstream_tasks" "wedata_upstream_tasks" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks_test.go new file mode 100644 index 0000000000..ca71ee8fcb --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_upstream_tasks_test.go @@ -0,0 +1,31 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataUpstreamTasksDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataUpstreamTasksDataSource, + Check: resource.ComposeTestCheckFunc(tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_upstream_tasks.wedata_upstream_tasks")), + }}, + }) +} + +const testAccWedataUpstreamTasksDataSource = ` + +data "tencentcloud_wedata_upstream_tasks" "wedata_upstream_tasks" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.go b/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.go new file mode 100644 index 0000000000..4e92d8d579 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.go @@ -0,0 +1,138 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataWorkflowFolders() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataWorkflowFoldersRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "parent_folder_path": { + Type: schema.TypeString, + Required: true, + Description: "Parent folder absolute path, for example /abc/de, if it is root directory, pass /.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Paginated folder query result.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + "folder_id": { + Type: schema.TypeString, + Required: true, + Description: "Folder ID.", + }, + "folder_path": { + Type: schema.TypeString, + Required: true, + Description: "Specifies the absolute path of the folder.", + }, + "create_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Creator ID.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataWorkflowFoldersRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_workflow_folders.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("parent_folder_path"); ok { + paramMap["ParentFolderPath"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.WorkflowFolder + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataWorkflowFoldersByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.ProjectId != nil { + itemsMap["project_id"] = items.ProjectId + } + + if items.FolderId != nil { + itemsMap["folder_id"] = items.FolderId + ids = append(ids, *items.FolderId) + } + + if items.FolderPath != nil { + itemsMap["folder_path"] = items.FolderPath + } + + if items.CreateUserUin != nil { + itemsMap["create_user_uin"] = items.CreateUserUin + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.md b/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.md new file mode 100644 index 0000000000..7e4cf7e676 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_workflow_folders + +Example Usage + +```hcl +data "tencentcloud_wedata_workflow_folders" "wedata_workflow_folders" { + project_id = "2905622749543821312" + parent_folder_path = "/" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders_test.go new file mode 100644 index 0000000000..b3ab5ad460 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_workflow_folders_test.go @@ -0,0 +1,33 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataWorkflowFoldersDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataWorkflowFoldersDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_workflow_folders.wedata_workflow_folders"), + resource.TestCheckResourceAttrSet("data.tencentcloud_wedata_workflow_folders.wedata_workflow_folders", "data.#"), + ), + }}, + }) +} + +const testAccWedataWorkflowFoldersDataSource = ` +data "tencentcloud_wedata_workflow_folders" "wedata_workflow_folders" { + project_id = "2905622749543821312" + parent_folder_path = "/" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_workflows.go b/tencentcloud/services/wedata/data_source_tc_wedata_workflows.go new file mode 100644 index 0000000000..a7cc3edbfb --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_workflows.go @@ -0,0 +1,271 @@ +package wedata + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func DataSourceTencentCloudWedataWorkflows() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataWorkflowsRead, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + Description: "Project ID.", + }, + + "keyword": { + Type: schema.TypeString, + Optional: true, + Description: "Search keywords.", + }, + + "parent_folder_path": { + Type: schema.TypeString, + Optional: true, + Description: "Workflow folder.", + }, + + "workflow_type": { + Type: schema.TypeString, + Optional: true, + Description: "Workflow type. valid values: cycle and manual.", + }, + + "bundle_id": { + Type: schema.TypeString, + Optional: true, + Description: "bundleId item.", + }, + + "owner_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Owner ID.", + }, + + "create_user_uin": { + Type: schema.TypeString, + Optional: true, + Description: "Creator ID.", + }, + + "modify_time": { + Type: schema.TypeSet, + Optional: true, + Description: "Modification time interval yyyy-MM-dd HH:MM:ss. fill in two times in the array.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + + "create_time": { + Type: schema.TypeSet, + Optional: true, + Description: "Creation time range yyyy-MM-dd HH:MM:ss. two times must be filled in the array.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Describes workflow pagination information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "workflow_id": { + Type: schema.TypeString, + Required: true, + Description: "Workflow ID.", + }, + "workflow_name": { + Type: schema.TypeString, + Required: true, + Description: "Workflow name.", + }, + "workflow_type": { + Type: schema.TypeString, + Required: true, + Description: "Workflow type: cycle or manual.", + }, + "owner_uin": { + Type: schema.TypeString, + Required: true, + Description: "Owner ID.", + }, + "create_time": { + Type: schema.TypeString, + Required: true, + Description: "Creation time.", + }, + "modify_time": { + Type: schema.TypeString, + Required: true, + Description: "Last Modification Time.", + }, + "update_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Last updated user ID.", + }, + "workflow_desc": { + Type: schema.TypeString, + Required: true, + Description: "Workflow description.", + }, + "create_user_uin": { + Type: schema.TypeString, + Required: true, + Description: "Creator ID.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataWorkflowsRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_workflows.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(nil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("project_id"); ok { + paramMap["ProjectId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("keyword"); ok { + paramMap["Keyword"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("parent_folder_path"); ok { + paramMap["ParentFolderPath"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("workflow_type"); ok { + paramMap["WorkflowType"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("bundle_id"); ok { + paramMap["BundleId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("owner_uin"); ok { + paramMap["OwnerUin"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("create_user_uin"); ok { + paramMap["CreateUserUin"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("modify_time"); ok { + modifyTimeList := []*string{} + modifyTimeSet := v.(*schema.Set).List() + for i := range modifyTimeSet { + modifyTime := modifyTimeSet[i].(string) + modifyTimeList = append(modifyTimeList, helper.String(modifyTime)) + } + paramMap["ModifyTime"] = modifyTimeList + } + + if v, ok := d.GetOk("create_time"); ok { + createTimeList := []*string{} + createTimeSet := v.(*schema.Set).List() + for i := range createTimeSet { + createTime := createTimeSet[i].(string) + createTimeList = append(createTimeList, helper.String(createTime)) + } + paramMap["CreateTime"] = createTimeList + } + + var respData []*wedatav20250806.WorkflowInfo + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataWorkflowsByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + respData = result + return nil + }) + if err != nil { + return err + } + + ids := make([]string, 0, len(respData)) + itemsList := make([]map[string]interface{}, 0, len(respData)) + + for _, items := range respData { + itemsMap := map[string]interface{}{} + + if items.WorkflowId != nil { + itemsMap["workflow_id"] = items.WorkflowId + ids = append(ids, *items.WorkflowId) + } + + if items.WorkflowName != nil { + itemsMap["workflow_name"] = items.WorkflowName + } + + if items.WorkflowType != nil { + itemsMap["workflow_type"] = items.WorkflowType + } + + if items.OwnerUin != nil { + itemsMap["owner_uin"] = items.OwnerUin + } + + if items.CreateTime != nil { + itemsMap["create_time"] = items.CreateTime + } + + if items.ModifyTime != nil { + itemsMap["modify_time"] = items.ModifyTime + } + + if items.UpdateUserUin != nil { + itemsMap["update_user_uin"] = items.UpdateUserUin + } + + if items.WorkflowDesc != nil { + itemsMap["workflow_desc"] = items.WorkflowDesc + } + + if items.CreateUserUin != nil { + itemsMap["create_user_uin"] = items.CreateUserUin + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("data", itemsList) + + d.SetId(helper.DataResourceIdsHash(ids)) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), itemsList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_workflows.md b/tencentcloud/services/wedata/data_source_tc_wedata_workflows.md new file mode 100644 index 0000000000..612890ada1 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_workflows.md @@ -0,0 +1,10 @@ +Use this data source to query detailed information of wedata wedata_workflows + +Example Usage + +```hcl +data "tencentcloud_wedata_workflows" "wedata_workflows" { + project_id = 2905622749543821312 + keyword = "test_workflow" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_workflows_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_workflows_test.go new file mode 100644 index 0000000000..dcbc79ddf7 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_workflows_test.go @@ -0,0 +1,33 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataWorkflowsDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataWorkflowsDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_workflows.wedata_workflows"), + resource.TestCheckResourceAttrSet("data.tencentcloud_wedata_workflows.wedata_workflows", "data.#"), + ), + }}, + }) +} + +const testAccWedataWorkflowsDataSource = ` +data "tencentcloud_wedata_workflows" "wedata_workflows" { + project_id = 2905622749543821312 + keyword = "test_workflow" +} +` diff --git a/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.go b/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.go new file mode 100644 index 0000000000..1b27f8e6af --- /dev/null +++ b/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.go @@ -0,0 +1,124 @@ +package wedata + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + wedatav20250806 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wedata/v20250806" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudWedataSubmitTaskOperation() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudWedataSubmitTaskOperationCreate, + Read: resourceTencentCloudWedataSubmitTaskOperationRead, + Delete: resourceTencentCloudWedataSubmitTaskOperationDelete, + Schema: map[string]*schema.Schema{ + "project_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Project ID.", + }, + + "task_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Task ID.", + }, + + "version_remark": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Version remarks.", + }, + "status": { + Type: schema.TypeBool, + Computed: true, + Description: "Status.", + }, + "version_id": { + Type: schema.TypeString, + Computed: true, + Description: "Version id.", + }, + }, + } +} + +func resourceTencentCloudWedataSubmitTaskOperationCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_wedata_submit_task_operation.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + var ( + projectId string + taskId string + ) + var ( + request = wedatav20250806.NewSubmitTaskRequest() + response = wedatav20250806.NewSubmitTaskResponse() + ) + + if v, ok := d.GetOk("project_id"); ok { + request.ProjectId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("task_id"); ok { + request.TaskId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("version_remark"); ok { + request.VersionRemark = helper.String(v.(string)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseWedataV20250806Client().SubmitTaskWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s create wedata submit task operation failed, reason:%+v", logId, err) + return err + } + + if response != nil && response.Response != nil && response.Response.Data != nil { + if response.Response.Data.Status != nil { + _ = d.Set("status", response.Response.Data.Status) + } + _ = d.Set("version_id", response.Response.Data.VersionId) + } + + d.SetId(strings.Join([]string{projectId, taskId}, tccommon.FILED_SP)) + + return resourceTencentCloudWedataSubmitTaskOperationRead(d, meta) +} + +func resourceTencentCloudWedataSubmitTaskOperationRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_wedata_submit_task_operation.read")() + defer tccommon.InconsistentCheck(d, meta)() + + return nil +} + +func resourceTencentCloudWedataSubmitTaskOperationDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_wedata_submit_task_operation.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.md b/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.md new file mode 100644 index 0000000000..9c1f88cfde --- /dev/null +++ b/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation.md @@ -0,0 +1,11 @@ +Provides a resource to create a wedata wedata_submit_task_operation + +Example Usage + +```hcl +resource "tencentcloud_wedata_submit_task_operation" "wedata_submit_task_operation" { + project_id = "2905622749543821312" + task_id = "20251015164958429" + version_remark = "v1" +} +``` diff --git a/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation_test.go b/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation_test.go new file mode 100644 index 0000000000..7cff7b397e --- /dev/null +++ b/tencentcloud/services/wedata/resource_tc_wedata_submit_task_operation_test.go @@ -0,0 +1,32 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataSubmitTaskOperationResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataSubmitTaskOperation, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_wedata_submit_task_operation.wedata_submit_task_operation", "id")), + }}, + }) +} + +const testAccWedataSubmitTaskOperation = ` + +resource "tencentcloud_wedata_submit_task_operation" "wedata_submit_task_operation" { + project_id = "2905622749543821312" + task_id = "20251015164958429" + version_remark = "v1" +} +` diff --git a/tencentcloud/services/wedata/service_tencentcloud_wedata.go b/tencentcloud/services/wedata/service_tencentcloud_wedata.go index 9b1323036f..a4d132eb6e 100644 --- a/tencentcloud/services/wedata/service_tencentcloud_wedata.go +++ b/tencentcloud/services/wedata/service_tencentcloud_wedata.go @@ -1363,3 +1363,503 @@ func (me *WedataService) DeleteWedataIntegrationTaskNodeById(ctx context.Context return } + +func (me *WedataService) DescribeWedataResourceFilesByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.ResourceFileItem, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListResourceFilesRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "ResourceName" { + request.ResourceName = v.(*string) + } + if k == "ParentFolderPath" { + request.ParentFolderPath = v.(*string) + } + if k == "CreateUserUin" { + request.CreateUserUin = v.(*string) + } + if k == "ModifyTimeStart" { + request.ModifyTimeStart = v.(*string) + } + if k == "ModifyTimeEnd" { + request.ModifyTimeEnd = v.(*string) + } + if k == "CreateTimeStart" { + request.CreateTimeStart = v.(*string) + } + if k == "CreateTimeEnd" { + request.CreateTimeEnd = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber uint64 = 1 + pageSize uint64 = 100 + ) + for { + request.PageNumber = helper.Uint64(pageNumber) + request.PageSize = helper.Uint64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListResourceFiles(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + + return +} + +func (me *WedataService) DescribeWedataWorkflowFoldersByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.WorkflowFolder, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListWorkflowFoldersRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "ParentFolderPath" { + request.ParentFolderPath = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber uint64 = 1 + pageSize uint64 = 100 + ) + + for { + request.PageNumber = helper.Uint64(pageNumber) + request.PageSize = helper.Uint64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListWorkflowFolders(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + + return +} + +func (me *WedataService) DescribeWedataWorkflowsByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.WorkflowInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListWorkflowsRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "Keyword" { + request.Keyword = v.(*string) + } + if k == "ParentFolderPath" { + request.ParentFolderPath = v.(*string) + } + if k == "WorkflowType" { + request.WorkflowType = v.(*string) + } + if k == "BundleId" { + request.BundleId = v.(*string) + } + if k == "OwnerUin" { + request.OwnerUin = v.(*string) + } + if k == "CreateUserUin" { + request.CreateUserUin = v.(*string) + } + if k == "ModifyTime" { + request.ModifyTime = v.([]*string) + } + if k == "CreateTime" { + request.CreateTime = v.([]*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber int64 = 1 + pageSize int64 = 100 + ) + + for { + request.PageNumber = helper.Int64(pageNumber) + request.PageSize = helper.Int64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListWorkflows(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + return +} + +func (me *WedataService) DescribeWedataTasksByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.TaskBaseAttribute, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListTasksRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "TaskName" { + request.TaskName = v.(*string) + } + if k == "WorkflowId" { + request.WorkflowId = v.(*string) + } + if k == "OwnerUin" { + request.OwnerUin = v.(*string) + } + if k == "TaskTypeId" { + request.TaskTypeId = v.(*int64) + } + if k == "Status" { + request.Status = v.(*string) + } + if k == "Submit" { + request.Submit = v.(*bool) + } + if k == "BundleId" { + request.BundleId = v.(*string) + } + if k == "CreateUserUin" { + request.CreateUserUin = v.(*string) + } + if k == "ModifyTime" { + request.ModifyTime = v.([]*string) + } + if k == "CreateTime" { + request.CreateTime = v.([]*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber int64 = 1 + pageSize int64 = 100 + ) + + for { + request.PageNumber = helper.Int64(pageNumber) + request.PageSize = helper.Int64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListTasks(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + + return +} + +func (me *WedataService) DescribeWedataTaskVersionsByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.TaskVersion, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListTaskVersionsRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "TaskId" { + request.TaskId = v.(*string) + } + if k == "TaskVersionType" { + request.TaskVersionType = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber uint64 = 1 + pageSize uint64 = 100 + ) + + for { + request.PageNumber = helper.Uint64(pageNumber) + request.PageSize = helper.Uint64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListTaskVersions(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + + return +} + +func (me *WedataService) DescribeWedataUpstreamTasksByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.TaskDependDto, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListUpstreamTasksRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "TaskId" { + request.TaskId = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber uint64 = 1 + pageSize uint64 = 100 + ) + + for { + request.PageNumber = helper.Uint64(pageNumber) + request.PageSize = helper.Uint64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListUpstreamTasks(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + + return +} + +func (me *WedataService) DescribeWedataDownstreamTasksByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.TaskDependDto, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListDownstreamTasksRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "TaskId" { + request.TaskId = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + var ( + pageNumber uint64 = 1 + pageSize uint64 = 100 + ) + + for { + request.PageNumber = helper.Uint64(pageNumber) + request.PageSize = helper.Uint64(pageSize) + response, err := me.client.UseWedataV20250806Client().ListDownstreamTasks(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil || response.Response.Data == nil { + break + } + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + } + + return +} + +func (me *WedataService) DescribeWedataTaskCodeByFilter(ctx context.Context, param map[string]interface{}) (ret *wedatav20250806.TaskCodeResult, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewGetTaskCodeRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "TaskId" { + request.TaskId = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + response, err := me.client.UseWedataV20250806Client().GetTaskCode(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil { + return + } + + ret = response.Response.Data + return +} + +func (me *WedataService) DescribeWedataTaskVersionByFilter(ctx context.Context, param map[string]interface{}) (ret *wedatav20250806.GetTaskVersionResponseParams, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewGetTaskVersionRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + for k, v := range param { + if k == "ProjectId" { + request.ProjectId = v.(*string) + } + if k == "TaskId" { + request.TaskId = v.(*string) + } + if k == "VersionId" { + request.VersionId = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + + response, err := me.client.UseWedataV20250806Client().GetTaskVersion(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || response.Response == nil { + return + } + + ret = response.Response + return +} + +func NewWedataService(client *connectivity.TencentCloudClient) WedataService { + return WedataService{client: client} +} diff --git a/website/docs/d/wedata_downstream_tasks.html.markdown b/website/docs/d/wedata_downstream_tasks.html.markdown new file mode 100644 index 0000000000..f58aeb4bc2 --- /dev/null +++ b/website/docs/d/wedata_downstream_tasks.html.markdown @@ -0,0 +1,37 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_downstream_tasks" +sidebar_current: "docs-tencentcloud-datasource-wedata_downstream_tasks" +description: |- + Use this data source to query detailed information of wedata wedata_downstream_tasks +--- + +# tencentcloud_wedata_downstream_tasks + +Use this data source to query detailed information of wedata wedata_downstream_tasks + +## Example Usage + +```hcl +data "tencentcloud_wedata_downstream_tasks" "wedata_downstream_tasks" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `task_id` - (Required, String) Task ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Describes the downstream dependency details. + + diff --git a/website/docs/d/wedata_resource_files.html.markdown b/website/docs/d/wedata_resource_files.html.markdown new file mode 100644 index 0000000000..0cac5a7e3b --- /dev/null +++ b/website/docs/d/wedata_resource_files.html.markdown @@ -0,0 +1,43 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_resource_files" +sidebar_current: "docs-tencentcloud-datasource-wedata_resource_files" +description: |- + Use this data source to query detailed information of wedata wedata_resource_files +--- + +# tencentcloud_wedata_resource_files + +Use this data source to query detailed information of wedata wedata_resource_files + +## Example Usage + +```hcl +data "tencentcloud_wedata_resource_files" "wedata_resource_files" { + project_id = 2905622749543821312 + resource_name = "tftest.txt" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `create_time_end` - (Optional, String) Create time range. specifies the termination time in yyyy-MM-dd HH:MM:ss format. +* `create_time_start` - (Optional, String) Create time range. specifies the start time in yyyy-MM-dd HH:MM:ss format. +* `create_user_uin` - (Optional, String) Creator ID. obtain through the DescribeCurrentUserInfo API. +* `modify_time_end` - (Optional, String) Update time range. specifies the end time in yyyy-MM-dd HH:MM:ss format. +* `modify_time_start` - (Optional, String) Update time range. specifies the start time in yyyy-MM-dd HH:MM:ss format. +* `parent_folder_path` - (Optional, String) Specifies the path of the file's parent folder (for example /a/b/c, querying resource files under the folder c). +* `resource_name` - (Optional, String) Resource file name (fuzzy search keyword). +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Retrieve the resource file list. + + diff --git a/website/docs/d/wedata_task_code.html.markdown b/website/docs/d/wedata_task_code.html.markdown new file mode 100644 index 0000000000..25419727d8 --- /dev/null +++ b/website/docs/d/wedata_task_code.html.markdown @@ -0,0 +1,37 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_task_code" +sidebar_current: "docs-tencentcloud-datasource-wedata_task_code" +description: |- + Use this data source to query detailed information of wedata wedata_task_code +--- + +# tencentcloud_wedata_task_code + +Use this data source to query detailed information of wedata wedata_task_code + +## Example Usage + +```hcl +data "tencentcloud_wedata_task_code" "wedata_task_code" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) The project id. +* `task_id` - (Required, String) Task ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Retrieves the task code result. + + diff --git a/website/docs/d/wedata_task_version.html.markdown b/website/docs/d/wedata_task_version.html.markdown new file mode 100644 index 0000000000..3bacdd6c88 --- /dev/null +++ b/website/docs/d/wedata_task_version.html.markdown @@ -0,0 +1,38 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_task_version" +sidebar_current: "docs-tencentcloud-datasource-wedata_task_version" +description: |- + Use this data source to query detailed information of wedata wedata_task_version +--- + +# tencentcloud_wedata_task_version + +Use this data source to query detailed information of wedata wedata_task_version + +## Example Usage + +```hcl +data "tencentcloud_wedata_task_version" "wedata_task_version" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `task_id` - (Required, String) Task ID. +* `result_output_file` - (Optional, String) Used to save results. +* `version_id` - (Optional, String) Submit version ID. If not specified, the latest submit version will be used by default. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Version detail. + + diff --git a/website/docs/d/wedata_task_versions.html.markdown b/website/docs/d/wedata_task_versions.html.markdown new file mode 100644 index 0000000000..8b4ffe9f22 --- /dev/null +++ b/website/docs/d/wedata_task_versions.html.markdown @@ -0,0 +1,40 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_task_versions" +sidebar_current: "docs-tencentcloud-datasource-wedata_task_versions" +description: |- + Use this data source to query detailed information of wedata wedata_task_versions +--- + +# tencentcloud_wedata_task_versions + +Use this data source to query detailed information of wedata wedata_task_versions + +## Example Usage + +```hcl +data "tencentcloud_wedata_task_versions" "wedata_task_versions" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `task_id` - (Required, String) Task ID. +* `result_output_file` - (Optional, String) Used to save results. +* `task_version_type` - (Optional, String) SAVE version. +SUBMIT version. +Defaults to SAVE. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Task version list. + + diff --git a/website/docs/d/wedata_tasks.html.markdown b/website/docs/d/wedata_tasks.html.markdown new file mode 100644 index 0000000000..7bb582a9c4 --- /dev/null +++ b/website/docs/d/wedata_tasks.html.markdown @@ -0,0 +1,51 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_tasks" +sidebar_current: "docs-tencentcloud-datasource-wedata_tasks" +description: |- + Use this data source to query detailed information of wedata wedata_tasks +--- + +# tencentcloud_wedata_tasks + +Use this data source to query detailed information of wedata wedata_tasks + +## Example Usage + +```hcl +data "tencentcloud_wedata_tasks" "wedata_tasks" { + project_id = 2905622749543821312 +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `bundle_id` - (Optional, String) Bundle id. +* `create_time` - (Optional, Set: [`String`]) Creation time range (yyyy-MM-dd HH:MM:ss). Two time values must be provided in the array. +* `create_user_uin` - (Optional, String) Creator ID. +* `modify_time` - (Optional, Set: [`String`]) Modification time range (yyyy-MM-dd HH:mm:ss). Two time values must be provided in the array. +* `owner_uin` - (Optional, String) Owner ID. +* `result_output_file` - (Optional, String) Used to save results. +* `status` - (Optional, String) Task Status: +* N: New +* Y: Scheduling +* F: Offline +* O: Paused +* T: Offlining +* INVALID: Invalid. +* `submit` - (Optional, Bool) Submission status. +* `task_name` - (Optional, String) Task name. +* `task_type_id` - (Optional, Int) Task type. +* `workflow_id` - (Optional, String) Workflow ID. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Describes the task pagination information. + + diff --git a/website/docs/d/wedata_upstream_tasks.html.markdown b/website/docs/d/wedata_upstream_tasks.html.markdown new file mode 100644 index 0000000000..f55bbed6a8 --- /dev/null +++ b/website/docs/d/wedata_upstream_tasks.html.markdown @@ -0,0 +1,37 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_upstream_tasks" +sidebar_current: "docs-tencentcloud-datasource-wedata_upstream_tasks" +description: |- + Use this data source to query detailed information of wedata wedata_upstream_tasks +--- + +# tencentcloud_wedata_upstream_tasks + +Use this data source to query detailed information of wedata wedata_upstream_tasks + +## Example Usage + +```hcl +data "tencentcloud_wedata_upstream_tasks" "wedata_upstream_tasks" { + project_id = "2905622749543821312" + task_id = "20251015164958429" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `task_id` - (Required, String) Task ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Upstream task details. + + diff --git a/website/docs/d/wedata_workflow_folders.html.markdown b/website/docs/d/wedata_workflow_folders.html.markdown new file mode 100644 index 0000000000..47bcebcb13 --- /dev/null +++ b/website/docs/d/wedata_workflow_folders.html.markdown @@ -0,0 +1,37 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_workflow_folders" +sidebar_current: "docs-tencentcloud-datasource-wedata_workflow_folders" +description: |- + Use this data source to query detailed information of wedata wedata_workflow_folders +--- + +# tencentcloud_wedata_workflow_folders + +Use this data source to query detailed information of wedata wedata_workflow_folders + +## Example Usage + +```hcl +data "tencentcloud_wedata_workflow_folders" "wedata_workflow_folders" { + project_id = "2905622749543821312" + parent_folder_path = "/" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `parent_folder_path` - (Required, String) Parent folder absolute path, for example /abc/de, if it is root directory, pass /. +* `project_id` - (Required, String) Project ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Paginated folder query result. + + diff --git a/website/docs/d/wedata_workflows.html.markdown b/website/docs/d/wedata_workflows.html.markdown new file mode 100644 index 0000000000..4a48195ead --- /dev/null +++ b/website/docs/d/wedata_workflows.html.markdown @@ -0,0 +1,44 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_workflows" +sidebar_current: "docs-tencentcloud-datasource-wedata_workflows" +description: |- + Use this data source to query detailed information of wedata wedata_workflows +--- + +# tencentcloud_wedata_workflows + +Use this data source to query detailed information of wedata wedata_workflows + +## Example Usage + +```hcl +data "tencentcloud_wedata_workflows" "wedata_workflows" { + project_id = 2905622749543821312 + keyword = "test_workflow" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String) Project ID. +* `bundle_id` - (Optional, String) bundleId item. +* `create_time` - (Optional, Set: [`String`]) Creation time range yyyy-MM-dd HH:MM:ss. two times must be filled in the array. +* `create_user_uin` - (Optional, String) Creator ID. +* `keyword` - (Optional, String) Search keywords. +* `modify_time` - (Optional, Set: [`String`]) Modification time interval yyyy-MM-dd HH:MM:ss. fill in two times in the array. +* `owner_uin` - (Optional, String) Owner ID. +* `parent_folder_path` - (Optional, String) Workflow folder. +* `result_output_file` - (Optional, String) Used to save results. +* `workflow_type` - (Optional, String) Workflow type. valid values: cycle and manual. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Describes workflow pagination information. + + diff --git a/website/docs/r/wedata_submit_task_operation.html.markdown b/website/docs/r/wedata_submit_task_operation.html.markdown new file mode 100644 index 0000000000..141f3310ab --- /dev/null +++ b/website/docs/r/wedata_submit_task_operation.html.markdown @@ -0,0 +1,40 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_submit_task_operation" +sidebar_current: "docs-tencentcloud-resource-wedata_submit_task_operation" +description: |- + Provides a resource to create a wedata wedata_submit_task_operation +--- + +# tencentcloud_wedata_submit_task_operation + +Provides a resource to create a wedata wedata_submit_task_operation + +## Example Usage + +```hcl +resource "tencentcloud_wedata_submit_task_operation" "wedata_submit_task_operation" { + project_id = "2905622749543821312" + task_id = "20251015164958429" + version_remark = "v1" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_id` - (Required, String, ForceNew) Project ID. +* `task_id` - (Required, String, ForceNew) Task ID. +* `version_remark` - (Required, String, ForceNew) Version remarks. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `status` - Status. +* `version_id` - Version id. + + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index 157d1340d6..b889eb0cd9 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -7015,6 +7015,9 @@
  • tencentcloud_wedata_downstream_task_instances
  • +
  • + tencentcloud_wedata_downstream_tasks +
  • tencentcloud_wedata_ops_alarm_rules
  • @@ -7024,9 +7027,15 @@
  • tencentcloud_wedata_ops_workflows
  • +
  • + tencentcloud_wedata_resource_files +
  • tencentcloud_wedata_rule_templates
  • +
  • + tencentcloud_wedata_task_code +
  • tencentcloud_wedata_task_instance
  • @@ -7039,9 +7048,27 @@
  • tencentcloud_wedata_task_instances
  • +
  • + tencentcloud_wedata_task_version +
  • +
  • + tencentcloud_wedata_task_versions +
  • +
  • + tencentcloud_wedata_tasks +
  • tencentcloud_wedata_upstream_task_instances
  • +
  • + tencentcloud_wedata_upstream_tasks +
  • +
  • + tencentcloud_wedata_workflow_folders +
  • +
  • + tencentcloud_wedata_workflows +
  • @@ -7080,6 +7107,9 @@
  • tencentcloud_wedata_script
  • +
  • + tencentcloud_wedata_submit_task_operation +
  • tencentcloud_wedata_task_kill_instance_async
  • From f508e79eb406adc66930649d0b72a1a25678661e Mon Sep 17 00:00:00 2001 From: mikatong Date: Wed, 15 Oct 2025 18:06:04 +0800 Subject: [PATCH 2/3] add changelog --- .changelog/3552.txt | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .changelog/3552.txt diff --git a/.changelog/3552.txt b/.changelog/3552.txt new file mode 100644 index 0000000000..79b8535c6f --- /dev/null +++ b/.changelog/3552.txt @@ -0,0 +1,39 @@ +```release-note:new-data-source +tencentcloud_wedata_resource_files +``` + +```release-note:new-data-source +tencentcloud_wedata_workflow_folders +``` + +```release-note:new-data-source +tencentcloud_wedata_workflows +``` + +```release-note:new-data-source +tencentcloud_wedata_tasks +``` + +```release-note:new-data-source +tencentcloud_wedata_task_versions +``` + +```release-note:new-data-source +tencentcloud_wedata_upstream_tasks +``` + +```release-note:new-data-source +tencentcloud_wedata_downstream_tasks +``` + +```release-note:new-data-source +tencentcloud_wedata_task_code +``` + +```release-note:new-data-source +tencentcloud_wedata_task_version +``` + +```release-note:new-resource +tencentcloud_wedata_submit_task_operation +``` From e5dc548336dc70b3ea9ae59fa080d96b0e516491 Mon Sep 17 00:00:00 2001 From: mikatong Date: Wed, 15 Oct 2025 18:09:58 +0800 Subject: [PATCH 3/3] update --- ...resource_tc_cls_cloud_product_log_task_extension.go | 10 +++++----- .../wedata/data_source_tc_wedata_task_version.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tencentcloud/services/cls/resource_tc_cls_cloud_product_log_task_extension.go b/tencentcloud/services/cls/resource_tc_cls_cloud_product_log_task_extension.go index 25e28e6005..097f48e741 100644 --- a/tencentcloud/services/cls/resource_tc_cls_cloud_product_log_task_extension.go +++ b/tencentcloud/services/cls/resource_tc_cls_cloud_product_log_task_extension.go @@ -29,15 +29,15 @@ func resourceTencentCloudClsCloudProductLogTaskReadPreRequest0(ctx context.Conte logType := idSplit[2] req.Filters = []*clsv20201016.Filter{ - &clsv20201016.Filter{ + { Key: common.StringPtr("instanceId"), Values: common.StringPtrs([]string{instanceId}), }, - &clsv20201016.Filter{ + { Key: common.StringPtr("assumerName"), Values: common.StringPtrs([]string{assumerName}), }, - &clsv20201016.Filter{ + { Key: common.StringPtr("logType"), Values: common.StringPtrs([]string{logType}), }, @@ -87,7 +87,7 @@ func resourceTencentCloudClsCloudProductLogTaskReadPreHandleResponse0(ctx contex logsetRequest := clsv20201016.NewDescribeLogsetsRequest() logsetResponse := clsv20201016.NewDescribeLogsetsResponse() logsetRequest.Filters = []*clsv20201016.Filter{ - &clsv20201016.Filter{ + { Key: common.StringPtr("logsetId"), Values: common.StringPtrs([]string{logsetId}), }, @@ -128,7 +128,7 @@ func resourceTencentCloudClsCloudProductLogTaskReadPreHandleResponse0(ctx contex topicRequest := clsv20201016.NewDescribeTopicsRequest() topicResponse := clsv20201016.NewDescribeTopicsResponse() topicRequest.Filters = []*clsv20201016.Filter{ - &clsv20201016.Filter{ + { Key: common.StringPtr("topicId"), Values: common.StringPtrs([]string{topicId}), }, diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go b/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go index 16621682c2..b54ef46ecc 100644 --- a/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go +++ b/tencentcloud/services/wedata/data_source_tc_wedata_task_version.go @@ -689,9 +689,9 @@ func dataSourceTencentCloudWedataTaskVersionRead(d *schema.ResourceData, meta in var ( projectId string - taskId string + taskId string ) - + service := WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} paramMap := make(map[string]interface{}) @@ -1238,7 +1238,7 @@ func dataSourceTencentCloudWedataTaskVersionRead(d *schema.ResourceData, meta in _ = d.Set("data", []interface{}{dataMap}) } - d.SetId(projectId+tccommon.FILED_SP+ taskId) + d.SetId(projectId + tccommon.FILED_SP + taskId) output, ok := d.GetOk("result_output_file") if ok && output.(string) != "" {