Skip to content

[WIP]fix(ssl): [125307243] ssl certificate support notification_switch #3423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1107
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1148
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1182
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1193
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1153
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1161
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.748
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.486
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.1136
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1193
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.1142
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.860
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1170 h1:67T
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1170/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1182 h1:it8gutbUhh2l68CzKt0W3OAEytReLg4H9Wq1/ahkzmg=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1182/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1193 h1:anxhOjL4WrQDqUcX7eT8VEaQITiKWllKwsH1fEt6lBw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1193/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
Expand Down Expand Up @@ -1081,6 +1083,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.1136 h1:
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.1136/go.mod h1:m7a2VoL3Cf2dECJN3QZPnHwaqJAfG2Vu17sLpnfBqho=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015 h1:4fTbXtkXwleuDu/xYVELGpkuBLPgW+raED6y7Ni63sA=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1015/go.mod h1:0ZWI4Rd0p6LnXEvEaj/DbUza8B2s74AllJr1WXrsLtY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1193 h1:tmACSthp5JLjrdxzng6XFs4gfQcZHBTTVlXR0tO6hSk=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.1193/go.mod h1:LWf5UPUl41EQICrq0jswgQEO/BtRQY+CxAI6X+i709o=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691 h1:UE55TqueOP889MDcJ+cBW+MBjtzvWUw5fuOBWGCBIjs=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.691/go.mod h1:IRaYO5mSpBMPX8ydImTcL3jyuEkALEu/55Myb0a+GMs=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.524 h1:Hda8mBEoQVwkRAaZqztUAWn/n4HCYHZYEwzFBwYKaaM=
Expand Down
52 changes: 51 additions & 1 deletion tencentcloud/services/ssl/resource_tc_ssl_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func ResourceTencentCloudSslCertificate() *schema.Resource {
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: tccommon.ValidateAllowedStringValue(SSL_CERT_TYPE),
ForceNew: true,
ValidateFunc: tccommon.ValidateAllowedStringValue(SSL_CERT_TYPE),
Description: "Type of the SSL certificate. Valid values: `CA` and `SVR`.",
},
"project_id": {
Expand Down Expand Up @@ -92,6 +92,12 @@ func ResourceTencentCloudSslCertificate() *schema.Resource {
Computed: true,
Description: "Tags of the SSL certificate.",
},
"notification_switch": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Certificate expiration notification switch. 0: Do not ignore certificate expiration notifications. 1: Ignore certificate expiration notifications. Default is 0.",
},
// computed
"product_zh_name": {
Type: schema.TypeString,
Expand Down Expand Up @@ -206,6 +212,28 @@ func resourceTencentCloudSslCertificateCreate(d *schema.ResourceData, m interfac
}
d.SetId(id)

// set notification_switch on
if v, ok := d.GetOkExists("notification_switch"); ok {
if v.(int) == 1 {
request := ssl.NewModifyCertificatesExpiringNotificationSwitchRequest()
request.CertificateIds = helper.Strings([]string{id})
request.SwitchStatus = helper.IntUint64(v.(int))
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
_, e := m.(tccommon.ProviderMeta).GetAPIV3Conn().UseSSLCertificateClient().ModifyCertificatesExpiringNotificationSwitch(request)
if e != nil {
return tccommon.RetryError(e)
}

return nil
})

if err != nil {
log.Printf("[CRITAL]%s modify certificate switch status failed, reason: %v", logId, err)
return err
}
}
}

return resourceTencentCloudSslCertificateRead(d, m)
}

Expand Down Expand Up @@ -363,6 +391,28 @@ func resourceTencentCloudSslCertificateUpdate(d *schema.ResourceData, m interfac
return err
}
}

if d.HasChange("notification_switch") {
if v, ok := d.GetOkExists("notification_switch"); ok {
request := ssl.NewModifyCertificatesExpiringNotificationSwitchRequest()
request.CertificateIds = helper.Strings([]string{id})
request.SwitchStatus = helper.IntUint64(v.(int))
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
_, e := m.(tccommon.ProviderMeta).GetAPIV3Conn().UseSSLCertificateClient().ModifyCertificatesExpiringNotificationSwitch(request)
if e != nil {
return tccommon.RetryError(e)
}

return nil
})

if err != nil {
log.Printf("[CRITAL]%s modify certificate switch status failed, reason: %v", logId, err)
return err
}
}
}

d.Partial(false)
return resourceTencentCloudSslCertificateRead(d, m)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ func (me *SslService) DescribeSslDescribeHostVodInstanceListByFilter(ctx context
return
}

func (me *SslService) DescribeSslDescribeHostWafInstanceListByFilter(ctx context.Context, param map[string]interface{}) (describeHostWafInstanceList []*ssl.LiveInstanceDetail, errRet error) {
func (me *SslService) DescribeSslDescribeHostWafInstanceListByFilter(ctx context.Context, param map[string]interface{}) (describeHostWafInstanceList []*ssl.WafInstanceDetail, errRet error) {
var (
logId = tccommon.GetLogId(ctx)
request = ssl.NewDescribeHostWafInstanceListRequest()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading