Skip to content

Commit afb5e8a

Browse files
committed
add
1 parent cb79b75 commit afb5e8a

11 files changed

+65
-27
lines changed

tencentcloud/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ func Provider() *schema.Provider {
11751175
"tencentcloud_cdwpg_instances": cdwpg.DataSourceTencentCloudCdwpgInstances(),
11761176
"tencentcloud_cdwpg_log": cdwpg.DataSourceTencentCloudCdwpgLog(),
11771177
"tencentcloud_cdwpg_nodes": cdwpg.DataSourceTencentCloudCdwpgNodes(),
1178-
"tencentcloud_mqtt_apply_registration_code": mqtt.DataSourceTencentCloudMqttApplyRegistrationCode(),
1178+
"tencentcloud_mqtt_registration_code": mqtt.DataSourceTencentCloudMqttRegistrationCode(),
11791179
},
11801180

11811181
ResourcesMap: map[string]*schema.Resource{

tencentcloud/provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,7 @@ tencentcloud_tcss_image_registry
22882288

22892289
TDMQ for MQTT(MQTT)
22902290
Data Source
2291-
tencentcloud_mqtt_apply_registration_code
2291+
tencentcloud_mqtt_registration_code
22922292
Resource
22932293
tencentcloud_mqtt_instance
22942294
tencentcloud_mqtt_instance_public_endpoint

tencentcloud/services/mqtt/data_source_tc_mqtt_apply_registration_code.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

tencentcloud/services/mqtt/data_source_tc_mqtt_apply_registration_code.go renamed to tencentcloud/services/mqtt/data_source_tc_mqtt_registration_code.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
1313
)
1414

