Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0b27c9

Browse files
author
mikatong
committedNov 1, 2024·
update gaap
1 parent 750fde6 commit c0b27c9

16 files changed

+323
-65
lines changed
 

‎tencentcloud/services/gaap/data_source_tc_gaap_http_domains.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ func DataSourceTencentCloudGaapHttpDomains() *schema.Resource {
102102
Computed: true,
103103
Description: "ID of the SSL certificate.",
104104
},
105+
"is_default_server": {
106+
Type: schema.TypeBool,
107+
Computed: true,
108+
Description: "Whether to use as the default domain name.",
109+
},
105110
},
106111
},
107112
},
@@ -191,6 +196,7 @@ func dataSourceTencentCloudGaapHttpDomainsRead(d *schema.ResourceData, m interfa
191196
"realserver_certificate_id": realserverCertificateId,
192197
"realserver_certificate_ids": realserverCertificateIds,
193198
"realserver_certificate_domain": dr.RealServerCertificateDomain,
199+
"is_default_server": dr.IsDefaultServer,
194200
}
195201

196202
domains = append(domains, m)

‎tencentcloud/services/gaap/data_source_tc_gaap_http_domains_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func TestAccDataSourceTencentCloudGaapHttpDomains_basic(t *testing.T) {
1414
t.Parallel()
1515
resource.Test(t, resource.TestCase{
16-
PreCheck: func() { tcacctest.AccPreCheckCommon(t, tcacctest.ACCOUNT_TYPE_PREPAY) },
16+
PreCheck: func() { tcacctest.AccPreCheck(t) },
1717
Providers: tcacctest.AccProviders,
1818
Steps: []resource.TestStep{
1919
{
@@ -28,6 +28,7 @@ func TestAccDataSourceTencentCloudGaapHttpDomains_basic(t *testing.T) {
2828
resource.TestCheckResourceAttrSet("data.tencentcloud_gaap_http_domains.foo", "domains.0.realserver_certificate_ids.#"),
2929
resource.TestCheckResourceAttrSet("data.tencentcloud_gaap_http_domains.foo", "domains.0.basic_auth"),
3030
resource.TestCheckResourceAttrSet("data.tencentcloud_gaap_http_domains.foo", "domains.0.gaap_auth"),
31+
resource.TestCheckResourceAttrSet("data.tencentcloud_gaap_http_domains.foo", "domains.0.is_default_server"),
3132
),
3233
},
3334
},

‎tencentcloud/services/gaap/data_source_tc_gaap_layer7_listeners.go

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ func DataSourceTencentCloudGaapLayer7Listeners() *schema.Resource {
2828
Optional: true,
2929
Description: "ID of the GAAP proxy to be queried.",
3030
},
31+
"group_id": {
32+
Type: schema.TypeString,
33+
Optional: true,
34+
Description: "Group id.",
35+
},
3136
"listener_id": {
3237
Type: schema.TypeString,
3338
Optional: true,
@@ -119,6 +124,18 @@ func DataSourceTencentCloudGaapLayer7Listeners() *schema.Resource {
119124
Computed: true,
120125
Description: "Creation time of the layer7 listener.",
121126
},
127+
"tls_support_versions": {
128+
Type: schema.TypeSet,
129+
Computed: true,
130+
Elem: &schema.Schema{Type: schema.TypeString},
131+
Set: schema.HashString,
132+
Description: "TLS version, optional TLSv1, TLSv1.1, TLSv1.2, TLSv1.3.",
133+
},
134+
"tls_ciphers": {
135+
Type: schema.TypeString,
136+
Computed: true,
137+
Description: "Password Suite, optional GAAP_TLS_CIPHERS_STRICT, GAAP_TLS_CIPHERS_GENERAL, GAAP_TLS_CIPHERS_WIDE(default).",
138+
},
122139
},
123140
},
124141
},
@@ -135,6 +152,7 @@ func dataSourceTencentCloudGaapLayer7ListenersRead(d *schema.ResourceData, m int
135152

136153
var (
137154
proxyId *string
155+
groupId *string
138156
listenerId *string
139157
name *string
140158
port *int
@@ -145,12 +163,15 @@ func dataSourceTencentCloudGaapLayer7ListenersRead(d *schema.ResourceData, m int
145163
if raw, ok := d.GetOk("proxy_id"); ok {
146164
proxyId = helper.String(raw.(string))
147165
}
166+
if raw, ok := d.GetOk("group_id"); ok {
167+
groupId = helper.String(raw.(string))
168+
}
148169
if raw, ok := d.GetOk("listener_id"); ok {
149170
listenerId = helper.String(raw.(string))
150171
}
151172

152-
if proxyId == nil && listenerId == nil {
153-
return errors.New("proxy_id or listener_id must be set")
173+
if proxyId == nil && groupId == nil && listenerId == nil {
174+
return errors.New("One of proxy_id, group_id or listener_id must be set")
154175
}
155176

156177
if raw, ok := d.GetOk("listener_name"); ok {
@@ -164,7 +185,7 @@ func dataSourceTencentCloudGaapLayer7ListenersRead(d *schema.ResourceData, m int
164185

165186
switch protocol {
166187
case "HTTP":
167-
httpListeners, err := service.DescribeHTTPListeners(ctx, proxyId, listenerId, name, port)
188+
httpListeners, err := service.DescribeHTTPListeners(ctx, proxyId, groupId, listenerId, name, port)
168189
if err != nil {
169190
return err
170191
}
@@ -190,20 +211,28 @@ func dataSourceTencentCloudGaapLayer7ListenersRead(d *schema.ResourceData, m int
190211
}
191212

192213
ids = append(ids, *ls.ListenerId)
193-
194-
listeners = append(listeners, map[string]interface{}{
214+
m := map[string]interface{}{
195215
"protocol": "HTTP",
196216
"id": *ls.ListenerId,
197-
"proxy_id": *ls.ProxyId,
198217
"name": *ls.ListenerName,
199218
"port": *ls.Port,
200219
"status": *ls.ListenerStatus,
201220
"create_time": helper.FormatUnixTime(*ls.CreateTime),
202-
})
221+
}
222+
223+
if ls.ProxyId != nil {
224+
m["proxy_id"] = *ls.ProxyId
225+
}
226+
if ls.GroupId != nil {
227+
m["group_id"] = *ls.GroupId
228+
}
229+
230+
listeners = append(listeners, m)
231+
203232
}
204233

205234
case "HTTPS":
206-
httpsListeners, err := service.DescribeHTTPSListeners(ctx, proxyId, listenerId, name, port)
235+
httpsListeners, err := service.DescribeHTTPSListeners(ctx, proxyId, groupId, listenerId, name, port)
207236
if err != nil {
208237
return err
209238
}
@@ -255,7 +284,6 @@ func dataSourceTencentCloudGaapLayer7ListenersRead(d *schema.ResourceData, m int
255284
"protocol": "HTTPS",
256285
"id": ls.ListenerId,
257286
"name": ls.ListenerName,
258-
"proxy_id": ls.ProxyId,
259287
"port": ls.Port,
260288
"status": ls.ListenerStatus,
261289
"certificate_id": ls.CertificateId,
@@ -264,6 +292,14 @@ func dataSourceTencentCloudGaapLayer7ListenersRead(d *schema.ResourceData, m int
264292
"create_time": helper.FormatUnixTime(*ls.CreateTime),
265293
"client_certificate_id": clientCertificateId,
266294
"client_certificate_ids": polyClientCertificateIds,
295+
"tls_ciphers": ls.TLSCiphers,
296+
"tls_support_versions": helper.PStrings(ls.TLSSupportVersion),
297+
}
298+
if ls.ProxyId != nil {
299+
m["proxy_id"] = *ls.ProxyId
300+
}
301+
if ls.GroupId != nil {
302+
m["group_id"] = *ls.GroupId
267303
}
268304

269305
listeners = append(listeners, m)

‎tencentcloud/services/gaap/data_source_tc_gaap_proxy_detail.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ func DataSourceTencentCloudGaapProxyDetail() *schema.Resource {
345345
Computed: true,
346346
Description: "Property bitmap, where each bit represents a property, where:0 indicates that the feature is not supported;1, indicates support for this feature.The meaning of the feature bitmap is as follows (from right to left):The first bit supports 4-layer acceleration;The second bit supports 7-layer acceleration;The third bit supports Http3 access;The fourth bit supports IPv6;The fifth bit supports high-quality BGP access;The 6th bit supports three network access;The 7th bit supports QoS acceleration in the access segment.Note: This field may return null, indicating that a valid value cannot be obtained.Note: This field may return null, indicating that a valid value cannot be obtained.",
347347
},
348+
"is_support_tls_choice": {
349+
Type: schema.TypeInt,
350+
Computed: true,
351+
Description: "Whether to allow TLS configuration.0-no support, 1-expressed support.",
352+
},
348353
},
349354
},
350355
},
@@ -629,6 +634,9 @@ func dataSourceTencentCloudGaapProxyDetailRead(d *schema.ResourceData, meta inte
629634
if proxyDetail.FeatureBitmap != nil {
630635
proxyInfoMap["feature_bitmap"] = proxyDetail.FeatureBitmap
631636
}
637+
if proxyDetail.IsSupportTLSChoice != nil {
638+
proxyInfoMap["is_support_tls_choice"] = proxyDetail.IsSupportTLSChoice
639+
}
632640

633641
_ = d.Set("proxy_detail", []interface{}{proxyInfoMap})
634642
}

‎tencentcloud/services/gaap/data_source_tc_gaap_proxy_statistics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func DataSourceTencentCloudGaapProxyStatistics() *schema.Resource {
4040
Elem: &schema.Schema{
4141
Type: schema.TypeString,
4242
},
43-
Description: "Metric Names. Valid values: InBandwidth,OutBandwidth, Concurrent, InPackets, OutPackets, PacketLoss, Latency, HttpQPS, HttpsQPS.",
43+
Description: "Metric Names. Valid values: InBandwidth,OutBandwidth, Concurrent, InPackets, OutPackets, PacketLoss, Latency, HttpQPS, HttpsQPS, HttpQPSPercent, HttpsQPSPercent.",
4444
},
4545

4646
"granularity": {

‎tencentcloud/services/gaap/resource_tc_gaap_http_domain.go

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ func ResourceTencentCloudGaapHttpDomain() *schema.Resource {
3131
ForceNew: true,
3232
Description: "ID of the layer7 listener.",
3333
},
34+
"group_id": {
35+
Type: schema.TypeString,
36+
Optional: true,
37+
ForceNew: true,
38+
Description: "Group Id.",
39+
},
40+
"is_default_server": {
41+
Type: schema.TypeBool,
42+
Optional: true,
43+
Default: false,
44+
Description: "Whether to use as the default domain name, the default is false.",
45+
},
3446
"domain": {
3547
Type: schema.TypeString,
3648
Required: true,
@@ -127,22 +139,23 @@ func resourceTencentCloudGaapHttpDomainCreate(d *schema.ResourceData, m interfac
127139

128140
listenerId := d.Get("listener_id").(string)
129141
domain := d.Get("domain").(string)
142+
isDefaultServer := d.Get("is_default_server").(bool)
130143

131144
service := GaapService{client: m.(tccommon.ProviderMeta).GetAPIV3Conn()}
132145

133146
var (
134147
protocol string
135148
forwardProtocol string
136149
)
137-
httpListeners, err := service.DescribeHTTPListeners(ctx, nil, &listenerId, nil, nil)
150+
httpListeners, err := service.DescribeHTTPListeners(ctx, nil, nil, &listenerId, nil, nil)
138151
if err != nil {
139152
return err
140153
}
141154
if len(httpListeners) > 0 {
142155
protocol = "HTTP"
143156
}
144157

145-
httpsListeners, err := service.DescribeHTTPSListeners(ctx, nil, &listenerId, nil, nil)
158+
httpsListeners, err := service.DescribeHTTPSListeners(ctx, nil, nil, &listenerId, nil, nil)
146159
if err != nil {
147160
return err
148161
}
@@ -156,7 +169,7 @@ func resourceTencentCloudGaapHttpDomainCreate(d *schema.ResourceData, m interfac
156169

157170
switch protocol {
158171
case "HTTP":
159-
if err := service.CreateHTTPDomain(ctx, listenerId, domain); err != nil {
172+
if err := service.CreateHTTPDomain(ctx, listenerId, domain, isDefaultServer); err != nil {
160173
return err
161174
}
162175

@@ -244,7 +257,7 @@ func resourceTencentCloudGaapHttpDomainCreate(d *schema.ResourceData, m interfac
244257
return errors.New("when use gaap auth, gaap auth id should be set")
245258
}
246259

247-
if err := service.CreateHTTPSDomain(ctx, listenerId, domain, certificateId, polyClientCertificateIds); err != nil {
260+
if err := service.CreateHTTPSDomain(ctx, listenerId, domain, certificateId, polyClientCertificateIds, isDefaultServer); err != nil {
248261
return err
249262
}
250263

@@ -350,6 +363,7 @@ func resourceTencentCloudGaapHttpDomainRead(d *schema.ResourceData, m interface{
350363
}
351364
_ = d.Set("gaap_auth", *httpDomain.GaapAuth == 1)
352365
_ = d.Set("gaap_auth_id", httpDomain.GaapCertificateId)
366+
_ = d.Set("is_default_server", httpDomain.IsDefaultServer)
353367

354368
return nil
355369
}
@@ -376,6 +390,7 @@ func resourceTencentCloudGaapHttpDomainUpdate(d *schema.ResourceData, m interfac
376390
}
377391

378392
listenerId, protocol, domain = split[0], split[1], split[2]
393+
isDefaultServer := d.Get("is_default_server").(bool)
379394
service := GaapService{client: m.(tccommon.ProviderMeta).GetAPIV3Conn()}
380395

381396
switch protocol {
@@ -387,9 +402,9 @@ func resourceTencentCloudGaapHttpDomainUpdate(d *schema.ResourceData, m interfac
387402
return fmt.Errorf("argument `%s` cannot be changed for http", v)
388403
}
389404
}
390-
if d.HasChange("domain") {
405+
if d.HasChange("domain") || d.HasChange("is_default_server") {
391406
oldDomain, newDomain := d.GetChange("domain")
392-
err := service.ModifyDomain(ctx, listenerId, oldDomain.(string), newDomain.(string))
407+
err := service.ModifyDomain(ctx, listenerId, oldDomain.(string), newDomain.(string), isDefaultServer)
393408
if err != nil {
394409
return err
395410
}
@@ -399,15 +414,15 @@ func resourceTencentCloudGaapHttpDomainUpdate(d *schema.ResourceData, m interfac
399414
case "HTTPS":
400415
}
401416

402-
if d.HasChange("domain") {
417+
if d.HasChange("domain") || d.HasChange("is_default_server") {
403418
oldDomain, newDomain := d.GetChange("domain")
404-
err := service.ModifyDomain(ctx, listenerId, oldDomain.(string), newDomain.(string))
419+
err := service.ModifyDomain(ctx, listenerId, oldDomain.(string), newDomain.(string), isDefaultServer)
405420
if err != nil {
406421
return err
407422
}
408423
}
409424

410-
listeners, err := service.DescribeHTTPSListeners(ctx, nil, &listenerId, nil, nil)
425+
listeners, err := service.DescribeHTTPSListeners(ctx, nil, nil, &listenerId, nil, nil)
411426
if err != nil {
412427
return err
413428
}

‎tencentcloud/services/gaap/resource_tc_gaap_http_domain_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func TestAccTencentCloudGaapHttpDomainResource_basic(t *testing.T) {
3636
resource.TestCheckResourceAttr("tencentcloud_gaap_http_domain.foo", "realserver_auth", "false"),
3737
resource.TestCheckResourceAttr("tencentcloud_gaap_http_domain.foo", "basic_auth", "false"),
3838
resource.TestCheckResourceAttr("tencentcloud_gaap_http_domain.foo", "gaap_auth", "false"),
39+
resource.TestCheckResourceAttr("tencentcloud_gaap_http_domain.foo", "is_default_server", "false"),
3940
),
4041
},
4142
{

0 commit comments

Comments
 (0)
Please sign in to comment.