Skip to content

Commit 308808a

Browse files
authored
Feat/support product (#1747)
* fix: update gaap * feat: support dnspod pts ses tat * fix: go fmt * fix: golangci-lint * fix: golangci-lint
1 parent 1fde02d commit 308808a

File tree

8 files changed

+534
-2
lines changed

8 files changed

+534
-2
lines changed

go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,15 +386,22 @@ require (
386386
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.392
387387
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.392
388388
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.392
389-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.392
389+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.694
390390
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.392
391+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.392
391392
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.392
392393
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.392
393394
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.0.392
395+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.694
394396
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.392
395397
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.392
398+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.392
399+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.392
396400
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.392
401+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392
397402
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.392
403+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.392
404+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.392
398405
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392
399406
)
400407

go.sum

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,8 +1516,9 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cme v1.0.392/go.mod h1:
15161516
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cmq v1.0.392/go.mod h1:SLXAFKr/NWd7WY2acH5YZnFMnzk+71tokVHB5V/1dEs=
15171517
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cms v1.0.392/go.mod h1:82E5sW1ChY7eqBhES81zuoVj3WHgSkLjH0kfEWbS0/s=
15181518
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
1519-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.392 h1:UqcmPErxEm77NwqaRq6J1i2rcbhXcZHzq7WOuc9clAQ=
15201519
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.392/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
1520+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.694 h1:4dqnDVXv3l7I7lixwAHW7tfFtdg9qfY6rwbq/KUkltQ=
1521+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.694/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
15211522
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cpdp v1.0.392/go.mod h1:McFISRmzeVkPd8qZQjQw870DARtJHjJZoHHYMkhYcZA=
15221523
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cr v1.0.392/go.mod h1:GZTyhAIbF0jhh76vReDXBXqd2+xfI4Fl8bM1mlq6Elg=
15231524
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.392 h1:nWW99NdwjHzoFiYzk+6QvVjituRpDSgGP33TX4XX+Jk=
@@ -1530,6 +1531,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dbbrain v1.0.392/go.mod
15301531
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.392/go.mod h1:ZH9Pa+f4npIaHKRW7Ll1nbZwA+nzXY1UqmCa1A1+ghQ=
15311532
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dcdb v1.0.392/go.mod h1:cCmgY7fqFQxOYeNwvpreGCeYRJQLO/flMBpiec75ZSQ=
15321533
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dlc v1.0.392/go.mod h1:ErUoZLFU9B7ooVZMADuu4jo4EVw5Ms7FlTJoa35Shtk=
1534+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.392 h1:7ulkCU1j4Pd1dMP3W1dtIJdbsozpmz6L7yKHqHFMCqs=
15331535
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.392/go.mod h1:VANa6/5PgNfc/LSztHhGJ/m8gPjNixXThFriVzHbyck=
15341536
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/domain v1.0.392/go.mod h1:m2tfIT1aLqKSkSs8E+n1UmcXce3c3+1hNQ7ztVHVFTE=
15351537
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/drm v1.0.392/go.mod h1:RnSU/F5NQjgWV7s6eWx/8jvZlGl0B8n5TrtwbBjXjVQ=
@@ -1601,6 +1603,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/partners v1.0.392/go.mo
16011603
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pds v1.0.392/go.mod h1:jVbtUhMGZwdYC5qPhhWlG5wLI/kqHns1aoJ/opH1gBI=
16021604
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.392/go.mod h1:7/xJYJ+/2X1q40woYOEvhaDx1wcHwQ2ZTYPncFnMFeM=
16031605
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.392/go.mod h1:L6ywKmxdqNziWG5piJdyN83gRS+KMOR2nsqoS5khtNI=
1606+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.694 h1:bXkBe6eiNPPY1/7EFFIP2osr+xHonJLcrQzXAAxQ/EY=
1607+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.694/go.mod h1:tfbStI3oCFz07Xve9lZ/3k5BYP0TjK1ncE0qkS3bbII=
16041608
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rce v1.0.392/go.mod h1:Q+Lj6ujWGd0VijJRdmnisHn0/K5MHlDwETZ5UNoDXRU=
16051609
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.392 h1:TWsBoGmj5VuGyHwCksgKxKrZIwVVwn5bTuDfRbWD/yY=
16061610
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.392/go.mod h1:kR0eQOu2//soHJHK8aDmIoU1f4jxamcVtzhuvpPqe3Y=
@@ -1609,9 +1613,11 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rp v1.0.392/go.mod h1:5
16091613
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.392/go.mod h1:wb1CKYRqu8oQAYBOCLpUnyc3A99gms+NvV3YLH0EpHc=
16101614
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.392 h1:X04ZC3AWxxNDZlhJhAqNtVPh/UGNl+ouxKf7HYDsT5o=
16111615
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.392/go.mod h1:XN1T6wRC+7dbBOa5Chyymgr6I+QoGpo8JaMvaHUypLY=
1616+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.392 h1:X7JfN/POHwRtzAO35RvaSKXfR1ekH5IPnFlKCNQ7Jrs=
16121617
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.392/go.mod h1:H9la1JWDbuXCx0XVtBRl85uJcYSV+U5SMqYFkQn9wHU=
16131618
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/smh v1.0.392/go.mod h1:WJZvkOhnu9hrxb98KFyKylBdY1AadH1rxiSBHpU4a/k=
16141619
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/smpn v1.0.392/go.mod h1:8KuArM+vHCijgUsnXmxkpYgtz7niFMLC32GCjeNcYLE=
1620+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.392 h1:zlJERQC6KQ1ye4TCmAM4xiji46mrL9moTgzUAKJB2OA=
16151621
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.392/go.mod h1:ak0fr7abDiet+ndTza5RMOt2Gc2plLQzoLbLbay/pqo=
16161622
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/soe v1.0.392/go.mod h1:Xys81ogDoqhHma+wp2eZtUgR522a0DSo+OIPUeahupw=
16171623
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/solar v1.0.392/go.mod h1:ER+ETUwbMzHiU4IdtlSwxTcapTCOnJvKBa+4HWLSeaM=
@@ -1624,6 +1630,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.392/go.mod h1:
16241630
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.392/go.mod h1:kWzzUFykmDWPoh3t6mO3Cm0pNJr3P0DHpmfITVVsA+g=
16251631
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/taf v1.0.392/go.mod h1:p/huA59BWTe2ICfslUzb9CmVkKS3d0kHzaPU1upcUj4=
16261632
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.392/go.mod h1:4lW1UzRtbnhOqKDTTkn6Ur9eBtJyzcgpg4KnLxsp/RM=
1633+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392 h1:pvuiEOVPvpWavsVu07LLrU4N+FBklCmCByQRvorNGPc=
16271634
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392/go.mod h1:khrPL4zu0yZ6nCvxmprL/exY5dX+aYLoq0Wf5ZA6zoQ=
16281635
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tav v1.0.392/go.mod h1:mVONhjO15kJGkTN092oi4C9I92RdC9wE4mlc9q6kmt0=
16291636
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tbaas v1.0.392/go.mod h1:xf2aD/TKZhvw3FHqQw/p6Ye+KpknwV1ieBA75F1mt6w=
@@ -1640,6 +1647,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcss v1.0.392/go.mod h1
16401647
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdcpg v1.0.392/go.mod h1:m21mWip509ME/nUwrA+n9rBLpBb8Bjuo/HkHuEojkZo=
16411648
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdid v1.0.392/go.mod h1:Do7u7dYFlitjrrXXMcnLivCGKVXI+mIENqFmqT4V/fs=
16421649
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.392/go.mod h1:LfFhQr0uPl2GrjE0r7XghDu0PUWCoGBilP9NooPmpog=
1650+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.392 h1:tt84c79EpBcD4lygiDMvtHKdhpeWVX0R0pjTWQRecWY=
16431651
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.392/go.mod h1:afUYlMwHkDmUle3ZGxz32+Q/cwyjFgMgaF62Q+qg6DU=
16441652
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.392/go.mod h1:kHQx6ynDcmtj3hjL8HFn8f0VCa88y8j3CouKZAHrEiU=
16451653
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.392/go.mod h1:ujCoikwjBD2UmfZspopyqjmEXfpcEma5b3vGxuWYCoU=
@@ -1663,6 +1671,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tts v1.0.392/go.mod h1:
16631671
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ump v1.0.392/go.mod h1:lYZ7A6MWoBw4FbxJKHTkebpHnbmxoHRIy2PJS5hmBVA=
16641672
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vm v1.0.392/go.mod h1:OhyaYhAbA0D8t4KeW9c0apOwDw1Hqzol0eY4Ez81IOI=
16651673
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vms v1.0.392/go.mod h1:PowsbqMUl5Rvy5LcO5aN8QTdI+9xAHxzDEpjMJ0tZ64=
1674+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.392 h1:heWRTAVG9vK6/dERomXs+VSHbPtktQC1xQ/6+1syjxo=
16661675
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.392/go.mod h1:sSLZPQ/C1k3HDBkNUpDxs5vWua7D7QRlBqYzWG+1FEA=
16671676
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392 h1:nx8MQ8yJ3srpfEAlKLQKtOsBCBc30QJ3Q0RsSOGSphQ=
16681677
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392/go.mod h1:IAl660UAxdUtp1rHUwbUwxFCVqwk61xAIRbBk6QtTy8=

providers/tencentcloud/dnspod.go

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright 2022 The Terraformer Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package tencentcloud
16+
17+
import (
18+
"strconv"
19+
20+
"github.com/GoogleCloudPlatform/terraformer/terraformutils"
21+
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
22+
dnspod "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod/v20210323"
23+
)
24+
25+
type DnspodGenerator struct {
26+
TencentCloudService
27+
}
28+
29+
func (g *DnspodGenerator) InitResources() error {
30+
args := g.GetArgs()
31+
region := args["region"].(string)
32+
credential := args["credential"].(common.Credential)
33+
profile := NewTencentCloudClientProfile()
34+
client, err := dnspod.NewClient(&credential, region, profile)
35+
if err != nil {
36+
return err
37+
}
38+
39+
return g.DescribeDomainList(client)
40+
}
41+
func (g *DnspodGenerator) DescribeDomainList(client *dnspod.Client) error {
42+
request := dnspod.NewDescribeDomainListRequest()
43+
44+
var offset int64
45+
var limit int64 = 50
46+
allInstances := make([]*dnspod.DomainListItem, 0)
47+
for {
48+
request.Offset = &offset
49+
request.Limit = &limit
50+
response, err := client.DescribeDomainList(request)
51+
if err != nil {
52+
return err
53+
}
54+
allInstances = append(allInstances, response.Response.DomainList...)
55+
if len(response.Response.DomainList) < int(limit) {
56+
break
57+
}
58+
59+
offset += limit
60+
}
61+
62+
for _, instance := range allInstances {
63+
resource := terraformutils.NewResource(
64+
*instance.Name,
65+
*instance.Name,
66+
"tencentcloud_dnspod_domain_instance",
67+
"tencentcloud",
68+
map[string]string{},
69+
[]string{},
70+
map[string]interface{}{},
71+
)
72+
g.Resources = append(g.Resources, resource)
73+
if err := g.DescribeRecordList(client, *instance.Name, resource.ResourceName); err != nil {
74+
return err
75+
}
76+
}
77+
78+
return nil
79+
}
80+
func (g *DnspodGenerator) DescribeRecordList(client *dnspod.Client, name, resourceName string) error {
81+
request := dnspod.NewDescribeRecordListRequest()
82+
83+
request.Domain = &name
84+
var offset uint64
85+
var limit uint64 = 50
86+
allInstances := make([]*dnspod.RecordListItem, 0)
87+
for {
88+
request.Offset = &offset
89+
request.Limit = &limit
90+
response, err := client.DescribeRecordList(request)
91+
if err != nil {
92+
return err
93+
}
94+
allInstances = append(allInstances, response.Response.RecordList...)
95+
if len(response.Response.RecordList) < int(limit) {
96+
break
97+
}
98+
99+
offset += limit
100+
}
101+
102+
for _, instance := range allInstances {
103+
resource := terraformutils.NewResource(
104+
name+"#"+strconv.FormatUint(*instance.RecordId, 10),
105+
name+"_"+strconv.FormatUint(*instance.RecordId, 10),
106+
"tencentcloud_dnspod_record",
107+
"tencentcloud",
108+
map[string]string{},
109+
[]string{},
110+
map[string]interface{}{},
111+
)
112+
resource.AdditionalFields["domain"] = "${tencentcloud_dnspod_domain_instance." + resourceName + ".id}"
113+
g.Resources = append(g.Resources, resource)
114+
}
115+
116+
return nil
117+
}

providers/tencentcloud/pts.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Copyright 2022 The Terraformer Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package tencentcloud
16+
17+
import (
18+
"github.com/GoogleCloudPlatform/terraformer/terraformutils"
19+
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
20+
pts "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts/v20210728"
21+
)
22+
23+
type PtsGenerator struct {
24+
TencentCloudService
25+
}
26+
27+
func (g *PtsGenerator) InitResources() error {
28+
args := g.GetArgs()
29+
region := args["region"].(string)
30+
credential := args["credential"].(common.Credential)
31+
profile := NewTencentCloudClientProfile()
32+
client, err := pts.NewClient(&credential, region, profile)
33+
if err != nil {
34+
return err
35+
}
36+
37+
return g.DescribeProjects(client)
38+
}
39+
func (g *PtsGenerator) DescribeProjects(client *pts.Client) error {
40+
request := pts.NewDescribeProjectsRequest()
41+
filters := make([]string, 0)
42+
for _, filter := range g.Filter {
43+
if filter.FieldPath == "id" && filter.IsApplicable("tencentcloud_pts_project") {
44+
filters = append(filters, filter.AcceptableValues...)
45+
}
46+
}
47+
48+
for i := range filters {
49+
request.ProjectIds = append(request.ProjectIds, &filters[i])
50+
}
51+
52+
var offset int64
53+
var limit int64 = 50
54+
allInstances := make([]*pts.Project, 0)
55+
for {
56+
request.Offset = &offset
57+
request.Limit = &limit
58+
response, err := client.DescribeProjects(request)
59+
if err != nil {
60+
return err
61+
}
62+
allInstances = append(allInstances, response.Response.ProjectSet...)
63+
if len(response.Response.ProjectSet) < int(limit) {
64+
break
65+
}
66+
67+
offset += limit
68+
}
69+
70+
for _, instance := range allInstances {
71+
resource := terraformutils.NewResource(
72+
*instance.ProjectId,
73+
*instance.ProjectId+"_"+*instance.ProjectId,
74+
"tencentcloud_pts_project",
75+
"tencentcloud",
76+
map[string]string{},
77+
[]string{},
78+
map[string]interface{}{},
79+
)
80+
g.Resources = append(g.Resources, resource)
81+
}
82+
83+
return nil
84+
}

0 commit comments

Comments
 (0)