diff --git a/.changelog/3570.txt b/.changelog/3570.txt new file mode 100644 index 0000000000..20b61ed716 --- /dev/null +++ b/.changelog/3570.txt @@ -0,0 +1,35 @@ +```release-note:new-data-source +tencentcloud_wedata_list_lineage +``` + +```release-note:new-data-source +tencentcloud_wedata_list_process_lineage +``` + +```release-note:new-data-source +tencentcloud_wedata_list_column_lineage +``` + +```release-note:new-data-source +tencentcloud_wedata_list_catalog +``` + +```release-note:new-data-source +tencentcloud_wedata_list_database +``` + +```release-note:new-data-source +tencentcloud_wedata_list_schema +``` + +```release-note:new-data-source +tencentcloud_wedata_list_table +``` + +```release-note:new-data-source +tencentcloud_wedata_get_table +``` + +```release-note:new-data-source +tencentcloud_wedata_get_table_columns +``` \ No newline at end of file diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index cf38215aa1..0ee049fe6e 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -1193,6 +1193,15 @@ func Provider() *schema.Provider { "tencentcloud_wedata_project_roles": wedata.DataSourceTencentCloudWedataProjectRoles(), "tencentcloud_wedata_tenant_roles": wedata.DataSourceTencentCloudWedataTenantRoles(), "tencentcloud_wedata_resource_group_metrics": wedata.DataSourceTencentCloudWedataResourceGroupMetrics(), + "tencentcloud_wedata_list_lineage": wedata.DataSourceTencentCloudWedataListLineage(), + "tencentcloud_wedata_list_process_lineage": wedata.DataSourceTencentCloudWedataListProcessLineage(), + "tencentcloud_wedata_list_column_lineage": wedata.DataSourceTencentCloudWedataListColumnLineage(), + "tencentcloud_wedata_list_catalog": wedata.DataSourceTencentCloudWedataListCatalog(), + "tencentcloud_wedata_list_database": wedata.DataSourceTencentCloudWedataListDatabase(), + "tencentcloud_wedata_list_schema": wedata.DataSourceTencentCloudWedataListSchema(), + "tencentcloud_wedata_list_table": wedata.DataSourceTencentCloudWedataListTable(), + "tencentcloud_wedata_get_table": wedata.DataSourceTencentCloudWedataGetTable(), + "tencentcloud_wedata_get_table_columns": wedata.DataSourceTencentCloudWedataGetTableColumns(), "tencentcloud_private_dns_records": privatedns.DataSourceTencentCloudPrivateDnsRecords(), "tencentcloud_private_dns_private_zone_list": privatedns.DataSourceTencentCloudPrivateDnsPrivateZoneList(), "tencentcloud_private_dns_forward_rules": privatedns.DataSourceTencentCloudPrivateDnsForwardRules(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index cf70d1dbc9..91e1b1a06c 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -2255,6 +2255,15 @@ tencentcloud_wedata_data_sources tencentcloud_wedata_project_roles tencentcloud_wedata_tenant_roles tencentcloud_wedata_resource_group_metrics +tencentcloud_wedata_list_lineage +tencentcloud_wedata_list_process_lineage +tencentcloud_wedata_list_column_lineage +tencentcloud_wedata_list_catalog +tencentcloud_wedata_list_database +tencentcloud_wedata_list_schema +tencentcloud_wedata_list_table +tencentcloud_wedata_get_table +tencentcloud_wedata_get_table_columns Resource tencentcloud_wedata_submit_task_operation diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_get_table.go b/tencentcloud/services/wedata/data_source_tc_wedata_get_table.go new file mode 100644 index 0000000000..11eb339df4 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_get_table.go @@ -0,0 +1,230 @@ +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 DataSourceTencentCloudWedataGetTable() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataGetTableRead, + Schema: map[string]*schema.Schema{ + "table_guid": { + Type: schema.TypeString, + Required: true, + Description: "Table GUID.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Data table details.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "guid": { + Type: schema.TypeString, + Computed: true, + Description: "Data table GUID.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Data table name.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Data table description.", + }, + "database_name": { + Type: schema.TypeString, + Computed: true, + Description: "Database name.", + }, + "schema_name": { + Type: schema.TypeString, + Computed: true, + Description: "Database schema name.", + }, + "table_type": { + Type: schema.TypeString, + Computed: true, + Description: "Table type.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + "technical_metadata": { + Type: schema.TypeList, + Computed: true, + Description: "Technical metadata of the table.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "owner": { + Type: schema.TypeString, + Computed: true, + Description: "Responsible person.", + }, + "location": { + Type: schema.TypeString, + Computed: true, + Description: "Data table location.", + }, + "storage_size": { + Type: schema.TypeInt, + Computed: true, + Description: "Storage size.", + }, + }, + }, + }, + "business_metadata": { + Type: schema.TypeList, + Computed: true, + Description: "Business metadata of the table.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tag_names": { + Type: schema.TypeSet, + Computed: true, + Description: "Tag names.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataGetTableRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_get_table.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(nil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + tableGuid string + ) + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("table_guid"); ok { + paramMap["TableGuid"] = helper.String(v.(string)) + tableGuid = v.(string) + } + + var respData *wedatav20250806.TableInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataGetTableByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + if reqErr != nil { + return reqErr + } + + tmpList := make([]map[string]interface{}, 0) + if respData != nil { + dataMap := map[string]interface{}{} + if respData.Guid != nil { + dataMap["guid"] = respData.Guid + } + + if respData.Name != nil { + dataMap["name"] = respData.Name + } + + if respData.Description != nil { + dataMap["description"] = respData.Description + } + + if respData.DatabaseName != nil { + dataMap["database_name"] = respData.DatabaseName + } + + if respData.SchemaName != nil { + dataMap["schema_name"] = respData.SchemaName + } + + if respData.TableType != nil { + dataMap["table_type"] = respData.TableType + } + + if respData.CreateTime != nil { + dataMap["create_time"] = respData.CreateTime + } + + if respData.UpdateTime != nil { + dataMap["update_time"] = respData.UpdateTime + } + + technicalMetadataMap := map[string]interface{}{} + if respData.TechnicalMetadata != nil { + if respData.TechnicalMetadata.Owner != nil { + technicalMetadataMap["owner"] = respData.TechnicalMetadata.Owner + } + + if respData.TechnicalMetadata.Location != nil { + technicalMetadataMap["location"] = respData.TechnicalMetadata.Location + } + + if respData.TechnicalMetadata.StorageSize != nil { + technicalMetadataMap["storage_size"] = respData.TechnicalMetadata.StorageSize + } + + dataMap["technical_metadata"] = []interface{}{technicalMetadataMap} + } + + businessMetadataMap := map[string]interface{}{} + if respData.BusinessMetadata != nil { + if respData.BusinessMetadata.TagNames != nil { + businessMetadataMap["tag_names"] = respData.BusinessMetadata.TagNames + } + + dataMap["business_metadata"] = []interface{}{businessMetadataMap} + } + + tmpList = append(tmpList, dataMap) + } + + _ = d.Set("data", tmpList) + + d.SetId(tableGuid) + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), tmpList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_get_table.md b/tencentcloud/services/wedata/data_source_tc_wedata_get_table.md new file mode 100644 index 0000000000..44c90da2aa --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_get_table.md @@ -0,0 +1,9 @@ +Use this data source to query detailed information of WeData get table + +Example Usage + +```hcl +data "tencentcloud_wedata_get_table" "example" { + table_guid = "ktDR4ymhp2_nlfClXhwxRQ" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns.go b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns.go new file mode 100644 index 0000000000..39964954fd --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns.go @@ -0,0 +1,148 @@ +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 DataSourceTencentCloudWedataGetTableColumns() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataGetTableColumnsRead, + Schema: map[string]*schema.Schema{ + "table_guid": { + Type: schema.TypeString, + Required: true, + Description: "Table GUID.", + }, + + "data": { + Type: schema.TypeList, + Computed: true, + Description: "Table column list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Field type.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Field name.", + }, + "length": { + Type: schema.TypeInt, + Computed: true, + Description: "Field length.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Field description.", + }, + "position": { + Type: schema.TypeInt, + Computed: true, + Description: "Field position.", + }, + "is_partition": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether it is a partition field.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataGetTableColumnsRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_get_table_columns.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(nil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = WedataService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + tableGuid string + ) + + paramMap := make(map[string]interface{}) + if v, ok := d.GetOk("table_guid"); ok { + paramMap["TableGuid"] = helper.String(v.(string)) + tableGuid = v.(string) + } + + var respData []*wedatav20250806.ColumnInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataGetTableColumnsByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + dataList := make([]map[string]interface{}, 0, len(respData)) + if respData != nil { + for _, data := range respData { + dataMap := map[string]interface{}{} + if data.Type != nil { + dataMap["type"] = data.Type + } + + if data.Name != nil { + dataMap["name"] = data.Name + } + + if data.Length != nil { + dataMap["length"] = data.Length + } + + if data.Description != nil { + dataMap["description"] = data.Description + } + + if data.Position != nil { + dataMap["position"] = data.Position + } + + if data.IsPartition != nil { + dataMap["is_partition"] = data.IsPartition + } + + dataList = append(dataList, dataMap) + } + + _ = d.Set("data", dataList) + } + + d.SetId(tableGuid) + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := tccommon.WriteToFile(output.(string), dataList); e != nil { + return e + } + } + + return nil +} diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns.md b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns.md new file mode 100644 index 0000000000..ed45c83b64 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns.md @@ -0,0 +1,9 @@ +Use this data source to query detailed information of WeData get table columns + +Example Usage + +```hcl +data "tencentcloud_wedata_get_table_columns" "example" { + table_guid = "ktDR4ymhp2_nlfClXhwxRQ" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns_test.go new file mode 100644 index 0000000000..cc0932b6f9 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_columns_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 TestAccTencentCloudWedataGetTableColumnsDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataGetTableColumnsDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_get_table_columns.example"), + ), + }}, + }) +} + +const testAccWedataGetTableColumnsDataSource = ` +data "tencentcloud_wedata_get_table_columns" "example" { + table_guid = "ktDR4ymhp2_nlfClXhwxRQ" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_get_table_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_test.go new file mode 100644 index 0000000000..46c383ee2d --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_get_table_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 TestAccTencentCloudWedataGetTableDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataGetTableDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_get_table.example"), + ), + }}, + }) +} + +const testAccWedataGetTableDataSource = ` +data "tencentcloud_wedata_get_table" "example" { + table_guid = "ktDR4ymhp2_nlfClXhwxRQ" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog.go new file mode 100644 index 0000000000..915657894c --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog.go @@ -0,0 +1,99 @@ +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 DataSourceTencentCloudWedataListCatalog() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListCatalogRead, + Schema: map[string]*schema.Schema{ + "parent_catalog_id": { + Type: schema.TypeString, + Optional: true, + Description: "Parent catalog ID.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Catalog record list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Catalog name.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListCatalogRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_catalog.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("parent_catalog_id"); ok { + paramMap["ParentCatalogId"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.CatalogInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListCatalogByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + if items.Name != nil { + itemsMap["name"] = items.Name + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_catalog.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog.md new file mode 100644 index 0000000000..772256bb12 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog.md @@ -0,0 +1,7 @@ +Use this data source to query detailed information of WeData list catalog + +Example Usage + +```hcl +data "tencentcloud_wedata_list_catalog" "example" {} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog_test.go new file mode 100644 index 0000000000..0be4761292 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_catalog_test.go @@ -0,0 +1,29 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataListCatalogDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListCatalogDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_catalog.example"), + ), + }}, + }) +} + +const testAccWedataListCatalogDataSource = ` +data "tencentcloud_wedata_list_catalog" "example" {} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage.go new file mode 100644 index 0000000000..f1d8db440e --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage.go @@ -0,0 +1,388 @@ +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 DataSourceTencentCloudWedataListColumnLineage() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListColumnLineageRead, + Schema: map[string]*schema.Schema{ + "table_unique_id": { + Type: schema.TypeString, + Required: true, + Description: "Table unique ID.", + }, + + "direction": { + Type: schema.TypeString, + Required: true, + Description: "Lineage direction INPUT|OUTPUT.", + }, + + "column_name": { + Type: schema.TypeString, + Required: true, + Description: "Column name.", + }, + + "platform": { + Type: schema.TypeString, + Required: true, + Description: "Source: WEDATA|THIRD, default WEDATA.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Lineage record list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource": { + Type: schema.TypeList, + Computed: true, + Description: "Current resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Entity original unique ID.", + }, + "resource_name": { + Type: schema.TypeString, + Computed: true, + Description: "Business name: database.table|metric name|model name|field name.", + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + Description: "Entity type\nTABLE|METRIC|MODEL|SERVICE|COLUMN.", + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage node unique identifier.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Description: table type|metric description|model description|field description.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "Source: WEDATA|THIRD\ndefault wedata.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + "resource_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Resource additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + }, + }, + }, + "relation": { + Type: schema.TypeList, + Computed: true, + Description: "Relation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "relation_id": { + Type: schema.TypeString, + Computed: true, + Description: "Relation ID.", + }, + "source_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Source unique lineage ID.", + }, + "target_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Target unique lineage ID.", + }, + "processes": { + Type: schema.TypeList, + Computed: true, + Description: "Lineage processing process.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "process_id": { + Type: schema.TypeString, + Computed: true, + Description: "Original unique ID.", + }, + "process_type": { + Type: schema.TypeString, + Computed: true, + Description: "Task type\n //Scheduling task\n SCHEDULE_TASK,\n //Integration task\n INTEGRATION_TASK,\n //Third-party reporting\n THIRD_REPORT,\n //Data modeling\n TABLE_MODEL,\n //Model creates metrics\n MODEL_METRIC,\n //Atomic metric creates derived metric\n METRIC_METRIC,\n //Data service\n DATA_SERVICE.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "WEDATA, THIRD.", + }, + "process_sub_type": { + Type: schema.TypeString, + Computed: true, + Description: "Task subtype\n SQL_TASK,\n //Integration real-time task lineage\n INTEGRATED_STREAM,\n //Integration offline task lineage\n INTEGRATED_OFFLINE.", + }, + "process_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage task unique node ID.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListColumnLineageRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_column_lineage.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("table_unique_id"); ok { + paramMap["TableUniqueId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("direction"); ok { + paramMap["Direction"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("column_name"); ok { + paramMap["ColumnName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("platform"); ok { + paramMap["Platform"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.LineageNodeInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListColumnLineageByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + resourceMap := map[string]interface{}{} + if items.Resource != nil { + if items.Resource.ResourceUniqueId != nil { + resourceMap["resource_unique_id"] = items.Resource.ResourceUniqueId + } + + if items.Resource.ResourceName != nil { + resourceMap["resource_name"] = items.Resource.ResourceName + } + + if items.Resource.ResourceType != nil { + resourceMap["resource_type"] = items.Resource.ResourceType + } + + if items.Resource.LineageNodeId != nil { + resourceMap["lineage_node_id"] = items.Resource.LineageNodeId + } + + if items.Resource.Description != nil { + resourceMap["description"] = items.Resource.Description + } + + if items.Resource.Platform != nil { + resourceMap["platform"] = items.Resource.Platform + } + + if items.Resource.CreateTime != nil { + resourceMap["create_time"] = items.Resource.CreateTime + } + + if items.Resource.UpdateTime != nil { + resourceMap["update_time"] = items.Resource.UpdateTime + } + + resourcePropertiesList := make([]map[string]interface{}, 0, len(items.Resource.ResourceProperties)) + if items.Resource.ResourceProperties != nil { + for _, resourceProperties := range items.Resource.ResourceProperties { + resourcePropertiesMap := map[string]interface{}{} + + if resourceProperties.Name != nil { + resourcePropertiesMap["name"] = resourceProperties.Name + } + + if resourceProperties.Value != nil { + resourcePropertiesMap["value"] = resourceProperties.Value + } + + resourcePropertiesList = append(resourcePropertiesList, resourcePropertiesMap) + } + + resourceMap["resource_properties"] = resourcePropertiesList + } + + itemsMap["resource"] = []interface{}{resourceMap} + } + + relationMap := map[string]interface{}{} + if items.Relation != nil { + if items.Relation.RelationId != nil { + relationMap["relation_id"] = items.Relation.RelationId + } + + if items.Relation.SourceUniqueId != nil { + relationMap["source_unique_id"] = items.Relation.SourceUniqueId + } + + if items.Relation.TargetUniqueId != nil { + relationMap["target_unique_id"] = items.Relation.TargetUniqueId + } + + processesList := make([]map[string]interface{}, 0, len(items.Relation.Processes)) + if items.Relation.Processes != nil { + for _, processes := range items.Relation.Processes { + processesMap := map[string]interface{}{} + + if processes.ProcessId != nil { + processesMap["process_id"] = processes.ProcessId + } + + if processes.ProcessType != nil { + processesMap["process_type"] = processes.ProcessType + } + + if processes.Platform != nil { + processesMap["platform"] = processes.Platform + } + + if processes.ProcessSubType != nil { + processesMap["process_sub_type"] = processes.ProcessSubType + } + + processPropertiesList := make([]map[string]interface{}, 0, len(processes.ProcessProperties)) + if processes.ProcessProperties != nil { + for _, processProperties := range processes.ProcessProperties { + processPropertiesMap := map[string]interface{}{} + + if processProperties.Name != nil { + processPropertiesMap["name"] = processProperties.Name + } + + if processProperties.Value != nil { + processPropertiesMap["value"] = processProperties.Value + } + + processPropertiesList = append(processPropertiesList, processPropertiesMap) + } + + processesMap["process_properties"] = processPropertiesList + } + + if processes.LineageNodeId != nil { + processesMap["lineage_node_id"] = processes.LineageNodeId + } + + processesList = append(processesList, processesMap) + } + + relationMap["processes"] = processesList + } + + itemsMap["relation"] = []interface{}{relationMap} + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_column_lineage.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage.md new file mode 100644 index 0000000000..e083d2b8c6 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage.md @@ -0,0 +1,12 @@ +Use this data source to query detailed information of WeData list column lineage + +Example Usage + +```hcl +data "tencentcloud_wedata_list_column_lineage" "example" { + table_unique_id = "B_CRyO4-3rMvNFPH_7aTaw" + direction = "INPUT" + column_name = "example_column" + platform = "WEDATA" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage_test.go new file mode 100644 index 0000000000..2bc87d56bb --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_column_lineage_test.go @@ -0,0 +1,34 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataListColumnLineageDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListColumnLineageDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_column_lineage.example"), + ), + }}, + }) +} + +const testAccWedataListColumnLineageDataSource = ` +data "tencentcloud_wedata_list_column_lineage" "example" { + table_unique_id = "B_CRyO4-3rMvNFPH_7aTaw" + direction = "INPUT" + column_name = "a" + platform = "WEDATA" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_database.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_database.go new file mode 100644 index 0000000000..8f46c00ede --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_database.go @@ -0,0 +1,164 @@ +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 DataSourceTencentCloudWedataListDatabase() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListDatabaseRead, + Schema: map[string]*schema.Schema{ + "catalog_name": { + Type: schema.TypeString, + Optional: true, + Description: "Catalog name.", + }, + + "datasource_id": { + Type: schema.TypeInt, + Optional: true, + Description: "Data source ID.", + }, + + "keyword": { + Type: schema.TypeString, + Optional: true, + Description: "Database name search keyword.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Database record list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "guid": { + Type: schema.TypeString, + Computed: true, + Description: "Database GUID.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Database name.", + }, + "catalog_name": { + Type: schema.TypeString, + Computed: true, + Description: "Database catalog.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Database description.", + }, + "location": { + Type: schema.TypeString, + Computed: true, + Description: "Database location.", + }, + "storage_size": { + Type: schema.TypeInt, + Computed: true, + Description: "Database storage size.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListDatabaseRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_database.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("catalog_name"); ok { + paramMap["CatalogName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("datasource_id"); ok { + paramMap["DatasourceId"] = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("keyword"); ok { + paramMap["Keyword"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.DatabaseInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListDatabaseByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + if items.Guid != nil { + itemsMap["guid"] = items.Guid + } + + if items.Name != nil { + itemsMap["name"] = items.Name + } + + if items.CatalogName != nil { + itemsMap["catalog_name"] = items.CatalogName + } + + if items.Description != nil { + itemsMap["description"] = items.Description + } + + if items.Location != nil { + itemsMap["location"] = items.Location + } + + if items.StorageSize != nil { + itemsMap["storage_size"] = items.StorageSize + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_database.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_database.md new file mode 100644 index 0000000000..a3d5087c95 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_database.md @@ -0,0 +1,7 @@ +Use this data source to query detailed information of WeData list database + +Example Usage + +```hcl +data "tencentcloud_wedata_list_database" "example" {} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_database_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_database_test.go new file mode 100644 index 0000000000..c5a873865d --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_database_test.go @@ -0,0 +1,29 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataListDatabaseDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListDatabaseDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_database.example"), + ), + }}, + }) +} + +const testAccWedataListDatabaseDataSource = ` +data "tencentcloud_wedata_list_database" "example" {} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage.go new file mode 100644 index 0000000000..ab2a931b2a --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage.go @@ -0,0 +1,387 @@ +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 DataSourceTencentCloudWedataListLineage() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListLineageRead, + Schema: map[string]*schema.Schema{ + "resource_unique_id": { + Type: schema.TypeString, + Required: true, + Description: "Entity unique ID.", + }, + + "resource_type": { + Type: schema.TypeString, + Required: true, + Description: "Entity type: TABLE|METRIC|MODEL|SERVICE|COLUMN.", + }, + + "direction": { + Type: schema.TypeString, + Required: true, + Description: "Lineage direction: INPUT|OUTPUT.", + }, + + "platform": { + Type: schema.TypeString, + Required: true, + Description: "Source: WEDATA|THIRD, default is WEDATA.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Lineage record list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource": { + Type: schema.TypeList, + Computed: true, + Description: "Current resource.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Entity original unique ID.", + }, + "resource_name": { + Type: schema.TypeString, + Computed: true, + Description: "Business name: database.table|metric name|model name|field name.", + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + Description: "Entity type: TABLE|METRIC|MODEL|SERVICE|COLUMN.", + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage node unique identifier.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Description: table type|metric description|model description|field description.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "Source: WEDATA|THIRD, default is WEDATA.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + "resource_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Resource additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + }, + }, + }, + "relation": { + Type: schema.TypeList, + Computed: true, + Description: "Relation.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "relation_id": { + Type: schema.TypeString, + Computed: true, + Description: "Association ID.", + }, + "source_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Source unique lineage ID.", + }, + "target_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Target unique lineage ID.", + }, + "processes": { + Type: schema.TypeList, + Computed: true, + Description: "Lineage processing process.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "process_id": { + Type: schema.TypeString, + Computed: true, + Description: "Original unique ID.", + }, + "process_type": { + Type: schema.TypeString, + Computed: true, + Description: "Task type: SCHEDULE_TASK, INTEGRATION_TASK, THIRD_REPORT, TABLE_MODEL, MODEL_METRIC, METRIC_METRIC, DATA_SERVICE.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "WEDATA, THIRD.", + }, + "process_sub_type": { + Type: schema.TypeString, + Computed: true, + Description: "Task subtype: SQL_TASK, INTEGRATED_STREAM, INTEGRATED_OFFLINE.", + }, + "process_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage task unique node ID.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListLineageRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_lineage.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("resource_unique_id"); ok { + paramMap["ResourceUniqueId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("resource_type"); ok { + paramMap["ResourceType"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("direction"); ok { + paramMap["Direction"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("platform"); ok { + paramMap["Platform"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.LineageNodeInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListLineageByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + resourceMap := map[string]interface{}{} + if items.Resource != nil { + if items.Resource.ResourceUniqueId != nil { + resourceMap["resource_unique_id"] = items.Resource.ResourceUniqueId + } + + if items.Resource.ResourceName != nil { + resourceMap["resource_name"] = items.Resource.ResourceName + } + + if items.Resource.ResourceType != nil { + resourceMap["resource_type"] = items.Resource.ResourceType + } + + if items.Resource.LineageNodeId != nil { + resourceMap["lineage_node_id"] = items.Resource.LineageNodeId + } + + if items.Resource.Description != nil { + resourceMap["description"] = items.Resource.Description + } + + if items.Resource.Platform != nil { + resourceMap["platform"] = items.Resource.Platform + } + + if items.Resource.CreateTime != nil { + resourceMap["create_time"] = items.Resource.CreateTime + } + + if items.Resource.UpdateTime != nil { + resourceMap["update_time"] = items.Resource.UpdateTime + } + + resourcePropertiesList := make([]map[string]interface{}, 0, len(items.Resource.ResourceProperties)) + if items.Resource.ResourceProperties != nil { + for _, resourceProperties := range items.Resource.ResourceProperties { + resourcePropertiesMap := map[string]interface{}{} + + if resourceProperties.Name != nil { + resourcePropertiesMap["name"] = resourceProperties.Name + } + + if resourceProperties.Value != nil { + resourcePropertiesMap["value"] = resourceProperties.Value + } + + resourcePropertiesList = append(resourcePropertiesList, resourcePropertiesMap) + } + + resourceMap["resource_properties"] = resourcePropertiesList + } + + itemsMap["resource"] = []interface{}{resourceMap} + } + + relationMap := map[string]interface{}{} + if items.Relation != nil { + if items.Relation.RelationId != nil { + relationMap["relation_id"] = items.Relation.RelationId + } + + if items.Relation.SourceUniqueId != nil { + relationMap["source_unique_id"] = items.Relation.SourceUniqueId + } + + if items.Relation.TargetUniqueId != nil { + relationMap["target_unique_id"] = items.Relation.TargetUniqueId + } + + processesList := make([]map[string]interface{}, 0, len(items.Relation.Processes)) + if items.Relation.Processes != nil { + for _, processes := range items.Relation.Processes { + processesMap := map[string]interface{}{} + if processes.ProcessId != nil { + processesMap["process_id"] = processes.ProcessId + } + + if processes.ProcessType != nil { + processesMap["process_type"] = processes.ProcessType + } + + if processes.Platform != nil { + processesMap["platform"] = processes.Platform + } + + if processes.ProcessSubType != nil { + processesMap["process_sub_type"] = processes.ProcessSubType + } + + processPropertiesList := make([]map[string]interface{}, 0, len(processes.ProcessProperties)) + if processes.ProcessProperties != nil { + for _, processProperties := range processes.ProcessProperties { + processPropertiesMap := map[string]interface{}{} + + if processProperties.Name != nil { + processPropertiesMap["name"] = processProperties.Name + } + + if processProperties.Value != nil { + processPropertiesMap["value"] = processProperties.Value + } + + processPropertiesList = append(processPropertiesList, processPropertiesMap) + } + + processesMap["process_properties"] = processPropertiesList + } + + if processes.LineageNodeId != nil { + processesMap["lineage_node_id"] = processes.LineageNodeId + } + + processesList = append(processesList, processesMap) + } + + relationMap["processes"] = processesList + } + + itemsMap["relation"] = []interface{}{relationMap} + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_lineage.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage.md new file mode 100644 index 0000000000..b89d171d0f --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage.md @@ -0,0 +1,12 @@ +Use this data source to query detailed information of Wedata list lineage + +Example Usage + +```hcl +data "tencentcloud_wedata_list_lineage" "example" { + resource_unique_id = "fM8OgzE-AM2h4aaJmdXoPg" + resource_type = "TABLE" + direction = "INPUT" + platform = "WEDATA" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage_test.go new file mode 100644 index 0000000000..9a2654e97b --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_lineage_test.go @@ -0,0 +1,34 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataListLineageDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListLineageDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_lineage.example"), + ), + }}, + }) +} + +const testAccWedataListLineageDataSource = ` +data "tencentcloud_wedata_list_lineage" "example" { + resource_unique_id = "fM8OgzE-AM2h4aaJmdXoPg" + resource_type = "TABLE" + direction = "INPUT" + platform = "WEDATA" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage.go new file mode 100644 index 0000000000..d9805c8c88 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage.go @@ -0,0 +1,459 @@ +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 DataSourceTencentCloudWedataListProcessLineage() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListProcessLineageRead, + Schema: map[string]*schema.Schema{ + "process_id": { + Type: schema.TypeString, + Required: true, + Description: "Task unique ID.", + }, + + "process_type": { + Type: schema.TypeString, + Required: true, + Description: "Task type: SCHEDULE_TASK, INTEGRATION_TASK, THIRD_REPORT, TABLE_MODEL, MODEL_METRIC, METRIC_METRIC, DATA_SERVICE.", + }, + + "platform": { + Type: schema.TypeString, + Required: true, + Description: "Source: WEDATA|THIRD, default WEDATA.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Lineage pair list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "source": { + Type: schema.TypeList, + Computed: true, + Description: "Source.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Entity original unique ID.\n\nNote: When lineage is for table columns, the unique ID should be TableResourceUniqueId::FieldName.", + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + Description: "Entity type.\nTABLE|METRIC|MODEL|SERVICE|COLUMN.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "Source: WEDATA|THIRD.\nDefault wedata.", + }, + "resource_name": { + Type: schema.TypeString, + Computed: true, + Description: "Business name: database.table|metric name|model name|field name.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Description: table type|metric description|model description|field description.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + "resource_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Resource additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage node unique identifier.", + }, + }, + }, + }, + "target": { + Type: schema.TypeList, + Computed: true, + Description: "Target.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource_unique_id": { + Type: schema.TypeString, + Computed: true, + Description: "Entity original unique ID.\n\nNote: When lineage is for table columns, the unique ID should be TableResourceUniqueId::FieldName.", + }, + "resource_type": { + Type: schema.TypeString, + Computed: true, + Description: "Entity type.\nTABLE|METRIC|MODEL|SERVICE|COLUMN.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "Source: WEDATA|THIRD.\nDefault wedata.", + }, + "resource_name": { + Type: schema.TypeString, + Computed: true, + Description: "Business name: database.table|metric name|model name|field name.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Description: table type|metric description|model description|field description.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + "resource_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Resource additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage node unique identifier.", + }, + }, + }, + }, + "processes": { + Type: schema.TypeList, + Computed: true, + Description: "Lineage processing procedures.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "process_id": { + Type: schema.TypeString, + Computed: true, + Description: "Original unique ID.", + }, + "process_type": { + Type: schema.TypeString, + Computed: true, + Description: "Task type.\nSCHEDULE_TASK,\nINTEGRATION_TASK,\nTHIRD_REPORT,\nTABLE_MODEL,\nMODEL_METRIC,\nMETRIC_METRIC,\nDATA_SERVICE.", + }, + "platform": { + Type: schema.TypeString, + Computed: true, + Description: "WEDATA, THIRD.", + }, + "process_sub_type": { + Type: schema.TypeString, + Computed: true, + Description: "Task subtype.\nSQL_TASK,\nINTEGRATED_STREAM,\nINTEGRATED_OFFLINE.", + }, + "process_properties": { + Type: schema.TypeList, + Computed: true, + Description: "Additional extension parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Property name.", + }, + "value": { + Type: schema.TypeString, + Computed: true, + Description: "Property value.", + }, + }, + }, + }, + "lineage_node_id": { + Type: schema.TypeString, + Computed: true, + Description: "Lineage task unique node ID.", + }, + }, + }, + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListProcessLineageRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_process_lineage.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("process_id"); ok { + paramMap["ProcessId"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("process_type"); ok { + paramMap["ProcessType"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("platform"); ok { + paramMap["Platform"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.LineagePair + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListProcessLineageByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + sourceMap := map[string]interface{}{} + if items.Source != nil { + if items.Source.ResourceUniqueId != nil { + sourceMap["resource_unique_id"] = items.Source.ResourceUniqueId + } + + if items.Source.ResourceType != nil { + sourceMap["resource_type"] = items.Source.ResourceType + } + + if items.Source.Platform != nil { + sourceMap["platform"] = items.Source.Platform + } + + if items.Source.ResourceName != nil { + sourceMap["resource_name"] = items.Source.ResourceName + } + + if items.Source.Description != nil { + sourceMap["description"] = items.Source.Description + } + + if items.Source.CreateTime != nil { + sourceMap["create_time"] = items.Source.CreateTime + } + + if items.Source.UpdateTime != nil { + sourceMap["update_time"] = items.Source.UpdateTime + } + + resourcePropertiesList := make([]map[string]interface{}, 0, len(items.Source.ResourceProperties)) + if items.Source.ResourceProperties != nil { + for _, resourceProperties := range items.Source.ResourceProperties { + resourcePropertiesMap := map[string]interface{}{} + + if resourceProperties.Name != nil { + resourcePropertiesMap["name"] = resourceProperties.Name + } + + if resourceProperties.Value != nil { + resourcePropertiesMap["value"] = resourceProperties.Value + } + + resourcePropertiesList = append(resourcePropertiesList, resourcePropertiesMap) + } + + sourceMap["resource_properties"] = resourcePropertiesList + } + + if items.Source.LineageNodeId != nil { + sourceMap["lineage_node_id"] = items.Source.LineageNodeId + } + + itemsMap["source"] = []interface{}{sourceMap} + } + + targetMap := map[string]interface{}{} + if items.Target != nil { + if items.Target.ResourceUniqueId != nil { + targetMap["resource_unique_id"] = items.Target.ResourceUniqueId + } + + if items.Target.ResourceType != nil { + targetMap["resource_type"] = items.Target.ResourceType + } + + if items.Target.Platform != nil { + targetMap["platform"] = items.Target.Platform + } + + if items.Target.ResourceName != nil { + targetMap["resource_name"] = items.Target.ResourceName + } + + if items.Target.Description != nil { + targetMap["description"] = items.Target.Description + } + + if items.Target.CreateTime != nil { + targetMap["create_time"] = items.Target.CreateTime + } + + if items.Target.UpdateTime != nil { + targetMap["update_time"] = items.Target.UpdateTime + } + + resourcePropertiesList := make([]map[string]interface{}, 0, len(items.Target.ResourceProperties)) + if items.Target.ResourceProperties != nil { + for _, resourceProperties := range items.Target.ResourceProperties { + resourcePropertiesMap := map[string]interface{}{} + + if resourceProperties.Name != nil { + resourcePropertiesMap["name"] = resourceProperties.Name + } + + if resourceProperties.Value != nil { + resourcePropertiesMap["value"] = resourceProperties.Value + } + + resourcePropertiesList = append(resourcePropertiesList, resourcePropertiesMap) + } + + targetMap["resource_properties"] = resourcePropertiesList + } + + if items.Target.LineageNodeId != nil { + targetMap["lineage_node_id"] = items.Target.LineageNodeId + } + + itemsMap["target"] = []interface{}{targetMap} + } + + processesList := make([]map[string]interface{}, 0, len(items.Processes)) + if items.Processes != nil { + for _, processes := range items.Processes { + processesMap := map[string]interface{}{} + if processes.ProcessId != nil { + processesMap["process_id"] = processes.ProcessId + } + + if processes.ProcessType != nil { + processesMap["process_type"] = processes.ProcessType + } + + if processes.Platform != nil { + processesMap["platform"] = processes.Platform + } + + if processes.ProcessSubType != nil { + processesMap["process_sub_type"] = processes.ProcessSubType + } + + processPropertiesList := make([]map[string]interface{}, 0, len(processes.ProcessProperties)) + if processes.ProcessProperties != nil { + for _, processProperties := range processes.ProcessProperties { + processPropertiesMap := map[string]interface{}{} + if processProperties.Name != nil { + processPropertiesMap["name"] = processProperties.Name + } + + if processProperties.Value != nil { + processPropertiesMap["value"] = processProperties.Value + } + + processPropertiesList = append(processPropertiesList, processPropertiesMap) + } + + processesMap["process_properties"] = processPropertiesList + } + + if processes.LineageNodeId != nil { + processesMap["lineage_node_id"] = processes.LineageNodeId + } + + processesList = append(processesList, processesMap) + } + + itemsMap["processes"] = processesList + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_process_lineage.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage.md new file mode 100644 index 0000000000..d3191de89f --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage.md @@ -0,0 +1,11 @@ +Use this data source to query detailed information of WeData list process lineage + +Example Usage + +```hcl +data "tencentcloud_wedata_list_process_lineage" "example" { + process_id = "20241107221758402" + process_type = "SCHEDULE_TASK" + platform = "WEDATA" +} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage_test.go new file mode 100644 index 0000000000..cb78e25af4 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_process_lineage_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 TestAccTencentCloudWedataListProcessLineageDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListProcessLineageDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_process_lineage.example"), + ), + }}, + }) +} + +const testAccWedataListProcessLineageDataSource = ` +data "tencentcloud_wedata_list_process_lineage" "example" { + process_id = "20241107221758402" + process_type = "SCHEDULE_TASK" + platform = "WEDATA" +} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_schema.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_schema.go new file mode 100644 index 0000000000..a2b2055b9f --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_schema.go @@ -0,0 +1,147 @@ +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 DataSourceTencentCloudWedataListSchema() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListSchemaRead, + Schema: map[string]*schema.Schema{ + "catalog_name": { + Type: schema.TypeString, + Optional: true, + Description: "Catalog name.", + }, + + "datasource_id": { + Type: schema.TypeInt, + Optional: true, + Description: "Data source ID.", + }, + + "database_name": { + Type: schema.TypeString, + Optional: true, + Description: "Database name.", + }, + + "keyword": { + Type: schema.TypeString, + Optional: true, + Description: "Database schema search keyword.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Schema record list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "guid": { + Type: schema.TypeString, + Computed: true, + Description: "Schema GUID.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Schema name.", + }, + "database_name": { + Type: schema.TypeString, + Computed: true, + Description: "Database name.", + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListSchemaRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_schema.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("catalog_name"); ok { + paramMap["CatalogName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("datasource_id"); ok { + paramMap["DatasourceId"] = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("database_name"); ok { + paramMap["DatabaseName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("keyword"); ok { + paramMap["Keyword"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.SchemaInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListSchemaByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + if items.Guid != nil { + itemsMap["guid"] = items.Guid + } + + if items.Name != nil { + itemsMap["name"] = items.Name + } + + if items.DatabaseName != nil { + itemsMap["database_name"] = items.DatabaseName + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_schema.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_schema.md new file mode 100644 index 0000000000..61edcaabee --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_schema.md @@ -0,0 +1,7 @@ +Use this data source to query detailed information of WeData list schema + +Example Usage + +```hcl +data "tencentcloud_wedata_list_schema" "example" {} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_schema_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_schema_test.go new file mode 100644 index 0000000000..d1f8e14d31 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_schema_test.go @@ -0,0 +1,29 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataListSchemaDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListSchemaDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_schema.example"), + ), + }}, + }) +} + +const testAccWedataListSchemaDataSource = ` +data "tencentcloud_wedata_list_schema" "example" {} +` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_table.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_table.go new file mode 100644 index 0000000000..73dee5a84a --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_table.go @@ -0,0 +1,269 @@ +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 DataSourceTencentCloudWedataListTable() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudWedataListTableRead, + Schema: map[string]*schema.Schema{ + "catalog_name": { + Type: schema.TypeString, + Optional: true, + Description: "Directory name.", + }, + + "datasource_id": { + Type: schema.TypeInt, + Optional: true, + Description: "Data source ID.", + }, + + "database_name": { + Type: schema.TypeString, + Optional: true, + Description: "Database name.", + }, + + "schema_name": { + Type: schema.TypeString, + Optional: true, + Description: "Database schema name.", + }, + + "keyword": { + Type: schema.TypeString, + Optional: true, + Description: "Table search keyword.", + }, + + "items": { + Type: schema.TypeList, + Computed: true, + Description: "Schema record list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "guid": { + Type: schema.TypeString, + Computed: true, + Description: "Data table GUID.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Data table name.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "Data table description.", + }, + "database_name": { + Type: schema.TypeString, + Computed: true, + Description: "Database name.", + }, + "schema_name": { + Type: schema.TypeString, + Computed: true, + Description: "Database schema name.", + }, + "table_type": { + Type: schema.TypeString, + Computed: true, + Description: "Table type.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + "technical_metadata": { + Type: schema.TypeList, + Computed: true, + Description: "Technical metadata of the table.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "owner": { + Type: schema.TypeString, + Computed: true, + Description: "Owner.", + }, + "location": { + Type: schema.TypeString, + Computed: true, + Description: "Data table location.", + }, + "storage_size": { + Type: schema.TypeInt, + Computed: true, + Description: "Storage size.", + }, + }, + }, + }, + "business_metadata": { + Type: schema.TypeList, + Computed: true, + Description: "Business metadata of the table.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tag_names": { + Type: schema.TypeSet, + Computed: true, + Description: "Tag names.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + }, + }, + }, + + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", + }, + }, + } +} + +func dataSourceTencentCloudWedataListTableRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("data_source.tencentcloud_wedata_list_table.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + 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("catalog_name"); ok { + paramMap["CatalogName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("datasource_id"); ok { + paramMap["DatasourceId"] = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("database_name"); ok { + paramMap["DatabaseName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("schema_name"); ok { + paramMap["SchemaName"] = helper.String(v.(string)) + } + + if v, ok := d.GetOk("keyword"); ok { + paramMap["Keyword"] = helper.String(v.(string)) + } + + var respData []*wedatav20250806.TableInfo + reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := service.DescribeWedataListTableByFilter(ctx, paramMap) + if e != nil { + return tccommon.RetryError(e) + } + + respData = result + return nil + }) + + if reqErr != nil { + return reqErr + } + + itemsList := make([]map[string]interface{}, 0, len(respData)) + for _, items := range respData { + itemsMap := map[string]interface{}{} + if items.Guid != nil { + itemsMap["guid"] = items.Guid + } + + if items.Name != nil { + itemsMap["name"] = items.Name + } + + if items.Description != nil { + itemsMap["description"] = items.Description + } + + if items.DatabaseName != nil { + itemsMap["database_name"] = items.DatabaseName + } + + if items.SchemaName != nil { + itemsMap["schema_name"] = items.SchemaName + } + + if items.TableType != nil { + itemsMap["table_type"] = items.TableType + } + + if items.CreateTime != nil { + itemsMap["create_time"] = items.CreateTime + } + + if items.UpdateTime != nil { + itemsMap["update_time"] = items.UpdateTime + } + + technicalMetadataMap := map[string]interface{}{} + if items.TechnicalMetadata != nil { + if items.TechnicalMetadata.Owner != nil { + technicalMetadataMap["owner"] = items.TechnicalMetadata.Owner + } + + if items.TechnicalMetadata.Location != nil { + technicalMetadataMap["location"] = items.TechnicalMetadata.Location + } + + if items.TechnicalMetadata.StorageSize != nil { + technicalMetadataMap["storage_size"] = items.TechnicalMetadata.StorageSize + } + + itemsMap["technical_metadata"] = []interface{}{technicalMetadataMap} + } + + businessMetadataMap := map[string]interface{}{} + if items.BusinessMetadata != nil { + if items.BusinessMetadata.TagNames != nil { + businessMetadataMap["tag_names"] = items.BusinessMetadata.TagNames + } + + itemsMap["business_metadata"] = []interface{}{businessMetadataMap} + } + + itemsList = append(itemsList, itemsMap) + } + + _ = d.Set("items", itemsList) + + d.SetId(helper.BuildToken()) + 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_list_table.md b/tencentcloud/services/wedata/data_source_tc_wedata_list_table.md new file mode 100644 index 0000000000..ef9f8b4925 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_table.md @@ -0,0 +1,7 @@ +Use this data source to query detailed information of WeData list table + +Example Usage + +```hcl +data "tencentcloud_wedata_list_table" "example" {} +``` diff --git a/tencentcloud/services/wedata/data_source_tc_wedata_list_table_test.go b/tencentcloud/services/wedata/data_source_tc_wedata_list_table_test.go new file mode 100644 index 0000000000..c7394e0219 --- /dev/null +++ b/tencentcloud/services/wedata/data_source_tc_wedata_list_table_test.go @@ -0,0 +1,29 @@ +package wedata_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudWedataListTableDataSource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccWedataListTableDataSource, + Check: resource.ComposeTestCheckFunc( + tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_wedata_list_table.example"), + ), + }}, + }) +} + +const testAccWedataListTableDataSource = ` +data "tencentcloud_wedata_list_table" "example" {} +` diff --git a/tencentcloud/services/wedata/service_tencentcloud_wedata.go b/tencentcloud/services/wedata/service_tencentcloud_wedata.go index fe0766be2b..2baff930f0 100644 --- a/tencentcloud/services/wedata/service_tencentcloud_wedata.go +++ b/tencentcloud/services/wedata/service_tencentcloud_wedata.go @@ -3193,3 +3193,467 @@ func (me *WedataService) DescribeWedataTaskById(ctx context.Context, projectId, ret = response.Response return } + +func (me *WedataService) DescribeWedataListLineageByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.LineageNodeInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListLineageRequest() + ) + + 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 == "ResourceUniqueId" { + request.ResourceUniqueId = v.(*string) + } + if k == "ResourceType" { + request.ResourceType = v.(*string) + } + if k == "Direction" { + request.Direction = v.(*string) + } + if k == "Platform" { + request.Platform = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 200 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListLineage(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataListColumnLineageByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.LineageNodeInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListColumnLineageRequest() + ) + + 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 == "TableUniqueId" { + request.TableUniqueId = v.(*string) + } + if k == "Direction" { + request.Direction = v.(*string) + } + if k == "ColumnName" { + request.ColumnName = v.(*string) + } + if k == "Platform" { + request.Platform = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 200 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListColumnLineage(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataListProcessLineageByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.LineagePair, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListProcessLineageRequest() + ) + + 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 == "ProcessId" { + request.ProcessId = v.(*string) + } + if k == "ProcessType" { + request.ProcessType = v.(*string) + } + if k == "Platform" { + request.Platform = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 200 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListProcessLineage(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataListCatalogByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.CatalogInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListCatalogRequest() + ) + + 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 == "ParentCatalogId" { + request.ParentCatalogId = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 200 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListCatalog(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataListDatabaseByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.DatabaseInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListDatabaseRequest() + ) + + 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 == "CatalogName" { + request.CatalogName = v.(*string) + } + if k == "DatasourceId" { + request.DatasourceId = v.(*int64) + } + if k == "Keyword" { + request.Keyword = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 200 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListDatabase(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataListSchemaByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.SchemaInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListSchemaRequest() + ) + + 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 == "CatalogName" { + request.CatalogName = v.(*string) + } + if k == "DatasourceId" { + request.DatasourceId = v.(*int64) + } + if k == "DatabaseName" { + request.DatabaseName = v.(*string) + } + if k == "Keyword" { + request.Keyword = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 200 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListSchema(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataListTableByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.TableInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewListTableRequest() + ) + + 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 == "CatalogName" { + request.CatalogName = v.(*string) + } + if k == "DatasourceId" { + request.DatasourceId = v.(*int64) + } + if k == "DatabaseName" { + request.DatabaseName = v.(*string) + } + if k == "SchemaName" { + request.SchemaName = v.(*string) + } + if k == "Keyword" { + request.Keyword = v.(*string) + } + } + + var ( + pageNum int64 = 1 + pageSize int64 = 500 + ) + for { + request.PageNumber = &pageNum + request.PageSize = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().ListTable(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 || len(response.Response.Data.Items) < 1 { + break + } + + ret = append(ret, response.Response.Data.Items...) + if len(response.Response.Data.Items) < int(pageSize) { + break + } + + pageNum += pageSize + } + + return +} + +func (me *WedataService) DescribeWedataGetTableByFilter(ctx context.Context, param map[string]interface{}) (ret *wedatav20250806.TableInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewGetTableRequest() + ) + + 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 == "TableGuid" { + request.TableGuid = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().GetTable(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) DescribeWedataGetTableColumnsByFilter(ctx context.Context, param map[string]interface{}) (ret []*wedatav20250806.ColumnInfo, errRet error) { + var ( + logId = tccommon.GetLogId(ctx) + request = wedatav20250806.NewGetTableColumnsRequest() + ) + + 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 == "TableGuid" { + request.TableGuid = v.(*string) + } + } + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseWedataV20250806Client().GetTableColumns(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 len(response.Response.Data) < 1 { + return + } + + ret = response.Response.Data + return +} diff --git a/website/docs/d/wedata_get_table.html.markdown b/website/docs/d/wedata_get_table.html.markdown new file mode 100644 index 0000000000..65e1b88ffb --- /dev/null +++ b/website/docs/d/wedata_get_table.html.markdown @@ -0,0 +1,49 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_get_table" +sidebar_current: "docs-tencentcloud-datasource-wedata_get_table" +description: |- + Use this data source to query detailed information of WeData get table +--- + +# tencentcloud_wedata_get_table + +Use this data source to query detailed information of WeData get table + +## Example Usage + +```hcl +data "tencentcloud_wedata_get_table" "example" { + table_guid = "ktDR4ymhp2_nlfClXhwxRQ" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `table_guid` - (Required, String) Table GUID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Data table details. + * `business_metadata` - Business metadata of the table. + * `tag_names` - Tag names. + * `create_time` - Creation time. + * `database_name` - Database name. + * `description` - Data table description. + * `guid` - Data table GUID. + * `name` - Data table name. + * `schema_name` - Database schema name. + * `table_type` - Table type. + * `technical_metadata` - Technical metadata of the table. + * `location` - Data table location. + * `owner` - Responsible person. + * `storage_size` - Storage size. + * `update_time` - Update time. + + diff --git a/website/docs/d/wedata_get_table_columns.html.markdown b/website/docs/d/wedata_get_table_columns.html.markdown new file mode 100644 index 0000000000..0452c7f0ec --- /dev/null +++ b/website/docs/d/wedata_get_table_columns.html.markdown @@ -0,0 +1,41 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_get_table_columns" +sidebar_current: "docs-tencentcloud-datasource-wedata_get_table_columns" +description: |- + Use this data source to query detailed information of WeData get table columns +--- + +# tencentcloud_wedata_get_table_columns + +Use this data source to query detailed information of WeData get table columns + +## Example Usage + +```hcl +data "tencentcloud_wedata_get_table_columns" "example" { + table_guid = "ktDR4ymhp2_nlfClXhwxRQ" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `table_guid` - (Required, String) Table GUID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `data` - Table column list. + * `description` - Field description. + * `is_partition` - Whether it is a partition field. + * `length` - Field length. + * `name` - Field name. + * `position` - Field position. + * `type` - Field type. + + diff --git a/website/docs/d/wedata_list_catalog.html.markdown b/website/docs/d/wedata_list_catalog.html.markdown new file mode 100644 index 0000000000..194431fe2f --- /dev/null +++ b/website/docs/d/wedata_list_catalog.html.markdown @@ -0,0 +1,34 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_catalog" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_catalog" +description: |- + Use this data source to query detailed information of WeData list catalog +--- + +# tencentcloud_wedata_list_catalog + +Use this data source to query detailed information of WeData list catalog + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_catalog" "example" {} +``` + +## Argument Reference + +The following arguments are supported: + +* `parent_catalog_id` - (Optional, String) Parent catalog ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Catalog record list. + * `name` - Catalog name. + + diff --git a/website/docs/d/wedata_list_column_lineage.html.markdown b/website/docs/d/wedata_list_column_lineage.html.markdown new file mode 100644 index 0000000000..49a6b80a95 --- /dev/null +++ b/website/docs/d/wedata_list_column_lineage.html.markdown @@ -0,0 +1,87 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_column_lineage" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_column_lineage" +description: |- + Use this data source to query detailed information of WeData list column lineage +--- + +# tencentcloud_wedata_list_column_lineage + +Use this data source to query detailed information of WeData list column lineage + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_column_lineage" "example" { + table_unique_id = "B_CRyO4-3rMvNFPH_7aTaw" + direction = "INPUT" + column_name = "example_column" + platform = "WEDATA" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `column_name` - (Required, String) Column name. +* `direction` - (Required, String) Lineage direction INPUT|OUTPUT. +* `platform` - (Required, String) Source: WEDATA|THIRD, default WEDATA. +* `table_unique_id` - (Required, String) Table unique ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Lineage record list. + * `relation` - Relation. + * `processes` - Lineage processing process. + * `lineage_node_id` - Lineage task unique node ID. + * `platform` - WEDATA, THIRD. + * `process_id` - Original unique ID. + * `process_properties` - Additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `process_sub_type` - Task subtype + SQL_TASK, + //Integration real-time task lineage + INTEGRATED_STREAM, + //Integration offline task lineage + INTEGRATED_OFFLINE. + * `process_type` - Task type + //Scheduling task + SCHEDULE_TASK, + //Integration task + INTEGRATION_TASK, + //Third-party reporting + THIRD_REPORT, + //Data modeling + TABLE_MODEL, + //Model creates metrics + MODEL_METRIC, + //Atomic metric creates derived metric + METRIC_METRIC, + //Data service + DATA_SERVICE. + * `relation_id` - Relation ID. + * `source_unique_id` - Source unique lineage ID. + * `target_unique_id` - Target unique lineage ID. + * `resource` - Current resource. + * `create_time` - Creation time. + * `description` - Description: table type|metric description|model description|field description. + * `lineage_node_id` - Lineage node unique identifier. + * `platform` - Source: WEDATA|THIRD +default wedata. + * `resource_name` - Business name: database.table|metric name|model name|field name. + * `resource_properties` - Resource additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `resource_type` - Entity type +TABLE|METRIC|MODEL|SERVICE|COLUMN. + * `resource_unique_id` - Entity original unique ID. + * `update_time` - Update time. + + diff --git a/website/docs/d/wedata_list_database.html.markdown b/website/docs/d/wedata_list_database.html.markdown new file mode 100644 index 0000000000..d9ab0c4358 --- /dev/null +++ b/website/docs/d/wedata_list_database.html.markdown @@ -0,0 +1,41 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_database" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_database" +description: |- + Use this data source to query detailed information of WeData list database +--- + +# tencentcloud_wedata_list_database + +Use this data source to query detailed information of WeData list database + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_database" "example" {} +``` + +## Argument Reference + +The following arguments are supported: + +* `catalog_name` - (Optional, String) Catalog name. +* `datasource_id` - (Optional, Int) Data source ID. +* `keyword` - (Optional, String) Database name search keyword. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Database record list. + * `catalog_name` - Database catalog. + * `description` - Database description. + * `guid` - Database GUID. + * `location` - Database location. + * `name` - Database name. + * `storage_size` - Database storage size. + + diff --git a/website/docs/d/wedata_list_lineage.html.markdown b/website/docs/d/wedata_list_lineage.html.markdown new file mode 100644 index 0000000000..e8713de5e2 --- /dev/null +++ b/website/docs/d/wedata_list_lineage.html.markdown @@ -0,0 +1,66 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_lineage" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_lineage" +description: |- + Use this data source to query detailed information of Wedata list lineage +--- + +# tencentcloud_wedata_list_lineage + +Use this data source to query detailed information of Wedata list lineage + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_lineage" "example" { + resource_unique_id = "fM8OgzE-AM2h4aaJmdXoPg" + resource_type = "TABLE" + direction = "INPUT" + platform = "WEDATA" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `direction` - (Required, String) Lineage direction: INPUT|OUTPUT. +* `platform` - (Required, String) Source: WEDATA|THIRD, default is WEDATA. +* `resource_type` - (Required, String) Entity type: TABLE|METRIC|MODEL|SERVICE|COLUMN. +* `resource_unique_id` - (Required, String) Entity unique ID. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Lineage record list. + * `relation` - Relation. + * `processes` - Lineage processing process. + * `lineage_node_id` - Lineage task unique node ID. + * `platform` - WEDATA, THIRD. + * `process_id` - Original unique ID. + * `process_properties` - Additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `process_sub_type` - Task subtype: SQL_TASK, INTEGRATED_STREAM, INTEGRATED_OFFLINE. + * `process_type` - Task type: SCHEDULE_TASK, INTEGRATION_TASK, THIRD_REPORT, TABLE_MODEL, MODEL_METRIC, METRIC_METRIC, DATA_SERVICE. + * `relation_id` - Association ID. + * `source_unique_id` - Source unique lineage ID. + * `target_unique_id` - Target unique lineage ID. + * `resource` - Current resource. + * `create_time` - Creation time. + * `description` - Description: table type|metric description|model description|field description. + * `lineage_node_id` - Lineage node unique identifier. + * `platform` - Source: WEDATA|THIRD, default is WEDATA. + * `resource_name` - Business name: database.table|metric name|model name|field name. + * `resource_properties` - Resource additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `resource_type` - Entity type: TABLE|METRIC|MODEL|SERVICE|COLUMN. + * `resource_unique_id` - Entity original unique ID. + * `update_time` - Update time. + + diff --git a/website/docs/d/wedata_list_process_lineage.html.markdown b/website/docs/d/wedata_list_process_lineage.html.markdown new file mode 100644 index 0000000000..ef0b94b8ca --- /dev/null +++ b/website/docs/d/wedata_list_process_lineage.html.markdown @@ -0,0 +1,90 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_process_lineage" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_process_lineage" +description: |- + Use this data source to query detailed information of WeData list process lineage +--- + +# tencentcloud_wedata_list_process_lineage + +Use this data source to query detailed information of WeData list process lineage + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_process_lineage" "example" { + process_id = "20241107221758402" + process_type = "SCHEDULE_TASK" + platform = "WEDATA" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `platform` - (Required, String) Source: WEDATA|THIRD, default WEDATA. +* `process_id` - (Required, String) Task unique ID. +* `process_type` - (Required, String) Task type: SCHEDULE_TASK, INTEGRATION_TASK, THIRD_REPORT, TABLE_MODEL, MODEL_METRIC, METRIC_METRIC, DATA_SERVICE. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Lineage pair list. + * `processes` - Lineage processing procedures. + * `lineage_node_id` - Lineage task unique node ID. + * `platform` - WEDATA, THIRD. + * `process_id` - Original unique ID. + * `process_properties` - Additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `process_sub_type` - Task subtype. +SQL_TASK, +INTEGRATED_STREAM, +INTEGRATED_OFFLINE. + * `process_type` - Task type. +SCHEDULE_TASK, +INTEGRATION_TASK, +THIRD_REPORT, +TABLE_MODEL, +MODEL_METRIC, +METRIC_METRIC, +DATA_SERVICE. + * `source` - Source. + * `create_time` - Creation time. + * `description` - Description: table type|metric description|model description|field description. + * `lineage_node_id` - Lineage node unique identifier. + * `platform` - Source: WEDATA|THIRD. +Default wedata. + * `resource_name` - Business name: database.table|metric name|model name|field name. + * `resource_properties` - Resource additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `resource_type` - Entity type. +TABLE|METRIC|MODEL|SERVICE|COLUMN. + * `resource_unique_id` - Entity original unique ID. + +Note: When lineage is for table columns, the unique ID should be TableResourceUniqueId::FieldName. + * `update_time` - Update time. + * `target` - Target. + * `create_time` - Creation time. + * `description` - Description: table type|metric description|model description|field description. + * `lineage_node_id` - Lineage node unique identifier. + * `platform` - Source: WEDATA|THIRD. +Default wedata. + * `resource_name` - Business name: database.table|metric name|model name|field name. + * `resource_properties` - Resource additional extension parameters. + * `name` - Property name. + * `value` - Property value. + * `resource_type` - Entity type. +TABLE|METRIC|MODEL|SERVICE|COLUMN. + * `resource_unique_id` - Entity original unique ID. + +Note: When lineage is for table columns, the unique ID should be TableResourceUniqueId::FieldName. + * `update_time` - Update time. + + diff --git a/website/docs/d/wedata_list_schema.html.markdown b/website/docs/d/wedata_list_schema.html.markdown new file mode 100644 index 0000000000..5815c5cd70 --- /dev/null +++ b/website/docs/d/wedata_list_schema.html.markdown @@ -0,0 +1,39 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_schema" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_schema" +description: |- + Use this data source to query detailed information of WeData list schema +--- + +# tencentcloud_wedata_list_schema + +Use this data source to query detailed information of WeData list schema + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_schema" "example" {} +``` + +## Argument Reference + +The following arguments are supported: + +* `catalog_name` - (Optional, String) Catalog name. +* `database_name` - (Optional, String) Database name. +* `datasource_id` - (Optional, Int) Data source ID. +* `keyword` - (Optional, String) Database schema search keyword. +* `result_output_file` - (Optional, String) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Schema record list. + * `database_name` - Database name. + * `guid` - Schema GUID. + * `name` - Schema name. + + diff --git a/website/docs/d/wedata_list_table.html.markdown b/website/docs/d/wedata_list_table.html.markdown new file mode 100644 index 0000000000..eb23ccd2a4 --- /dev/null +++ b/website/docs/d/wedata_list_table.html.markdown @@ -0,0 +1,51 @@ +--- +subcategory: "Wedata" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_wedata_list_table" +sidebar_current: "docs-tencentcloud-datasource-wedata_list_table" +description: |- + Use this data source to query detailed information of WeData list table +--- + +# tencentcloud_wedata_list_table + +Use this data source to query detailed information of WeData list table + +## Example Usage + +```hcl +data "tencentcloud_wedata_list_table" "example" {} +``` + +## Argument Reference + +The following arguments are supported: + +* `catalog_name` - (Optional, String) Directory name. +* `database_name` - (Optional, String) Database name. +* `datasource_id` - (Optional, Int) Data source ID. +* `keyword` - (Optional, String) Table search keyword. +* `result_output_file` - (Optional, String) Used to save results. +* `schema_name` - (Optional, String) Database schema name. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `items` - Schema record list. + * `business_metadata` - Business metadata of the table. + * `tag_names` - Tag names. + * `create_time` - Creation time. + * `database_name` - Database name. + * `description` - Data table description. + * `guid` - Data table GUID. + * `name` - Data table name. + * `schema_name` - Database schema name. + * `table_type` - Table type. + * `technical_metadata` - Technical metadata of the table. + * `location` - Data table location. + * `owner` - Owner. + * `storage_size` - Storage size. + * `update_time` - Update time. + + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index bef6b7fe72..0c1829d857 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -7030,6 +7030,33 @@
  • tencentcloud_wedata_downstream_tasks
  • +
  • + tencentcloud_wedata_get_table +
  • +
  • + tencentcloud_wedata_get_table_columns +
  • +
  • + tencentcloud_wedata_list_catalog +
  • +
  • + tencentcloud_wedata_list_column_lineage +
  • +
  • + tencentcloud_wedata_list_database +
  • +
  • + tencentcloud_wedata_list_lineage +
  • +
  • + tencentcloud_wedata_list_process_lineage +
  • +
  • + tencentcloud_wedata_list_schema +
  • +
  • + tencentcloud_wedata_list_table +
  • tencentcloud_wedata_ops_alarm_message