From bae7c14542730a665d93efa3fe6aa26df9922df5 Mon Sep 17 00:00:00 2001 From: arunma Date: Wed, 15 May 2024 11:34:32 +0800 Subject: [PATCH 1/2] fix(crs): [117472679]Optimize Availability Zone --- go.mod | 3 +- go.sum | 5 + tencentcloud/connectivity/client.go | 16 + .../crs/service_tencentcloud_redis.go | 6 +- .../tencentcloud/common/http/request.go | 3 +- .../tencentcloud/region/LICENSE | 201 +++++++++++ .../tencentcloud/region/v20220627/client.go | 195 ++++++++++ .../tencentcloud/region/v20220627/errors.go | 31 ++ .../tencentcloud/region/v20220627/models.go | 336 ++++++++++++++++++ vendor/modules.txt | 5 +- 10 files changed, 795 insertions(+), 6 deletions(-) create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/LICENSE create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/client.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/errors.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/models.go diff --git a/go.mod b/go.mod index 941ad00956..d0889b02c9 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.860 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.860 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.916 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.920 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692 @@ -305,6 +305,7 @@ require ( github.com/subosito/gotenv v1.4.1 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region v1.0.920 // indirect github.com/tetafro/godot v1.4.11 // indirect github.com/tidwall/gjson v1.17.0 // indirect github.com/tidwall/match v1.1.1 // indirect diff --git a/go.sum b/go.sum index a7ebbd9ee0..4a86da818a 100644 --- a/go.sum +++ b/go.sum @@ -924,8 +924,11 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.860/go.mod github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.873/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.888 h1:FqVcZ+POUhckq6ZRlwOR819fsXp49YyizpmWZJYAAGg= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.888/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.910/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.916 h1:30u2fFUGxaPB0VFpVtomiziXATxm/MjG53HCobM8KGI= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.916/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.920 h1:Kmm4rJrdI7D29IMOTT2oNp70h0TGsZ3obaekS8hvYkU= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.920/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860/go.mod h1:NZo1WplQcC314kMlCRUoy8NQju2BnolIJj7NAWgsuhY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624 h1:nEZqsoqt1pEoaP9JjkHQy3/H00suCfzlHW1qOm2nYD8= @@ -988,6 +991,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.762 h1:rZDKucV github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.762/go.mod h1:QB/XcdVZ8mhRgk90XuXd+2Smfo8emTo0wHIUsygEaKs= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657 h1:9p/4/qXtnBIYkz5b5mYAhp1XhnIn5jUkxxfllF8hMMM= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657/go.mod h1:CPc7SSKl8I21UmhTf2AVYZqZfy8MbDr/RrMsSqMkOAM= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region v1.0.920 h1:Kaab57oHrhiagHURsTNU/XfRFWXXSWxOXoix+YvLHrY= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region v1.0.920/go.mod h1:AhvwfhTo0JOz2FG4FcmVVdxJ73NpPAQ7rzjjWoEYFOw= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.744 h1:Z6xqpgnVPQfw2Yx/c2z6n30LfNodK4JEgMca1WpfOrY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.744/go.mod h1:prlrCvxmnWH4yCkA5cIIjGZMMuuvPs5EuCx1rV+F8jk= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.807 h1:8yfLBKc7/kBSFM+yXrXtH2w00g9rP39SpgXOsHCpVdg= diff --git a/tencentcloud/connectivity/client.go b/tencentcloud/connectivity/client.go index 7bf400fc5a..fc96f05585 100644 --- a/tencentcloud/connectivity/client.go +++ b/tencentcloud/connectivity/client.go @@ -80,6 +80,7 @@ import ( privatedns "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns/v20201028" pts "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts/v20210728" redis "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412" + region "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627" rum "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum/v20210622" scf "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416" ses "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses/v20201002" @@ -204,6 +205,7 @@ type TencentCloudClient struct { cdwpgConn *cdwpg.Client csipConn *csip.Client billingConn *billing.Client + regionConn *region.Client //internal version: replace client begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. //internal version: replace client end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. } @@ -1562,6 +1564,20 @@ func (me *TencentCloudClient) UseCsipClient() *csip.Client { return me.csipConn } +// UseRegionClient returns region client for service +func (me *TencentCloudClient) UseRegionClient() *region.Client { + if me.regionConn != nil { + return me.regionConn + } + + cpf := me.NewClientProfile(300) + cpf.Language = "zh-CN" + me.regionConn, _ = region.NewClient(me.Credential, me.Region, cpf) + me.regionConn.WithHttpTransport(&LogRoundTripper{}) + + return me.regionConn +} + //internal version: replace useClient begin, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. //internal version: replace useClient end, please do not modify this annotation and refrain from inserting any code between the beginning and end lines of the annotation. diff --git a/tencentcloud/services/crs/service_tencentcloud_redis.go b/tencentcloud/services/crs/service_tencentcloud_redis.go index 0cdc893750..490a8486a0 100644 --- a/tencentcloud/services/crs/service_tencentcloud_redis.go +++ b/tencentcloud/services/crs/service_tencentcloud_redis.go @@ -11,8 +11,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" sdkErrors "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" - cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312" redis "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412" + region "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/connectivity" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" @@ -56,7 +56,9 @@ func (me *RedisService) fullZoneId() (errRet error) { if len(me.zoneMap) != 0 { return } - response, err := me.client.UseCvmClient().DescribeZones(cvm.NewDescribeZonesRequest()) + request := region.NewDescribeZonesRequest() + request.Product = helper.String("redis") + response, err := me.client.UseRegionClient().DescribeZones(request) if err != nil { return err } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go index 94a4158e6e..64b8abd760 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -3,7 +3,6 @@ package common import ( "context" "io" - //"log" "math/rand" "net/url" @@ -266,7 +265,7 @@ func CompleteCommonParams(request Request, region string, requestClient string) params["Action"] = request.GetAction() params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) params["Nonce"] = strconv.Itoa(rand.Int()) - params["RequestClient"] = "SDK_GO_1.0.916" + params["RequestClient"] = "SDK_GO_1.0.920" if requestClient != "" { params["RequestClient"] += ": " + requestClient } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/LICENSE b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/LICENSE new file mode 100644 index 0000000000..efc75a2253 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2017-2018 Tencent Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/client.go new file mode 100644 index 0000000000..bfdebf0992 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/client.go @@ -0,0 +1,195 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20220627 + +import ( + "context" + "errors" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +) + +const APIVersion = "2022-06-27" + +type Client struct { + common.Client +} + +// Deprecated +func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { + cpf := profile.NewClientProfile() + client = &Client{} + client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf) + return +} + +func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error) { + client = &Client{} + client.Init(region). + WithCredential(credential). + WithProfile(clientProfile) + return +} + + +func NewDescribeProductsRequest() (request *DescribeProductsRequest) { + request = &DescribeProductsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("region", APIVersion, "DescribeProducts") + + + return +} + +func NewDescribeProductsResponse() (response *DescribeProductsResponse) { + response = &DescribeProductsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeProducts +// 本接口(DescribeProducts)用于查询各个支持地域列表查询的产品信息。 +func (c *Client) DescribeProducts(request *DescribeProductsRequest) (response *DescribeProductsResponse, err error) { + return c.DescribeProductsWithContext(context.Background(), request) +} + +// DescribeProducts +// 本接口(DescribeProducts)用于查询各个支持地域列表查询的产品信息。 +func (c *Client) DescribeProductsWithContext(ctx context.Context, request *DescribeProductsRequest) (response *DescribeProductsResponse, err error) { + if request == nil { + request = NewDescribeProductsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeProducts require credential") + } + + request.SetContext(ctx) + + response = NewDescribeProductsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRegionsRequest() (request *DescribeRegionsRequest) { + request = &DescribeRegionsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("region", APIVersion, "DescribeRegions") + + + return +} + +func NewDescribeRegionsResponse() (response *DescribeRegionsResponse) { + response = &DescribeRegionsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeRegions +// 本接口(DescribeRegions)用于查询各个产品支持地域信息。 +// +// 可能返回的错误码: +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// REQUESTLIMITEXCEEDED = "RequestLimitExceeded" +func (c *Client) DescribeRegions(request *DescribeRegionsRequest) (response *DescribeRegionsResponse, err error) { + return c.DescribeRegionsWithContext(context.Background(), request) +} + +// DescribeRegions +// 本接口(DescribeRegions)用于查询各个产品支持地域信息。 +// +// 可能返回的错误码: +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// REQUESTLIMITEXCEEDED = "RequestLimitExceeded" +func (c *Client) DescribeRegionsWithContext(ctx context.Context, request *DescribeRegionsRequest) (response *DescribeRegionsResponse, err error) { + if request == nil { + request = NewDescribeRegionsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeRegions require credential") + } + + request.SetContext(ctx) + + response = NewDescribeRegionsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeZonesRequest() (request *DescribeZonesRequest) { + request = &DescribeZonesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("region", APIVersion, "DescribeZones") + + + return +} + +func NewDescribeZonesResponse() (response *DescribeZonesResponse) { + response = &DescribeZonesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeZones +// 本接口(DescribeZones)用于查询产品可用区信息。 +// +// 可能返回的错误码: +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// UNSUPPORTEDOPERATION = "UnsupportedOperation" +func (c *Client) DescribeZones(request *DescribeZonesRequest) (response *DescribeZonesResponse, err error) { + return c.DescribeZonesWithContext(context.Background(), request) +} + +// DescribeZones +// 本接口(DescribeZones)用于查询产品可用区信息。 +// +// 可能返回的错误码: +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// UNSUPPORTEDOPERATION = "UnsupportedOperation" +func (c *Client) DescribeZonesWithContext(ctx context.Context, request *DescribeZonesRequest) (response *DescribeZonesResponse, err error) { + if request == nil { + request = NewDescribeZonesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeZones require credential") + } + + request.SetContext(ctx) + + response = NewDescribeZonesResponse() + err = c.Send(request, response) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/errors.go new file mode 100644 index 0000000000..1ae029c6c4 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/errors.go @@ -0,0 +1,31 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20220627 + +const ( + // 此产品的特有错误码 + + // 参数错误。 + INVALIDPARAMETER = "InvalidParameter" + + // 参数错误。 + INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" + + // 请求的次数超过了频率限制。 + REQUESTLIMITEXCEEDED = "RequestLimitExceeded" + + // 操作不支持。 + UNSUPPORTEDOPERATION = "UnsupportedOperation" +) diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/models.go new file mode 100644 index 0000000000..ed7bef2c41 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627/models.go @@ -0,0 +1,336 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20220627 + +import ( + tcerr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/json" +) + +// Predefined struct for user +type DescribeProductsRequestParams struct { + // 返回数量,默认为 20,最大值为 100。 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 偏移量,默认为 0。 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` +} + +type DescribeProductsRequest struct { + *tchttp.BaseRequest + + // 返回数量,默认为 20,最大值为 100。 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 偏移量,默认为 0。 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` +} + +func (r *DescribeProductsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeProductsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Limit") + delete(f, "Offset") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeProductsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeProductsResponseParams struct { + // 产品详细信息列表。 + Products []*RegionProduct `json:"Products,omitnil,omitempty" name:"Products"` + + // 产品总数量。 + TotalCount *int64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeProductsResponse struct { + *tchttp.BaseResponse + Response *DescribeProductsResponseParams `json:"Response"` +} + +func (r *DescribeProductsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeProductsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeRegionsRequestParams struct { + // 待查询产品的名称,例如cvm,具体取值请查询DescribeProducts接口 + Product *string `json:"Product,omitnil,omitempty" name:"Product"` + + // 不传或者0表示不查询【可选业务白名单】,1表示查询【可选业务白名单】,该参数设置了1,只有在业务白名单查不到情况下,才会查该白名单 + Scene *int64 `json:"Scene,omitnil,omitempty" name:"Scene"` +} + +type DescribeRegionsRequest struct { + *tchttp.BaseRequest + + // 待查询产品的名称,例如cvm,具体取值请查询DescribeProducts接口 + Product *string `json:"Product,omitnil,omitempty" name:"Product"` + + // 不传或者0表示不查询【可选业务白名单】,1表示查询【可选业务白名单】,该参数设置了1,只有在业务白名单查不到情况下,才会查该白名单 + Scene *int64 `json:"Scene,omitnil,omitempty" name:"Scene"` +} + +func (r *DescribeRegionsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeRegionsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Product") + delete(f, "Scene") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeRegionsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeRegionsResponseParams struct { + // 地域数量 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 地域列表信息 + RegionSet []*RegionInfo `json:"RegionSet,omitnil,omitempty" name:"RegionSet"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeRegionsResponse struct { + *tchttp.BaseResponse + Response *DescribeRegionsResponseParams `json:"Response"` +} + +func (r *DescribeRegionsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeRegionsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZonesRequestParams struct { + // 待查询产品的名称,例如cvm,具体取值请查询DescribeProducts接口 + Product *string `json:"Product,omitnil,omitempty" name:"Product"` + + // 不传或者0表示不查询【可选业务白名单】,1表示查询【可选业务白名单】,该参数设置了1,只有在业务白名单查不到情况下,才会查该白名单 + Scene *int64 `json:"Scene,omitnil,omitempty" name:"Scene"` +} + +type DescribeZonesRequest struct { + *tchttp.BaseRequest + + // 待查询产品的名称,例如cvm,具体取值请查询DescribeProducts接口 + Product *string `json:"Product,omitnil,omitempty" name:"Product"` + + // 不传或者0表示不查询【可选业务白名单】,1表示查询【可选业务白名单】,该参数设置了1,只有在业务白名单查不到情况下,才会查该白名单 + Scene *int64 `json:"Scene,omitnil,omitempty" name:"Scene"` +} + +func (r *DescribeZonesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZonesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Product") + delete(f, "Scene") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeZonesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZonesResponseParams struct { + // 可用区数量。 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 可用区列表信息。 + ZoneSet []*ZoneInfo `json:"ZoneSet,omitnil,omitempty" name:"ZoneSet"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeZonesResponse struct { + *tchttp.BaseResponse + Response *DescribeZonesResponseParams `json:"Response"` +} + +func (r *DescribeZonesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZonesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type RegionInfo struct { + // 地域名称,例如,ap-guangzhou + Region *string `json:"Region,omitnil,omitempty" name:"Region"` + + // 地域描述,例如,华南地区(广州) + RegionName *string `json:"RegionName,omitnil,omitempty" name:"RegionName"` + + // 地域是否可用状态 + RegionState *string `json:"RegionState,omitnil,omitempty" name:"RegionState"` + + // 控制台类型,api调用时默认null + // 注意:此字段可能返回 null,表示取不到有效值。 + RegionTypeMC *int64 `json:"RegionTypeMC,omitnil,omitempty" name:"RegionTypeMC"` + + // 不同语言的地区 + // 注意:此字段可能返回 null,表示取不到有效值。 + LocationMC *string `json:"LocationMC,omitnil,omitempty" name:"LocationMC"` + + // 控制台展示的地域描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + RegionNameMC *string `json:"RegionNameMC,omitnil,omitempty" name:"RegionNameMC"` + + // 1 + // 注意:此字段可能返回 null,表示取不到有效值。 + RegionIdMC *string `json:"RegionIdMC,omitnil,omitempty" name:"RegionIdMC"` +} + +type RegionProduct struct { + // 产品名称,如cvm + Name *string `json:"Name,omitnil,omitempty" name:"Name"` +} + +type ZoneInfo struct { + // 可用区名称,例如,ap-guangzhou-3 + // 全网可用区名称如下: + //
  • ap-chongqing-1
  • + //
  • ap-seoul-1
  • + //
  • ap-seoul-2
  • + //
  • ap-chengdu-1
  • + //
  • ap-chengdu-2
  • + //
  • ap-hongkong-1
  • + //
  • ap-hongkong-2
  • + //
  • ap-shenzhen-fsi-1
  • + //
  • ap-shenzhen-fsi-2
  • + //
  • ap-shenzhen-fsi-3
  • + //
  • ap-guangzhou-1(售罄)
  • + //
  • ap-guangzhou-2(售罄)
  • + //
  • ap-guangzhou-3
  • + //
  • ap-guangzhou-4
  • + //
  • ap-guangzhou-6
  • + //
  • ap-tokyo-1
  • + //
  • ap-singapore-1
  • + //
  • ap-singapore-2
  • + //
  • ap-shanghai-fsi-1
  • + //
  • ap-shanghai-fsi-2
  • + //
  • ap-shanghai-fsi-3
  • + //
  • ap-bangkok-1
  • + //
  • ap-shanghai-1(售罄)
  • + //
  • ap-shanghai-2
  • + //
  • ap-shanghai-3
  • + //
  • ap-shanghai-4
  • + //
  • ap-shanghai-5
  • + //
  • ap-mumbai-1
  • + //
  • ap-mumbai-2
  • + //
  • eu-moscow-1
  • + //
  • ap-beijing-1
  • + //
  • ap-beijing-2
  • + //
  • ap-beijing-3
  • + //
  • ap-beijing-4
  • + //
  • ap-beijing-5
  • + //
  • na-siliconvalley-1
  • + //
  • na-siliconvalley-2
  • + //
  • eu-frankfurt-1
  • + //
  • na-toronto-1
  • + //
  • na-ashburn-1
  • + //
  • na-ashburn-2
  • + //
  • ap-nanjing-1
  • + //
  • ap-nanjing-2
  • + Zone *string `json:"Zone,omitnil,omitempty" name:"Zone"` + + // 可用区描述,例如,广州三区 + ZoneName *string `json:"ZoneName,omitnil,omitempty" name:"ZoneName"` + + // 可用区ID + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 可用区状态,包含AVAILABLE和UNAVAILABLE。AVAILABLE代表可用,UNAVAILABLE代表不可用。 + ZoneState *string `json:"ZoneState,omitnil,omitempty" name:"ZoneState"` + + // 父级zone + // 注意:此字段可能返回 null,表示取不到有效值。 + ParentZone *string `json:"ParentZone,omitnil,omitempty" name:"ParentZone"` + + // 父级可用区ID + // 注意:此字段可能返回 null,表示取不到有效值。 + ParentZoneId *string `json:"ParentZoneId,omitnil,omitempty" name:"ParentZoneId"` + + // 父级可用区描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + ParentZoneName *string `json:"ParentZoneName,omitnil,omitempty" name:"ParentZoneName"` + + // zone类型 + // 注意:此字段可能返回 null,表示取不到有效值。 + ZoneType *string `json:"ZoneType,omitnil,omitempty" name:"ZoneType"` + + // 控制台类型 + // 注意:此字段可能返回 null,表示取不到有效值。 + MachineRoomTypeMC *string `json:"MachineRoomTypeMC,omitnil,omitempty" name:"MachineRoomTypeMC"` + + // 和ZoneId一样,适用于控制台调用。 + // 注意:此字段可能返回 null,表示取不到有效值。 + ZoneIdMC *string `json:"ZoneIdMC,omitnil,omitempty" name:"ZoneIdMC"` +} \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index b31714ef95..a181fde4b3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1160,7 +1160,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.860 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.916 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.920 ## explicit; go 1.11 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors @@ -1258,6 +1258,9 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts/v20210728 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region v1.0.920 +## explicit; go 1.14 +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/region/v20220627 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.744 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum/v20210622 From 740e6e55123a27707877fc01452455fc4905e812 Mon Sep 17 00:00:00 2001 From: arunma Date: Wed, 15 May 2024 11:41:42 +0800 Subject: [PATCH 2/2] feat: add changelog --- .changelog/2634.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/2634.txt diff --git a/.changelog/2634.txt b/.changelog/2634.txt new file mode 100644 index 0000000000..d9850a65a5 --- /dev/null +++ b/.changelog/2634.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_redis_instance: Optimize Availability Zone +```