Skip to content

Commit d8c793d

Browse files
committed
add docs to deprecated resource
1 parent ca1cca6 commit d8c793d

37 files changed

+1083
-556
lines changed

gendoc/main.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,21 @@ func genIdx(fpath string) {
146146
fd, err := os.OpenFile(fname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
147147
if err != nil {
148148
log.Printf("[FAIL!]open file %s failed: %s", fname, err)
149-
return
149+
os.Exit(1)
150150
}
151151

152152
defer fd.Close()
153153
t := template.Must(template.New("t").Parse(idxTPL))
154154
err = t.Execute(fd, data)
155155
if err != nil {
156156
log.Printf("[FAIL!]write file %s failed: %s", fname, err)
157-
return
157+
os.Exit(1)
158158
}
159159

160160
log.Printf("[SUCC.]write doc to file success: %s", fname)
161161
}
162162

163-
// genDoc generating doc for resource
163+
// genDoc generating doc for data source and resource
164164
func genDoc(dtype, fpath, name string, resource *schema.Resource) {
165165
data := map[string]string{
166166
"name": name,
@@ -179,14 +179,14 @@ func genDoc(dtype, fpath, name string, resource *schema.Resource) {
179179

180180
description, err := getFileDescription(fmt.Sprintf("%s/%s", fpath, fname))
181181
if err != nil {
182-
log.Printf("[SKIP!]get description failed, skip: %s", err)
183-
return
182+
log.Printf("[FAIL!]get description failed: %s", err)
183+
os.Exit(1)
184184
}
185185

186186
description = strings.TrimSpace(description)
187187
if description == "" {
188-
log.Printf("[SKIP!]description empty, skip: %s\n", fname)
189-
return
188+
log.Printf("[FAIL!]description empty: %s\n", fname)
189+
os.Exit(1)
190190
}
191191

192192
importPos := strings.Index(description, "\nImport\n")
@@ -200,8 +200,8 @@ func genDoc(dtype, fpath, name string, resource *schema.Resource) {
200200
data["example"] = formatHCL(description[pos+15:])
201201
description = strings.TrimSpace(description[:pos])
202202
} else {
203-
log.Printf("[SKIP!]example usage missing, skip: %s\n", fname)
204-
return
203+
log.Printf("[FAIL!]example usage missing: %s\n", fname)
204+
os.Exit(1)
205205
}
206206

207207
data["description"] = description
@@ -219,7 +219,8 @@ func genDoc(dtype, fpath, name string, resource *schema.Resource) {
219219

220220
for k, v := range resource.Schema {
221221
if v.Description == "" {
222-
continue
222+
log.Printf("[FAIL!]description for '%s' is missing: %s\n", k, fname)
223+
os.Exit(1)
223224
} else {
224225
checkDescription(k, v.Description)
225226
}
@@ -290,15 +291,15 @@ func genDoc(dtype, fpath, name string, resource *schema.Resource) {
290291
fd, err := os.OpenFile(fname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
291292
if err != nil {
292293
log.Printf("[FAIL!]open file %s failed: %s", fname, err)
293-
return
294+
os.Exit(1)
294295
}
295296

296297
defer fd.Close()
297298
t := template.Must(template.New("t").Parse(docTPL))
298299
err = t.Execute(fd, data)
299300
if err != nil {
300301
log.Printf("[FAIL!]write file %s failed: %s", fname, err)
301-
return
302+
os.Exit(1)
302303
}
303304

304305
log.Printf("[SUCC.]write doc to file success: %s", fname)

tencentcloud/data_source_tc_common_schema.go

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

tencentcloud/data_source_tc_container_cluster_instances.go

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
Get all instances of the specific cluster.
3+
4+
Use this data source to get all instances in a specific cluster.
5+
6+
~> **NOTE:** It has been deprecated and replaced by tencentcloud_kubernetes_clusters.
7+
8+
Example Usage
9+
10+
```hcl
11+
data "tencentcloud_container_cluster_instances" "foo_instance" {
12+
cluster_id = "cls-abcdefg"
13+
}
14+
```
15+
*/
116
package tencentcloud
217

318
import (
@@ -17,49 +32,60 @@ func dataSourceTencentCloudContainerClusterInstances() *schema.Resource {
1732

1833
Schema: map[string]*schema.Schema{
1934
"cluster_id": {
20-
Type: schema.TypeString,
21-
Required: true,
35+
Type: schema.TypeString,
36+
Required: true,
37+
Description: "An id identify the cluster, like cls-xxxxxx.",
2238
},
2339
"limit": {
24-
Type: schema.TypeInt,
25-
Optional: true,
40+
Type: schema.TypeInt,
41+
Optional: true,
42+
Description: "An int variable describe how many instances in return at most.",
2643
},
2744
"total_count": {
28-
Type: schema.TypeInt,
29-
Computed: true,
45+
Type: schema.TypeInt,
46+
Computed: true,
47+
Description: "Number of instances.",
3048
},
3149
"nodes": {
32-
Computed: true,
33-
Type: schema.TypeList,
50+
Computed: true,
51+
Type: schema.TypeList,
52+
Description: "An information list of kubernetes instances.",
3453
Elem: &schema.Resource{
3554
Schema: map[string]*schema.Schema{
3655
"abnormal_reason": {
37-
Type: schema.TypeString,
38-
Computed: true,
56+
Type: schema.TypeString,
57+
Computed: true,
58+
Description: "Describe the reason when node is in abnormal state(if it was).",
3959
},
4060
"cpu": {
41-
Type: schema.TypeInt,
42-
Computed: true,
61+
Type: schema.TypeInt,
62+
Computed: true,
63+
Description: "Describe the cpu of the node.",
4364
},
4465
"mem": {
45-
Type: schema.TypeInt,
46-
Computed: true,
66+
Type: schema.TypeInt,
67+
Computed: true,
68+
Description: "Describe the memory of the node.",
4769
},
4870
"instance_id": {
49-
Type: schema.TypeString,
50-
Computed: true,
71+
Type: schema.TypeString,
72+
Computed: true,
73+
Description: "An id identify the node, provided by cvm.",
5174
},
5275
"is_normal": {
53-
Type: schema.TypeInt,
54-
Computed: true,
76+
Type: schema.TypeInt,
77+
Computed: true,
78+
Description: "Describe whether the node is normal.",
5579
},
5680
"wan_ip": {
57-
Type: schema.TypeString,
58-
Computed: true,
81+
Type: schema.TypeString,
82+
Computed: true,
83+
Description: "Describe the wan ip of the node.",
5984
},
6085
"lan_ip": {
61-
Type: schema.TypeString,
62-
Computed: true,
86+
Type: schema.TypeString,
87+
Computed: true,
88+
Description: "Describe the lan ip of the node.",
6389
},
6490
},
6591
},

tencentcloud/data_source_tc_container_clusters.go

Lines changed: 62 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*
2+
Get container clusters in the current region.
3+
4+
Use this data source to get container clusters in the current region. By default every clusters in current region will be returned.
5+
6+
~> **NOTE:** It has been deprecated and replaced by tencentcloud_kubernetes_clusters.
7+
8+
Example Usage
9+
10+
```hcl
11+
data "tencentcloud_container_clusters" "foo" {
12+
}
13+
```
14+
*/
115
package tencentcloud
216

317
import (
@@ -17,69 +31,85 @@ func dataSourceTencentCloudContainerClusters() *schema.Resource {
1731

1832
Schema: map[string]*schema.Schema{
1933
"cluster_id": {
20-
Type: schema.TypeString,
21-
Optional: true,
34+
Type: schema.TypeString,
35+
Optional: true,
36+
Description: "An id identify the cluster, like `cls-xxxxxx`.",
2237
},
2338
"limit": {
24-
Type: schema.TypeInt,
25-
Optional: true,
39+
Type: schema.TypeInt,
40+
Optional: true,
41+
Description: "An int variable describe how many cluster in return at most.",
2642
},
2743
"total_count": {
28-
Type: schema.TypeInt,
29-
Computed: true,
44+
Type: schema.TypeInt,
45+
Computed: true,
46+
Description: "Number of clusters.",
3047
},
3148
"clusters": {
32-
Type: schema.TypeList,
33-
Computed: true,
49+
Type: schema.TypeList,
50+
Computed: true,
51+
Description: "An information list of kubernetes clusters.",
3452
Elem: &schema.Resource{
3553
Schema: map[string]*schema.Schema{
3654
"cluster_id": {
37-
Type: schema.TypeString,
38-
Computed: true,
55+
Type: schema.TypeString,
56+
Computed: true,
57+
Description: "An id identify the cluster, like `cls-xxxxxx`.",
3958
},
4059
"cluster_name": {
41-
Type: schema.TypeString,
42-
Computed: true,
60+
Type: schema.TypeString,
61+
Computed: true,
62+
Description: "Name the cluster.",
4363
},
4464
"security_certification_authority": {
45-
Type: schema.TypeString,
46-
Computed: true,
65+
Type: schema.TypeString,
66+
Computed: true,
67+
Description: "Describe the certificate string needed for using kubectl to access to kubernetes.",
4768
},
4869
"security_cluster_external_endpoint": {
49-
Type: schema.TypeString,
50-
Computed: true,
70+
Type: schema.TypeString,
71+
Computed: true,
72+
Description: "Describe the address needed for using kubectl to access to kubernetes.",
5173
},
5274
"security_username": {
53-
Type: schema.TypeString,
54-
Computed: true,
75+
Type: schema.TypeString,
76+
Computed: true,
77+
Description: "Describe the username needed for using kubectl to access to kubernetes.",
5578
},
5679
"security_password": {
57-
Type: schema.TypeString,
58-
Computed: true,
80+
Type: schema.TypeString,
81+
Computed: true,
82+
Description: "Describe the password needed for using kubectl to access to kubernetes.",
5983
},
6084
"description": {
61-
Type: schema.TypeString,
62-
Computed: true,
85+
Type: schema.TypeString,
86+
Computed: true,
87+
Description: "The description of the cluster.",
6388
},
6489
"kubernetes_version": {
65-
Type: schema.TypeString,
66-
Computed: true,
90+
Type: schema.TypeString,
91+
Computed: true,
92+
Description: "Describe the running kubernetes version on the cluster.",
6793
},
6894
"nodes_num": {
69-
Type: schema.TypeInt,
70-
Computed: true,
95+
Type: schema.TypeInt,
96+
Computed: true,
97+
Description: "Describe how many cluster instances in the cluster.",
7198
},
7299
"nodes_status": {
73-
Type: schema.TypeString,
74-
Computed: true,
100+
Type: schema.TypeString,
101+
Computed: true,
102+
Description: "Describe the current status of the instances in the cluster.",
75103
},
76104
"total_cpu": {
77-
Type: schema.TypeInt,
78-
Computed: true,
105+
Type: schema.TypeInt,
106+
Computed: true,
107+
Description: "Describe the total cpu of each instance in the cluster.",
79108
},
80109
"total_mem": {
81-
Type: schema.TypeInt,
82-
Computed: true,
110+
Type: schema.TypeInt,
111+
Computed: true,
112+
Description: "Describe the total memory of each instance in the cluster.",
83113
},
84114
},
85115
},

0 commit comments

Comments
 (0)