Skip to content

Commit 5a9da20

Browse files
authored
add (#3477)
1 parent e52371d commit 5a9da20

File tree

50 files changed

+665
-683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+665
-683
lines changed

tencentcloud/services/dlc/data_source_tc_dlc_check_data_engine_config_pairs_validity.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func DataSourceTencentCloudDlcCheckDataEngineConfigPairsValidity() *schema.Resou
1919
"child_image_version_id": {
2020
Optional: true,
2121
Type: schema.TypeString,
22-
Description: "Engine Image version id.",
22+
Description: "ID of the minor version of the engine.",
2323
},
2424

2525
"data_engine_config_pairs": {
@@ -45,7 +45,7 @@ func DataSourceTencentCloudDlcCheckDataEngineConfigPairsValidity() *schema.Resou
4545
"image_version_id": {
4646
Optional: true,
4747
Type: schema.TypeString,
48-
Description: "Engine major version id. If a minor version id exists, you only need to pass in the minor version id. If it does not exist, the latest minor version id under the current major version will be obtained.",
48+
Description: "ID of the major version of the engine. If there is the ID of the minor version, only the ID of the minor version needs to be input. If not, the latest ID of the minor version under the major version will be acquired.",
4949
},
5050

5151
"is_available": {
@@ -55,11 +55,9 @@ func DataSourceTencentCloudDlcCheckDataEngineConfigPairsValidity() *schema.Resou
5555
},
5656

5757
"unavailable_config": {
58-
Computed: true,
59-
Type: schema.TypeSet,
60-
Elem: &schema.Schema{
61-
Type: schema.TypeString,
62-
},
58+
Computed: true,
59+
Type: schema.TypeSet,
60+
Elem: &schema.Schema{Type: schema.TypeString},
6361
Description: "Invalid parameter set.",
6462
},
6563

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Use this data source to query detailed information of dlc check_data_engine_config_pairs_validity
1+
Use this data source to query detailed information of DLC check data engine config pairs validity
22

33
Example Usage
44

55
```hcl
6-
data "tencentcloud_dlc_check_data_engine_config_pairs_validity" "check_data_engine_config_pairs_validity" {
6+
data "tencentcloud_dlc_check_data_engine_config_pairs_validity" "example" {
77
child_image_version_id = "d3ftghd4-9a7e-4f64-a3f4-f38507c69742"
8-
}
9-
```
8+
}
9+
```

tencentcloud/services/dlc/resource_tc_dlc_attach_user_policy_operation.go

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,108 +17,105 @@ func ResourceTencentCloudDlcAttachUserPolicyOperation() *schema.Resource {
1717
Create: resourceTencentCloudDlcAttachUserPolicyOperationCreate,
1818
Read: resourceTencentCloudDlcAttachUserPolicyOperationRead,
1919
Delete: resourceTencentCloudDlcAttachUserPolicyOperationDelete,
20-
Importer: &schema.ResourceImporter{
21-
State: schema.ImportStatePassthrough,
22-
},
2320
Schema: map[string]*schema.Schema{
2421
"user_id": {
2522
Required: true,
2623
ForceNew: true,
2724
Type: schema.TypeString,
28-
Description: "User id, the same as the sub-user uin.",
25+
Description: "User ID, which is the same as the sub-user UIN. The CreateUser API is needed to create a user at first. The DescribeUsers API can be used for viewing.",
2926
},
3027

3128
"policy_set": {
3229
Optional: true,
3330
ForceNew: true,
3431
Type: schema.TypeList,
35-
Description: "Authentication policy collection.",
32+
Description: "Collection of authentication policies.",
3633
Elem: &schema.Resource{
3734
Schema: map[string]*schema.Schema{
3835
"database": {
3936
Type: schema.TypeString,
4037
Required: true,
41-
Description: "Database name that requires authorization, fill in * to represent all databases under the current catalog. When the authorization type is administrator level, only * is allowed to be filled in. when the authorization type is data connection level, only blanks are allowed to be filled in. For other types, the database can be specified arbitrarily.",
38+
Description: "The name of the target database. `*` represents all databases in the current catalog. To grant admin permissions, it must be `*`; to grant data connection permissions, it must be null; to grant other permissions, it can be any database.",
4239
},
4340
"catalog": {
4441
Type: schema.TypeString,
4542
Required: true,
46-
Description: "For the data source name that requires authorization, only * (representing all resources at this level) is supported under the administrator level; in the case of data source level and database level authentication, only COSDataCatalog or * is supported; in data table level authentication, it is possible Fill in the user-defined data source. If left blank, it defaults to DataLakeCatalog. note: If a user-defined data source is authenticated, the permissions that dlc can manage are a subset of the accounts provided by the user when accessing the data source.",
43+
Description: "The name of the target data source. To grant admin permission, it must be `*` (all resources at this level); to grant data source and database permissions, it must be `COSDataCatalog` or `*`; to grant table permissions, it can be a custom data source; if it is left empty, `DataLakeCatalog` is used. Note: To grant permissions on a custom data source, the permissions that can be managed in the Data Lake Compute console are subsets of the account permissions granted when you connect the data source to the console.",
4744
},
4845
"table": {
4946
Type: schema.TypeString,
5047
Required: true,
51-
Description: "For the table name that requires authorization, fill in * to represent all tables under the current database. when the authorization type is administrator level, only * is allowed to be filled in. when the authorization type is data connection level or database level, only blanks are allowed to be filled in. For other types, data tables can be specified arbitrarily.",
48+
Description: "The name of the target table. `*` represents all tables in the current database. To grant admin permissions, it must be `*`; to grant data connection and database permissions, it must be null; to grant other permissions, it can be any table.",
5249
},
5350
"operation": {
5451
Type: schema.TypeString,
5552
Required: true,
56-
Description: "Authorized permission operations provide different operations for different levels of authentication. administrator permissions: ALL, default is ALL if left blank; data connection level authentication: CREATE; database level authentication: ALL, CREATE, ALTER, DROP; data table permissions: ALL, SELECT, INSERT, ALTER, DELETE, DROP, UPDATE. note: under data table permissions, only SELECT operations are supported when the specified data source is not COSDataCatalog.",
53+
Description: "The target permissions, which vary by permission level. Admin: `ALL` (default); data connection: `CREATE`; database: `ALL`, `CREATE`, `ALTER`, and `DROP`; table: `ALL`, `SELECT`, `INSERT`, `ALTER`, `DELETE`, `DROP`, and `UPDATE`. Note: For table permissions, if a data source other than `COSDataCatalog` is specified, only the `SELECT` permission can be granted here.",
5754
},
5855
"policy_type": {
5956
Type: schema.TypeString,
6057
Optional: true,
61-
Description: "Authorization type, currently supports eight authorization types: ADMIN: Administrator level authentication DATASOURCE: data connection level authentication DATABASE: database level authentication TABLE: Table level authentication VIEW: view level authentication FUNCTION: Function level authentication COLUMN: Column level authentication ENGINE: Data engine authentication. if left blank, the default is administrator level authentication.",
58+
Description: "The permission type. Valid values: `ADMIN`, `DATASOURCE`, `DATABASE`, `TABLE`, `VIEW`, `FUNCTION`, `COLUMN`, and `ENGINE`. Note: If it is left empty, `ADMIN` is used.",
6259
},
6360
"function": {
6461
Type: schema.TypeString,
6562
Optional: true,
66-
Description: "For the function name that requires authorization, fill in * to represent all functions under the current catalog. when the authorization type is administrator level, only * is allowed to be filled in. When the authorization type is data connection level, only blanks are allowed to be filled in. in other types, functions can be specified arbitrarily.",
63+
Description: "The name of the target function. `*` represents all functions in the current catalog. To grant admin permissions, it must be `*`; to grant data connection permissions, it must be null; to grant other permissions, it can be any function.",
6764
},
6865
"view": {
6966
Type: schema.TypeString,
7067
Optional: true,
71-
Description: "For views that require authorization, fill in * to represent all views under the current database. When the authorization type is administrator level, only * is allowed to be filled in. when the authorization type is data connection level or database level, only blanks are allowed to be filled in. for other types, the view can be specified arbitrarily.",
68+
Description: "The name of the target view. `*` represents all views in the current database. To grant admin permissions, it must be `*`; to grant data connection and database permissions, it must be null; to grant other permissions, it can be any view.",
7269
},
7370
"column": {
7471
Type: schema.TypeString,
7572
Optional: true,
76-
Description: "For columns that require authorization, fill in * to represent all current columns. When the authorization type is administrator level, only * is allowed.",
73+
Description: "The name of the target column. `*` represents all columns. To grant admin permissions, it must be `*`.",
7774
},
7875
"data_engine": {
7976
Type: schema.TypeString,
8077
Optional: true,
81-
Description: "Data engines that require authorization, fill in * to represent all current engines. when the authorization type is administrator level, only * is allowed.",
78+
Description: "The name of the target data engine. `*` represents all engines. To grant admin permissions, it must be `*`.",
8279
},
8380
"re_auth": {
8481
Type: schema.TypeBool,
8582
Optional: true,
86-
Description: "Whether the user can perform secondary authorization. when it is true, the authorized user can re-authorize the permissions obtained this time to other sub-users. default is false.",
83+
Description: "Whether the grantee is allowed to further grant the permissions. Valid values: `false` (default) and `true` (the grantee can grant permissions gained here to other sub-users).",
8784
},
8885
"source": {
8986
Type: schema.TypeString,
9087
Optional: true,
91-
Description: "Permission source, please leave it blank. USER: permissions come from the user itself; WORKGROUP: permissions come from the bound workgroup.",
88+
Description: "The permission source, which is not required when input parameters are passed in. Valid values: `USER` (from the user) and `WORKGROUP` (from one or more associated work groups).",
9289
},
9390
"mode": {
9491
Type: schema.TypeString,
9592
Optional: true,
96-
Description: "Authorization mode, please leave this parameter blank. COMMON: normal mode; SENIOR: advanced mode.",
93+
Description: "The grant mode, which is not required as an input parameter. Valid values: `COMMON` and `SENIOR`.",
9794
},
9895
"operator": {
9996
Type: schema.TypeString,
10097
Optional: true,
101-
Description: "Operator, do not fill in the input parameters.",
98+
Description: "The operator, which is not required as an input parameter.",
10299
},
103100
"create_time": {
104101
Type: schema.TypeString,
105102
Optional: true,
106-
Description: "The time when the permission was created. Leave the input parameter blank.",
103+
Description: "The permission policy creation time, which is not required as an input parameter.",
107104
},
108105
"source_id": {
109106
Type: schema.TypeInt,
110107
Optional: true,
111-
Description: "The id of the workgroup to which the permission belongs. this value only exists when the source of the permission is a workgroup. that is, this field has a value only when the value of the Source field is WORKGROUP.",
108+
Description: " The ID of the work group, which applies only when the value of the `Source` field is `WORKGROUP`.",
112109
},
113110
"source_name": {
114111
Type: schema.TypeString,
115112
Optional: true,
116-
Description: "The name of the workgroup to which the permission belongs. this value only exists when the source of the permission is a workgroup. that is, this field has a value only when the value of the source field is WORKGROUP.",
113+
Description: "The name of the work group, which applies only when the value of the `Source` field is `WORKGROUP`.",
117114
},
118115
"id": {
119116
Type: schema.TypeInt,
120117
Optional: true,
121-
Description: "Policy id.",
118+
Description: "The policy ID.",
122119
},
123120
},
124121
},
@@ -131,12 +128,12 @@ func resourceTencentCloudDlcAttachUserPolicyOperationCreate(d *schema.ResourceDa
131128
defer tccommon.LogElapsed("resource.tencentcloud_dlc_attach_user_policy_operation.create")()
132129
defer tccommon.InconsistentCheck(d, meta)()
133130

134-
logId := tccommon.GetLogId(tccommon.ContextNil)
135-
136131
var (
132+
logId = tccommon.GetLogId(tccommon.ContextNil)
137133
request = dlc.NewAttachUserPolicyRequest()
138134
userId string
139135
)
136+
140137
if v, ok := d.GetOk("user_id"); ok {
141138
userId = v.(string)
142139
request.UserId = helper.String(v.(string))
@@ -149,54 +146,71 @@ func resourceTencentCloudDlcAttachUserPolicyOperationCreate(d *schema.ResourceDa
149146
if v, ok := dMap["database"]; ok {
150147
policy.Database = helper.String(v.(string))
151148
}
149+
152150
if v, ok := dMap["catalog"]; ok {
153151
policy.Catalog = helper.String(v.(string))
154152
}
153+
155154
if v, ok := dMap["table"]; ok {
156155
policy.Table = helper.String(v.(string))
157156
}
157+
158158
if v, ok := dMap["operation"]; ok {
159159
policy.Operation = helper.String(v.(string))
160160
}
161+
161162
if v, ok := dMap["policy_type"]; ok {
162163
policy.PolicyType = helper.String(v.(string))
163164
}
165+
164166
if v, ok := dMap["function"]; ok {
165167
policy.Function = helper.String(v.(string))
166168
}
169+
167170
if v, ok := dMap["view"]; ok {
168171
policy.View = helper.String(v.(string))
169172
}
173+
170174
if v, ok := dMap["column"]; ok {
171175
policy.Column = helper.String(v.(string))
172176
}
177+
173178
if v, ok := dMap["data_engine"]; ok {
174179
policy.DataEngine = helper.String(v.(string))
175180
}
181+
176182
if v, ok := dMap["re_auth"]; ok {
177183
policy.ReAuth = helper.Bool(v.(bool))
178184
}
185+
179186
if v, ok := dMap["source"]; ok {
180187
policy.Source = helper.String(v.(string))
181188
}
189+
182190
if v, ok := dMap["mode"]; ok {
183191
policy.Mode = helper.String(v.(string))
184192
}
193+
185194
if v, ok := dMap["operator"]; ok {
186195
policy.Operator = helper.String(v.(string))
187196
}
197+
188198
if v, ok := dMap["create_time"]; ok {
189199
policy.CreateTime = helper.String(v.(string))
190200
}
201+
191202
if v, ok := dMap["source_id"]; ok {
192203
policy.SourceId = helper.IntInt64(v.(int))
193204
}
205+
194206
if v, ok := dMap["source_name"]; ok {
195207
policy.SourceName = helper.String(v.(string))
196208
}
209+
197210
if v, ok := dMap["id"]; ok {
198211
policy.Id = helper.IntInt64(v.(int))
199212
}
213+
200214
request.PolicySet = append(request.PolicySet, &policy)
201215
}
202216
}
@@ -208,15 +222,16 @@ func resourceTencentCloudDlcAttachUserPolicyOperationCreate(d *schema.ResourceDa
208222
} else {
209223
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
210224
}
225+
211226
return nil
212227
})
228+
213229
if err != nil {
214-
log.Printf("[CRITAL]%s operate dlc attachUserPolicyOperation failed, reason:%+v", logId, err)
230+
log.Printf("[CRITAL]%s operate dlc attach user policy failed, reason:%+v", logId, err)
215231
return err
216232
}
217233

218234
d.SetId(userId)
219-
220235
return resourceTencentCloudDlcAttachUserPolicyOperationRead(d, meta)
221236
}
222237

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
Provides a resource to create a dlc attach_user_policy_operation
1+
Provides a resource to create a DLC attach user policy operation
22

33
Example Usage
44

55
```hcl
6-
resource "tencentcloud_dlc_attach_user_policy_operation" "attach_user_policy_operation" {
6+
resource "tencentcloud_dlc_attach_user_policy_operation" "example" {
77
user_id = "100032676511"
88
policy_set {
9-
database = "test_iac_keep"
10-
catalog = "DataLakeCatalog"
11-
table = ""
12-
operation = "ASSAYER"
13-
policy_type = "DATABASE"
14-
function = ""
15-
view = ""
16-
column = ""
17-
source = "USER"
18-
mode = "COMMON"
9+
database = "tf_example_db"
10+
catalog = "DataLakeCatalog"
11+
table = "tf_example_table"
12+
operation = "ASSAYER"
13+
policy_type = "DATABASE"
14+
source = "USER"
15+
mode = "COMMON"
1916
}
2017
}
2118
```

0 commit comments

Comments
 (0)