From 803319dbc5b1a5e4803136a2bb16d5aebc62e254 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Wed, 4 Sep 2024 20:33:27 +0800 Subject: [PATCH 1/4] add --- go.mod | 1 + go.sum | 2 + tencentcloud/connectivity/client.go | 18 +- tencentcloud/provider.go | 3 + tencentcloud/provider.md | 4 + ...source_tc_batch_apply_account_baselines.go | 125 +++++++++++ ...source_tc_batch_apply_account_baselines.md | 17 ++ ...e_tc_batch_apply_account_baselines_test.go | 42 ++++ .../service_tencentcloud_controlcenter.go | 12 ++ .../tencentcloud/common/http/request.go | 1 - .../tencentcloud/controlcenter/LICENSE | 201 ++++++++++++++++++ .../controlcenter/v20230110/client.go | 113 ++++++++++ .../controlcenter/v20230110/errors.go | 49 +++++ .../controlcenter/v20230110/models.go | 92 ++++++++ vendor/modules.txt | 3 + ...atch_apply_account_baselines.html.markdown | 49 +++++ website/tencentcloud.erb | 14 ++ 17 files changed, 744 insertions(+), 2 deletions(-) create mode 100644 tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.go create mode 100644 tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.md create mode 100644 tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines_test.go create mode 100644 tencentcloud/services/controlcenter/service_tencentcloud_controlcenter.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/LICENSE create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/client.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/errors.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/models.go create mode 100644 website/docs/r/batch_apply_account_baselines.html.markdown diff --git a/go.mod b/go.mod index b4010d43b7..ccdfcd33b5 100644 --- a/go.mod +++ b/go.mod @@ -307,6 +307,7 @@ require ( 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/cdwdoris v1.0.993 // indirect + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 // 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 28a2cd4c17..622e572379 100644 --- a/go.sum +++ b/go.sum @@ -931,6 +931,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991 h1:0Xg2 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993 h1:+iJMmF0q1MPyhLs0+J7CcJ47w/vq6ICsCxnV4gc0dKw= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993/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= 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.960 h1:Tpz3KVUfaJ7b98wQDYZSbmoKIn0hlH0oHPOzWMzE5Q8= diff --git a/tencentcloud/connectivity/client.go b/tencentcloud/connectivity/client.go index 026dce081b..b20e4b8e01 100644 --- a/tencentcloud/connectivity/client.go +++ b/tencentcloud/connectivity/client.go @@ -41,6 +41,7 @@ import ( cls "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" + controlcenter "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110" csip "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip/v20221121" cvmv20170312 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312" cwp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp/v20180228" @@ -206,7 +207,9 @@ type TencentCloudClient struct { cdcConn *cdc.Client cdwdorisConn *cdwdoris.Client //omit nil client - omitNilConn *common.Client + omitNilConn *common.Client + cdwdorisv20211228Conn *cdwdoris.Client + controlcenterv20230110Conn *controlcenter.Client } // NewClientProfile returns a new ClientProfile @@ -1698,3 +1701,16 @@ func (me *TencentCloudClient) UseCdwdorisV20211228Client() *cdwdoris.Client { return me.cdwdorisConn } + +// UseControlcenter return CONTROLCENTER client for service +func (me *TencentCloudClient) UseControlcenterV20230110Client() *controlcenter.Client { + if me.controlcenterv20230110Conn != nil { + return me.controlcenterv20230110Conn + } + cpf := me.NewClientProfile(300) + cpf.Language = "zh-CN" + me.controlcenterv20230110Conn, _ = controlcenter.NewClient(me.Credential, me.Region, cpf) + me.controlcenterv20230110Conn.WithHttpTransport(&LogRoundTripper{}) + + return me.controlcenterv20230110Conn +} diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index f2b640e74d..f6f9a952d0 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -48,6 +48,7 @@ import ( "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/clb" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/cls" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/controlcenter" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/cos" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/crs" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/csip" @@ -2120,6 +2121,8 @@ func Provider() *schema.Provider { "tencentcloud_cdwdoris_instance": cdwdoris.ResourceTencentCloudCdwdorisInstance(), "tencentcloud_cdwdoris_workload_group": cdwdoris.ResourceTencentCloudCdwdorisWorkloadGroup(), //"tencentcloud_cdwdoris_user": cdwdoris.ResourceTencentCloudCdwdorisUser(), + "tencentcloud_cdwdoris_user": cdwdoris.ResourceTencentCloudCdwdorisUser(), + "tencentcloud_batch_apply_account_baselines": controlcenter.ResourceTencentCloudBatchApplyAccountBaselines(), }, ConfigureFunc: providerConfigure, diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index 6c413befa3..b7bafde2c5 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -2178,3 +2178,7 @@ CdwDoris Resource tencentcloud_cdwdoris_instance tencentcloud_cdwdoris_workload_group + +ControlCenter + Resource + tencentcloud_batch_apply_account_baselines \ No newline at end of file diff --git a/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.go b/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.go new file mode 100644 index 0000000000..91b6efdb96 --- /dev/null +++ b/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.go @@ -0,0 +1,125 @@ +// Code generated by iacg; DO NOT EDIT. +package controlcenter + +import ( + "context" + "log" + "strconv" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + controlcenterv20230110 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudBatchApplyAccountBaselines() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudBatchApplyAccountBaselinesCreate, + Read: resourceTencentCloudBatchApplyAccountBaselinesRead, + Delete: resourceTencentCloudBatchApplyAccountBaselinesDelete, + Schema: map[string]*schema.Schema{ + "member_uin_list": { + Type: schema.TypeSet, + Required: true, + ForceNew: true, + Description: "Member account UIN, which is also the UIN of the account to which the baseline is applied.", + Elem: &schema.Schema{Type: schema.TypeInt}, + }, + "baseline_config_items": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: "List of baseline item configuration information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "identifier": { + Type: schema.TypeString, + Optional: true, + Description: "A unique identifier for an Account Factory baseline item, which can only contain English letters, digits, and @,._[]-:()+=. It must be 2-128 characters long.Note: This field may return null, indicating that no valid values can be obtained.", + }, + "configuration": { + Type: schema.TypeString, + Optional: true, + Description: "Account Factory baseline item configuration. Different items have different parameters.Note: This field may return null, indicating that no valid values can be obtained.", + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudBatchApplyAccountBaselinesCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_batch_apply_account_baselines.create")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + request = controlcenterv20230110.NewBatchApplyAccountBaselinesRequest() + memberUinList []string + ) + + if v, ok := d.GetOk("member_uin_list"); ok { + memberUinListSet := v.(*schema.Set).List() + for i := range memberUinListSet { + value := memberUinListSet[i].(int) + valueStr := strconv.Itoa(value) + request.MemberUinList = append(request.MemberUinList, helper.IntInt64(value)) + memberUinList = append(memberUinList, valueStr) + } + } + + if v, ok := d.GetOk("baseline_config_items"); ok { + for _, item := range v.([]interface{}) { + baselineConfigItemsMap := item.(map[string]interface{}) + baselineConfigItem := controlcenterv20230110.BaselineConfigItem{} + if v, ok := baselineConfigItemsMap["identifier"]; ok { + baselineConfigItem.Identifier = helper.String(v.(string)) + } + + if v, ok := baselineConfigItemsMap["configuration"]; ok { + baselineConfigItem.Configuration = helper.String(v.(string)) + } + + request.BaselineConfigItems = append(request.BaselineConfigItems, &baselineConfigItem) + } + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseControlcenterV20230110Client().BatchApplyAccountBaselinesWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create batch apply account baselines failed, reason:%+v", logId, err) + return err + } + + d.SetId(strings.Join(memberUinList, tccommon.FILED_SP)) + + return resourceTencentCloudBatchApplyAccountBaselinesRead(d, meta) +} + +func resourceTencentCloudBatchApplyAccountBaselinesRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_batch_apply_account_baselines.read")() + defer tccommon.InconsistentCheck(d, meta)() + + return nil +} + +func resourceTencentCloudBatchApplyAccountBaselinesDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_batch_apply_account_baselines.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.md b/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.md new file mode 100644 index 0000000000..1933fb76ea --- /dev/null +++ b/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines.md @@ -0,0 +1,17 @@ +Provides a resource to create a controlcenter batch apply account baselines + +Example Usage + +```hcl +resource "tencentcloud_batch_apply_account_baselines" "example" { + member_uin_list = [ + 10037652245, + 10037652240, + ] + + baseline_config_items { + identifier = "TCC-AF_SHARE_IMAGE" + configuration = "{\"Images\":[{\"Region\":\"ap-guangzhou\",\"ImageId\":\"img-mcdsiqrx\",\"ImageName\":\"demo1\"}, {\"Region\":\"ap-guangzhou\",\"ImageId\":\"img-esxgkots\",\"ImageName\":\"demo2\"}]}" + } +} +``` diff --git a/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines_test.go b/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines_test.go new file mode 100644 index 0000000000..80db5c6544 --- /dev/null +++ b/tencentcloud/services/controlcenter/resource_tc_batch_apply_account_baselines_test.go @@ -0,0 +1,42 @@ +package controlcenter_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +// go test -i; go test -test.run TestAccTencentCloudNeedFixBatchApplyAccountBaselinesResource_basic -v +func TestAccTencentCloudNeedFixBatchApplyAccountBaselinesResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{ + { + Config: testAccBatchApplyAccountBaselines, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_batch_apply_account_baselines.example", "id"), + ), + }, + }, + }) +} + +const testAccBatchApplyAccountBaselines = ` +resource "tencentcloud_batch_apply_account_baselines" "example" { + member_uin_list = [ + 10037652245, + 10037652240, + ] + + baseline_config_items { + identifier = "TCC-AF_SHARE_IMAGE" + configuration = "{\"Images\":[{\"Region\":\"ap-guangzhou\",\"ImageId\":\"img-mcdsiqrx\",\"ImageName\":\"demo1\"}, {\"Region\":\"ap-guangzhou\",\"ImageId\":\"img-esxgkots\",\"ImageName\":\"demo2\"}]}" + } +} +` diff --git a/tencentcloud/services/controlcenter/service_tencentcloud_controlcenter.go b/tencentcloud/services/controlcenter/service_tencentcloud_controlcenter.go new file mode 100644 index 0000000000..cc48e4a309 --- /dev/null +++ b/tencentcloud/services/controlcenter/service_tencentcloud_controlcenter.go @@ -0,0 +1,12 @@ +// Code generated by iacg; DO NOT EDIT. +package controlcenter + +import "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/connectivity" + +func NewControlcenterService(client *connectivity.TencentCloudClient) ControlcenterService { + return ControlcenterService{client: client} +} + +type ControlcenterService struct { + client *connectivity.TencentCloudClient +} 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 2f1e593ac8..1ec564c553 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" diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/LICENSE b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/LICENSE new file mode 100644 index 0000000000..efc75a2253 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/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/controlcenter/v20230110/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/client.go new file mode 100644 index 0000000000..77dcdf5dc1 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/client.go @@ -0,0 +1,113 @@ +// 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 v20230110 + +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 = "2023-01-10" + +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 NewBatchApplyAccountBaselinesRequest() (request *BatchApplyAccountBaselinesRequest) { + request = &BatchApplyAccountBaselinesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("controlcenter", APIVersion, "BatchApplyAccountBaselines") + + + return +} + +func NewBatchApplyAccountBaselinesResponse() (response *BatchApplyAccountBaselinesResponse) { + response = &BatchApplyAccountBaselinesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// BatchApplyAccountBaselines +// 批量对存量账号应用基线 +// +// 可能返回的错误码: +// FAILEDOPERATION_AFREQUIREDITEMNOTSELECT = "FailedOperation.AFRequiredItemNotSelect" +// FAILEDOPERATION_ACCOUNTFACTORYMEMBERUINNUMEXCEED = "FailedOperation.AccountFactoryMemberUinNumExceed" +// FAILEDOPERATION_ACCOUNTFACTORYTASKISDEPLOYING = "FailedOperation.AccountFactoryTaskIsDeploying" +// FAILEDOPERATION_CONTROLCENTERNOTOPEN = "FailedOperation.ControlCenterNotOpen" +// FAILEDOPERATION_DBOPERATIONERROR = "FailedOperation.DBOperationError" +// FAILEDOPERATION_DEPENDONITEMNOTDEPLOY = "FailedOperation.DependOnItemNotDeploy" +// FAILEDOPERATION_REMOTECALLERROR = "FailedOperation.RemoteCallError" +// RESOURCENOTFOUND_ACCOUNTFACTORYBASELINENOTEXIST = "ResourceNotFound.AccountFactoryBaselineNotExist" +// RESOURCENOTFOUND_ACCOUNTFACTORYITEMNOTCONFIG = "ResourceNotFound.AccountFactoryItemNotConfig" +// RESOURCENOTFOUND_ACCOUNTFACTORYITEMNOTEXIST = "ResourceNotFound.AccountFactoryItemNotExist" +func (c *Client) BatchApplyAccountBaselines(request *BatchApplyAccountBaselinesRequest) (response *BatchApplyAccountBaselinesResponse, err error) { + return c.BatchApplyAccountBaselinesWithContext(context.Background(), request) +} + +// BatchApplyAccountBaselines +// 批量对存量账号应用基线 +// +// 可能返回的错误码: +// FAILEDOPERATION_AFREQUIREDITEMNOTSELECT = "FailedOperation.AFRequiredItemNotSelect" +// FAILEDOPERATION_ACCOUNTFACTORYMEMBERUINNUMEXCEED = "FailedOperation.AccountFactoryMemberUinNumExceed" +// FAILEDOPERATION_ACCOUNTFACTORYTASKISDEPLOYING = "FailedOperation.AccountFactoryTaskIsDeploying" +// FAILEDOPERATION_CONTROLCENTERNOTOPEN = "FailedOperation.ControlCenterNotOpen" +// FAILEDOPERATION_DBOPERATIONERROR = "FailedOperation.DBOperationError" +// FAILEDOPERATION_DEPENDONITEMNOTDEPLOY = "FailedOperation.DependOnItemNotDeploy" +// FAILEDOPERATION_REMOTECALLERROR = "FailedOperation.RemoteCallError" +// RESOURCENOTFOUND_ACCOUNTFACTORYBASELINENOTEXIST = "ResourceNotFound.AccountFactoryBaselineNotExist" +// RESOURCENOTFOUND_ACCOUNTFACTORYITEMNOTCONFIG = "ResourceNotFound.AccountFactoryItemNotConfig" +// RESOURCENOTFOUND_ACCOUNTFACTORYITEMNOTEXIST = "ResourceNotFound.AccountFactoryItemNotExist" +func (c *Client) BatchApplyAccountBaselinesWithContext(ctx context.Context, request *BatchApplyAccountBaselinesRequest) (response *BatchApplyAccountBaselinesResponse, err error) { + if request == nil { + request = NewBatchApplyAccountBaselinesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("BatchApplyAccountBaselines require credential") + } + + request.SetContext(ctx) + + response = NewBatchApplyAccountBaselinesResponse() + err = c.Send(request, response) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/errors.go new file mode 100644 index 0000000000..4ce67527a8 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/errors.go @@ -0,0 +1,49 @@ +// 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 v20230110 + +const ( + // 此产品的特有错误码 + + // 账号工厂必选基线项未配置 + FAILEDOPERATION_AFREQUIREDITEMNOTSELECT = "FailedOperation.AFRequiredItemNotSelect" + + // 账号工厂批量应用基线的账号数量超过限制 + FAILEDOPERATION_ACCOUNTFACTORYMEMBERUINNUMEXCEED = "FailedOperation.AccountFactoryMemberUinNumExceed" + + // 用户正在部署账号基线中,无法重复部署 + FAILEDOPERATION_ACCOUNTFACTORYTASKISDEPLOYING = "FailedOperation.AccountFactoryTaskIsDeploying" + + // Control Center服务未开通 + FAILEDOPERATION_CONTROLCENTERNOTOPEN = "FailedOperation.ControlCenterNotOpen" + + // 数据库操作异常 + FAILEDOPERATION_DBOPERATIONERROR = "FailedOperation.DBOperationError" + + // 依赖的功能项未部署 + FAILEDOPERATION_DEPENDONITEMNOTDEPLOY = "FailedOperation.DependOnItemNotDeploy" + + // 远程调用失败 + FAILEDOPERATION_REMOTECALLERROR = "FailedOperation.RemoteCallError" + + // 用户基线配置数据不存在 + RESOURCENOTFOUND_ACCOUNTFACTORYBASELINENOTEXIST = "ResourceNotFound.AccountFactoryBaselineNotExist" + + // 用户所部署的基线项未配置 + RESOURCENOTFOUND_ACCOUNTFACTORYITEMNOTCONFIG = "ResourceNotFound.AccountFactoryItemNotConfig" + + // 账号工厂基线不存在 + RESOURCENOTFOUND_ACCOUNTFACTORYITEMNOTEXIST = "ResourceNotFound.AccountFactoryItemNotExist" +) diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/models.go new file mode 100644 index 0000000000..d1f306cf0c --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110/models.go @@ -0,0 +1,92 @@ +// 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 v20230110 + +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" +) + +type BaselineConfigItem struct { + // 账号工厂基线项唯一标识,只能包含英文字母、数字和@、,._[]-:()()【】+=,。,长度2-128个字符。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Identifier *string `json:"Identifier,omitnil,omitempty" name:"Identifier"` + + // 账号工厂基线项配置,不同基线项配置参数不同。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Configuration *string `json:"Configuration,omitnil,omitempty" name:"Configuration"` +} + +// Predefined struct for user +type BatchApplyAccountBaselinesRequestParams struct { + // 成员账号uin,也是被应用基线的账号uin。 + MemberUinList []*int64 `json:"MemberUinList,omitnil,omitempty" name:"MemberUinList"` + + // 基线项配置信息列表。 + BaselineConfigItems []*BaselineConfigItem `json:"BaselineConfigItems,omitnil,omitempty" name:"BaselineConfigItems"` +} + +type BatchApplyAccountBaselinesRequest struct { + *tchttp.BaseRequest + + // 成员账号uin,也是被应用基线的账号uin。 + MemberUinList []*int64 `json:"MemberUinList,omitnil,omitempty" name:"MemberUinList"` + + // 基线项配置信息列表。 + BaselineConfigItems []*BaselineConfigItem `json:"BaselineConfigItems,omitnil,omitempty" name:"BaselineConfigItems"` +} + +func (r *BatchApplyAccountBaselinesRequest) 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 *BatchApplyAccountBaselinesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "MemberUinList") + delete(f, "BaselineConfigItems") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "BatchApplyAccountBaselinesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type BatchApplyAccountBaselinesResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type BatchApplyAccountBaselinesResponse struct { + *tchttp.BaseResponse + Response *BatchApplyAccountBaselinesResponseParams `json:"Response"` +} + +func (r *BatchApplyAccountBaselinesResponse) 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 *BatchApplyAccountBaselinesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index 8ac825bf58..6b9215db46 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1171,6 +1171,9 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/json github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/regions +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 +## explicit; go 1.14 +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter/v20230110 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip/v20221121 diff --git a/website/docs/r/batch_apply_account_baselines.html.markdown b/website/docs/r/batch_apply_account_baselines.html.markdown new file mode 100644 index 0000000000..606dfedfc7 --- /dev/null +++ b/website/docs/r/batch_apply_account_baselines.html.markdown @@ -0,0 +1,49 @@ +--- +subcategory: "ControlCenter" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_batch_apply_account_baselines" +sidebar_current: "docs-tencentcloud-resource-batch_apply_account_baselines" +description: |- + Provides a resource to create a controlcenter batch apply account baselines +--- + +# tencentcloud_batch_apply_account_baselines + +Provides a resource to create a controlcenter batch apply account baselines + +## Example Usage + +```hcl +resource "tencentcloud_batch_apply_account_baselines" "example" { + member_uin_list = [ + 10037652245, + 10037652240, + ] + + baseline_config_items { + identifier = "TCC-AF_SHARE_IMAGE" + configuration = "{\"Images\":[{\"Region\":\"ap-guangzhou\",\"ImageId\":\"img-mcdsiqrx\",\"ImageName\":\"demo1\"}, {\"Region\":\"ap-guangzhou\",\"ImageId\":\"img-esxgkots\",\"ImageName\":\"demo2\"}]}" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `baseline_config_items` - (Required, List, ForceNew) List of baseline item configuration information. +* `member_uin_list` - (Required, Set: [`Int`], ForceNew) Member account UIN, which is also the UIN of the account to which the baseline is applied. + +The `baseline_config_items` object supports the following: + +* `configuration` - (Optional, String) Account Factory baseline item configuration. Different items have different parameters.Note: This field may return null, indicating that no valid values can be obtained. +* `identifier` - (Optional, String) A unique identifier for an Account Factory baseline item, which can only contain English letters, digits, and @,._[]-:()+=. It must be 2-128 characters long.Note: This field may return null, indicating that no valid values can be obtained. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index c798b9670e..afdad8772e 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -2002,6 +2002,20 @@ +