15-
func DataSourceTencentCloudMqttApplyRegistrationCode() *schema.Resource {
15+
func DataSourceTencentCloudMqttRegistrationCode() *schema.Resource {
1616
return &schema.Resource{
17-
Read: dataSourceTencentCloudMqttApplyRegistrationCodeRead,
17+
Read: dataSourceTencentCloudMqttRegistrationCodeRead,
1818
Schema: map[string]*schema.Schema{
1919
"instance_id": {
2020
Type: schema.TypeString,
@@ -37,8 +37,8 @@ func DataSourceTencentCloudMqttApplyRegistrationCode() *schema.Resource {
3737
}
3838
}
3939

40-
func dataSourceTencentCloudMqttApplyRegistrationCodeRead(d *schema.ResourceData, meta interface{}) error {
41-
defer tccommon.LogElapsed("data_source.tencentcloud_mqtt_apply_registration_code.read")()
40+
func dataSourceTencentCloudMqttRegistrationCodeRead(d *schema.ResourceData, meta interface{}) error {
41+
defer tccommon.LogElapsed("data_source.tencentcloud_mqtt_registration_code.read")()
4242
defer tccommon.InconsistentCheck(d, meta)()
4343

4444
var (
@@ -56,7 +56,7 @@ func dataSourceTencentCloudMqttApplyRegistrationCodeRead(d *schema.ResourceData,
5656

5757
var respData *mqttv20240516.ApplyRegistrationCodeResponseParams
5858
reqErr := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
59-
result, e := service.DescribeMqttApplyRegistrationCodeByFilter(ctx, paramMap)
59+
result, e := service.DescribeMqttRegistrationCodeByFilter(ctx, paramMap)
6060
if e != nil {
6161
return tccommon.RetryError(e)
6262
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Use this data source to query detailed information of MQTT registration code
2+
3+
Example Usage
4+
5+
```hcl
6+
data "tencentcloud_mqtt_registration_code" "example" {
7+
instance_id = "mqtt-zxjwkr98"
8+
}
9+
```

tencentcloud/services/mqtt/data_source_tc_mqtt_apply_registration_code_test.go renamed to tencentcloud/services/mqtt/data_source_tc_mqtt_registration_code_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ import (
88
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
99
)
1010

11-
func TestAccTencentCloudMqttApplyRegistrationCodeDataSource_basic(t *testing.T) {
11+
func TestAccTencentCloudMqttRegistrationCodeDataSource_basic(t *testing.T) {
1212
t.Parallel()
1313
resource.Test(t, resource.TestCase{
1414
PreCheck: func() {
1515
tcacctest.AccPreCheck(t)
1616
},
1717
Providers: tcacctest.AccProviders,
1818
Steps: []resource.TestStep{{
19-
Config: testAccMqttApplyRegistrationCodeDataSource,
19+
Config: testAccMqttRegistrationCodeDataSource,
2020
Check: resource.ComposeTestCheckFunc(
21-
resource.TestCheckResourceAttrSet("data.tencentcloud_mqtt_apply_registration_code.example", "id"),
22-
resource.TestCheckResourceAttrSet("data.tencentcloud_mqtt_apply_registration_code.example", "instance_id"),
21+
resource.TestCheckResourceAttrSet("data.tencentcloud_mqtt_registration_code.example", "id"),
22+
resource.TestCheckResourceAttrSet("data.tencentcloud_mqtt_registration_code.example", "instance_id"),
2323
),
2424
}},
2525
})
2626
}
2727

28-
const testAccMqttApplyRegistrationCodeDataSource = `
29-
data "tencentcloud_mqtt_apply_registration_code" "example" {
28+
const testAccMqttRegistrationCodeDataSource = `
29+
data "tencentcloud_mqtt_registration_code" "example" {
3030
instance_id = "mqtt-zxjwkr98"
3131
}
3232
`

tencentcloud/services/mqtt/resource_tc_mqtt_user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func ResourceTencentCloudMqttUser() *schema.Resource {
4242
Type: schema.TypeString,
4343
Optional: true,
4444
Computed: true,
45-
ForceNew: true,
4645
Sensitive: true,
4746
Description: "Password, when this field is empty, the backend will generate it by default.",
4847
},
@@ -191,6 +190,10 @@ func resourceTencentCloudMqttUserUpdate(d *schema.ResourceData, meta interface{}
191190
instanceId := idSplit[0]
192191
userName := idSplit[1]
193192

193+
if d.HasChange("password") {
194+
return fmt.Errorf("`password` can not be changed.")
195+
}
196+
194197
if d.HasChange("remark") {
195198
request := mqttv20240516.NewModifyUserRequest()
196199
if v, ok := d.GetOk("remark"); ok {

tencentcloud/services/mqtt/service_tencentcloud_mqtt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (me *MqttService) DescribeMqttTopicById(ctx context.Context, instanceId str
102102
return
103103
}
104104

105-
func (me *MqttService) DescribeMqttApplyRegistrationCodeByFilter(ctx context.Context, param map[string]interface{}) (ret *mqttv20240516.ApplyRegistrationCodeResponseParams, errRet error) {
105+
func (me *MqttService) DescribeMqttRegistrationCodeByFilter(ctx context.Context, param map[string]interface{}) (ret *mqttv20240516.ApplyRegistrationCodeResponseParams, errRet error) {
106106
var (
107107
logId = tccommon.GetLogId(ctx)
108108
request = mqttv20240516.NewApplyRegistrationCodeRequest()
@@ -121,12 +121,12 @@ func (me *MqttService) DescribeMqttApplyRegistrationCodeByFilter(ctx context.Con
121121
}
122122

123123
ratelimit.Check(request.GetAction())
124-
125124
response, err := me.client.UseMqttV20240516Client().ApplyRegistrationCode(request)
126125
if err != nil {
127126
errRet = err
128127
return
129128
}
129+
130130
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
131131

132132
if response == nil || response.Response == nil {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
subcategory: "TDMQ for MQTT(MQTT)"
3+
layout: "tencentcloud"
4+
page_title: "TencentCloud: tencentcloud_mqtt_registration_code"
5+
sidebar_current: "docs-tencentcloud-datasource-mqtt_registration_code"
6+
description: |-
7+
Use this data source to query detailed information of MQTT registration code
8+
---
9+
10+
# tencentcloud_mqtt_registration_code
11+
12+
Use this data source to query detailed information of MQTT registration code
13+
14+
## Example Usage
15+
16+
```hcl
17+
data "tencentcloud_mqtt_registration_code" "example" {
18+
instance_id = "mqtt-zxjwkr98"
19+
}
20+
```
21+
22+
## Argument Reference
23+
24+
The following arguments are supported:
25+
26+
* `instance_id` - (Required, String) Instance ID.
27+
* `result_output_file` - (Optional, String) Used to save results.
28+
29+
## Attributes Reference
30+
31+
In addition to all arguments above, the following attributes are exported:
32+
33+
* `registration_code` - Registration code.
34+
35+

website/docs/r/mqtt_user.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The following arguments are supported:
2828

2929
* `instance_id` - (Required, String, ForceNew) Instance ID.
3030
* `username` - (Required, String, ForceNew) Username, cannot be empty, only supports uppercase and lowercase letter separators ("_", "-"), cannot exceed 32 characters.
31-
* `password` - (Optional, String, ForceNew) Password, when this field is empty, the backend will generate it by default.
31+
* `password` - (Optional, String) Password, when this field is empty, the backend will generate it by default.
3232
* `remark` - (Optional, String) Note that the length should not exceed 128 characters.
3333

3434
## Attributes Reference

website/tencentcloud.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4005,7 +4005,7 @@
40054005
<a href="#">Data Sources</a>
40064006
<ul class="nav nav-auto-expand">
40074007
<li>
4008-
<a href="/docs/providers/tencentcloud/d/mqtt_apply_registration_code.html">tencentcloud_mqtt_apply_registration_code</a>
4008+
<a href="/docs/providers/tencentcloud/d/mqtt_registration_code.html">tencentcloud_mqtt_registration_code</a>
40094009
</li>
40104010
</ul>
40114011
</li>

0 commit comments

Comments
 (0)