From b13092b4a40b5a62407ca5b1001c9b512361163e Mon Sep 17 00:00:00 2001 From: mikatong Date: Thu, 3 Apr 2025 16:23:11 +0800 Subject: [PATCH 1/3] add gwlb --- go.mod | 3 +- go.sum | 9 +- tencentcloud/connectivity/client.go | 14 + tencentcloud/provider.go | 5 + tencentcloud/provider.md | 7 + .../gwlb/resource_tc_gwlb_instance.go | 362 ++++ .../gwlb/resource_tc_gwlb_instance.md | 41 + ...c_gwlb_instance_associate_target_groups.go | 139 ++ ...c_gwlb_instance_associate_target_groups.md | 53 + ...b_instance_associate_target_groups_test.go | 76 + .../gwlb/resource_tc_gwlb_instance_test.go | 97 + .../gwlb/resource_tc_gwlb_target_group.go | 453 +++++ .../gwlb/resource_tc_gwlb_target_group.md | 33 + ...tc_gwlb_target_group_register_instances.go | 251 +++ ...tc_gwlb_target_group_register_instances.md | 85 + ...lb_target_group_register_instances_test.go | 100 ++ .../resource_tc_gwlb_target_group_test.go | 81 + .../gwlb/service_tencentcloud_gwlb.go | 247 +++ .../tencentcloud/gwlb/v20240906/client.go | 1064 +++++++++++ .../tencentcloud/gwlb/v20240906/errors.go | 52 + .../tencentcloud/gwlb/v20240906/models.go | 1528 ++++++++++++++++ .../tencentcloud/common/http/request.go | 3 +- .../tencentcloud/gwlb/LICENSE | 201 +++ .../tencentcloud/gwlb/v20240906/client.go | 1096 ++++++++++++ .../tencentcloud/gwlb/v20240906/errors.go | 55 + .../tencentcloud/gwlb/v20240906/models.go | 1569 +++++++++++++++++ vendor/modules.txt | 6 +- website/docs/r/gwlb_instance.html.markdown | 83 + ...ance_associate_target_groups.html.markdown | 80 + .../docs/r/gwlb_target_group.html.markdown | 83 + ...get_group_register_instances.html.markdown | 118 ++ website/tencentcloud.erb | 23 + 32 files changed, 8012 insertions(+), 5 deletions(-) create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_instance.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_instance.md create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.md create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups_test.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_instance_test.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_target_group.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_target_group.md create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.md create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances_test.go create mode 100644 tencentcloud/services/gwlb/resource_tc_gwlb_target_group_test.go create mode 100644 tencentcloud/services/gwlb/service_tencentcloud_gwlb.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/client.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/errors.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/models.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/LICENSE create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/client.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/errors.go create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/models.go create mode 100644 website/docs/r/gwlb_instance.html.markdown create mode 100644 website/docs/r/gwlb_instance_associate_target_groups.html.markdown create mode 100644 website/docs/r/gwlb_target_group.html.markdown create mode 100644 website/docs/r/gwlb_target_group_register_instances.html.markdown diff --git a/go.mod b/go.mod index 7c6fd56980..89f5fc00ca 100644 --- a/go.mod +++ b/go.mod @@ -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.1078 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1133 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1134 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1128 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1111 @@ -311,6 +311,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/gwlb v1.0.1127 // 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 83fd33a04c..829964a918 100644 --- a/go.sum +++ b/go.sum @@ -931,10 +931,13 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1111/go.mod github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1115/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1122/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1126/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1127/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1128/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1129/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1133 h1:S+ZHcAfI8+ii4MfsCr41R3CdhlTsc5OddGsCfeYJdl8= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1133/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1130 h1:pjtrqJUaidq1fFWwPvBorq7FScq0LXiQ7pZjJZx3Jsc= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1130/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1134 h1:NDCzSm7r8OZeWQje1FJNHM73Ku4QRrCP1GymfgZYLSM= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1134/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= @@ -971,6 +974,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.777 h1:G1eX/Dki github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.777/go.mod h1:ehbc9eaNknF/VU/kPTFLZbIUmkL06vQ/JYydu6yeXp4= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.970 h1:Z82LbcEnE2m4CGvcOY024N7REhAN++xdEyE88HG2YBA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.970/go.mod h1:qnOT3rycGxlNy4/gmprV58Uqd9CKLUr2CL235R1AvuQ= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb v1.0.1127 h1:1ZhrN7aFPBVb4ihclkbCNOF1Mtoql6duT/cI3Q0p074= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb v1.0.1127/go.mod h1:HSfd/mm8VyXn7VTe3tOvPgsumbsfeYcG5QgaCI1vsRk= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563 h1:FoX+MK4vHThvPO6FbP5q98zD8S3n+d5+DbtK7skl++c= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563/go.mod h1:uom4Nvi9W+Qkom0exYiJ9VWJjXwyxtPYTkKkaLMlfE0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.0.729 h1:WQpzm3x27Jo/5uh6/Yqe/gbJ7r2ui9hc9ST7Ml2eP9Y= diff --git a/tencentcloud/connectivity/client.go b/tencentcloud/connectivity/client.go index 493b26f429..d2de439602 100644 --- a/tencentcloud/connectivity/client.go +++ b/tencentcloud/connectivity/client.go @@ -61,6 +61,7 @@ import ( emr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/emr/v20190103" es "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es/v20180416" gaap "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap/v20180529" + gwlb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906" kms "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms/v20190118" lighthouse "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse/v20200324" css "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/live/v20180801" @@ -235,6 +236,7 @@ type TencentCloudClient struct { cdcv20201214Conn *cdc.Client mqttv20240516Conn *mqtt.Client cdwpgv20201230Conn *cdwpg.Client + gwlbv20240906Conn *gwlb.Client } // NewClientProfile returns a new ClientProfile @@ -2059,3 +2061,15 @@ func (me *TencentCloudClient) UseCdwpgV20201230Client() *cdwpg.Client { return me.cdwpgv20201230Conn } + +// UseGwlbV20240906Client return GWLB client for service +func (me *TencentCloudClient) UseGwlbV20240906Client() *gwlb.Client { + if me.gwlbv20240906Conn != nil { + return me.gwlbv20240906Conn + } + cpf := me.NewClientProfile(300) + me.gwlbv20240906Conn, _ = gwlb.NewClient(me.Credential, me.Region, cpf) + me.gwlbv20240906Conn.WithHttpTransport(&LogRoundTripper{}) + + return me.gwlbv20240906Conn +} diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 364ea3dd00..1b7fce74ab 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -71,6 +71,7 @@ import ( "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/es" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/fl" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/gaap" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/gwlb" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/kms" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/lighthouse" "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/mariadb" @@ -1310,6 +1311,10 @@ func Provider() *schema.Provider { "tencentcloud_clb_instance_sla_config": clb.ResourceTencentCloudClbInstanceSlaConfig(), "tencentcloud_clb_replace_cert_for_lbs": clb.ResourceTencentCloudClbReplaceCertForLbs(), "tencentcloud_clb_security_group_attachment": clb.ResourceTencentCloudClbSecurityGroupAttachment(), + "tencentcloud_gwlb_instance": gwlb.ResourceTencentCloudGwlbInstance(), + "tencentcloud_gwlb_target_group": gwlb.ResourceTencentCloudGwlbTargetGroup(), + "tencentcloud_gwlb_instance_associate_target_groups": gwlb.ResourceTencentCloudGwlbInstanceAssociateTargetGroups(), + "tencentcloud_gwlb_target_group_register_instances": gwlb.ResourceTencentCloudGwlbTargetGroupRegisterInstances(), "tencentcloud_container_cluster": tke.ResourceTencentCloudContainerCluster(), "tencentcloud_container_cluster_instance": tke.ResourceTencentCloudContainerClusterInstance(), "tencentcloud_kubernetes_cluster": tke.ResourceTencentCloudKubernetesCluster(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index fe1e2ef237..b1d2afb9d1 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -366,6 +366,13 @@ Resource tencentcloud_container_cluster tencentcloud_container_cluster_instance +Gateway Load Balancer(GWLB) +Resource +tencentcloud_gwlb_instance +tencentcloud_gwlb_target_group +tencentcloud_gwlb_instance_associate_target_groups +tencentcloud_gwlb_target_group_register_instances + Cloud Load Balancer(CLB) Data Source tencentcloud_clb_attachments diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_instance.go b/tencentcloud/services/gwlb/resource_tc_gwlb_instance.go new file mode 100644 index 0000000000..a4d53a2f84 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_instance.go @@ -0,0 +1,362 @@ +package gwlb + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + gwlbv20240906 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudGwlbInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudGwlbInstanceCreate, + Read: resourceTencentCloudGwlbInstanceRead, + Update: resourceTencentCloudGwlbInstanceUpdate, + Delete: resourceTencentCloudGwlbInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "vpc_id": { + Type: schema.TypeString, + Required: true, + Description: "ID of the VPC to which the backend target device of the GWLB belongs, such as vpc-12345678. It can be obtained through the DescribeVpcEx interface. If left blank, it defaults to DefaultVPC. This parameter is required when a private network CLB instance is created.", + }, + + "subnet_id": { + Type: schema.TypeString, + Required: true, + Description: "Subnet ID of the VPC to which the backend target device of the GWLB belongs.", + }, + + "load_balancer_name": { + Type: schema.TypeString, + Optional: true, + Description: "GWLB instance name. It supports input of 1 to 60 characters. If not filled in, it will be generated automatically by default.", + }, + + "tags": { + Type: schema.TypeList, + Optional: true, + Description: "While the GWLB is purchased, it is tagged, with a maximum of 20 tag key-value pairs.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tag_key": { + Type: schema.TypeString, + Required: true, + Description: "Tag key.", + }, + "tag_value": { + Type: schema.TypeString, + Required: true, + Description: "Tag value.", + }, + }, + }, + }, + + "lb_charge_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "GWLB instance billing type, which currently supports POSTPAID_BY_HOUR only. The default is POSTPAID_BY_HOUR.", + }, + "vips": { + Computed: true, + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "Gateway Load Balancer provides virtual IP services.", + }, + "status": { + Type: schema.TypeInt, + Computed: true, + Description: "Gateway Load Balancer instance status. 0: Creating, 1: Running normally, 3: Removing.", + }, + "target_group_id": { + Type: schema.TypeString, + Computed: true, + Description: "Unique ID of the associated target group.", + }, + "delete_protect": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether to turn on the deletion protection function.", + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: "Create time.", + }, + "isolation": { + Type: schema.TypeInt, + Computed: true, + Description: "0: means not quarantined, 1: means quarantined.", + }, + "isolated_time": { + Type: schema.TypeString, + Computed: true, + Description: "Time when the Gateway Load Balancer instance was isolated.", + }, + "operate_protect": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether to enable the configuration modification protection function.", + }, + }, + } +} + +func resourceTencentCloudGwlbInstanceCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + var ( + instanceId string + ) + var ( + request = gwlbv20240906.NewCreateGatewayLoadBalancerRequest() + response = gwlbv20240906.NewCreateGatewayLoadBalancerResponse() + ) + + if v, ok := d.GetOk("vpc_id"); ok { + request.VpcId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("subnet_id"); ok { + request.SubnetId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("load_balancer_name"); ok { + request.LoadBalancerName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("tags"); ok { + for _, item := range v.([]interface{}) { + tagsMap := item.(map[string]interface{}) + tagInfo := gwlbv20240906.TagInfo{} + if v, ok := tagsMap["tag_key"]; ok { + tagInfo.TagKey = helper.String(v.(string)) + } + if v, ok := tagsMap["tag_value"]; ok { + tagInfo.TagValue = helper.String(v.(string)) + } + request.Tags = append(request.Tags, &tagInfo) + } + } + + if v, ok := d.GetOk("lb_charge_type"); ok { + request.LBChargeType = helper.String(v.(string)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().CreateGatewayLoadBalancerWithContext(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()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s create gwlb instance failed, reason:%+v", logId, err) + return err + } + + if len(response.Response.LoadBalancerIds) > 0 { + instanceId = *response.Response.LoadBalancerIds[0] + } + + conf := tccommon.BuildStateChangeConf([]string{}, []string{"0"}, 10*tccommon.ReadRetryTimeout, time.Second, service.TaskStatusRefreshFunc(ctx, *response.Response.RequestId, []string{})) + + if _, e := conf.WaitForState(); e != nil { + return e + } + _ = response + + d.SetId(instanceId) + + return resourceTencentCloudGwlbInstanceRead(d, meta) +} + +func resourceTencentCloudGwlbInstanceRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + instanceId := d.Id() + + respData, err := service.DescribeGwlbInstanceById(ctx, instanceId) + if err != nil { + return err + } + + if respData == nil { + d.SetId("") + log.Printf("[WARN]%s resource `gwlb_instance` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + return nil + } + if respData.VpcId != nil { + _ = d.Set("vpc_id", respData.VpcId) + } + if respData.SubnetId != nil { + _ = d.Set("subnet_id", respData.SubnetId) + } + if respData.LoadBalancerName != nil { + _ = d.Set("load_balancer_name", respData.LoadBalancerName) + } + if len(respData.Tags) > 0 { + tags := make([]interface{}, 0) + for _, tag := range respData.Tags { + tags = append(tags, map[string]interface{}{ + "tag_key": tag.TagKey, + "tag_value": tag.TagValue, + }) + + } + _ = d.Set("tags", tags) + } + if respData.ChargeType != nil { + _ = d.Set("lb_charge_type", respData.ChargeType) + } + if len(respData.Vips) > 0 { + vips := make([]string, 0) + for _, vip := range respData.Vips { + vips = append(vips, *vip) + } + _ = d.Set("vips", vips) + } + if respData.Status != nil { + _ = d.Set("status", respData.Status) + } + if respData.TargetGroupId != nil { + _ = d.Set("target_group_id", respData.TargetGroupId) + } + if respData.DeleteProtect != nil { + _ = d.Set("delete_protect", respData.DeleteProtect) + } + if respData.CreateTime != nil { + _ = d.Set("create_time", respData.CreateTime) + } + if respData.Isolation != nil { + _ = d.Set("isolation", respData.Isolation) + } + if respData.IsolatedTime != nil { + _ = d.Set("isolated_time", respData.IsolatedTime) + } + if respData.OperateProtect != nil { + _ = d.Set("operate_protect", respData.OperateProtect) + } + _ = instanceId + return nil +} + +func resourceTencentCloudGwlbInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance.update")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + immutableArgs := []string{"vpc_id", "subnet_id", "number", "tags", "lb_charge_type"} + for _, v := range immutableArgs { + if d.HasChange(v) { + return fmt.Errorf("argument `%s` cannot be changed", v) + } + } + instanceId := d.Id() + + needChange := false + mutableArgs := []string{"load_balancer_name"} + for _, v := range mutableArgs { + if d.HasChange(v) { + needChange = true + break + } + } + + if needChange { + request := gwlbv20240906.NewModifyGatewayLoadBalancerAttributeRequest() + request.LoadBalancerId = helper.String(instanceId) + if v, ok := d.GetOk("load_balancer_name"); ok { + request.LoadBalancerName = helper.String(v.(string)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().ModifyGatewayLoadBalancerAttributeWithContext(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 update gwlb instance failed, reason:%+v", logId, err) + return err + } + } + + _ = instanceId + return resourceTencentCloudGwlbInstanceRead(d, meta) +} + +func resourceTencentCloudGwlbInstanceDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + instanceId := d.Id() + + var ( + request = gwlbv20240906.NewDeleteGatewayLoadBalancerRequest() + response = gwlbv20240906.NewDeleteGatewayLoadBalancerResponse() + ) + + request.LoadBalancerIds = helper.Strings([]string{instanceId}) + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().DeleteGatewayLoadBalancerWithContext(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()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s delete gwlb instance failed, reason:%+v", logId, err) + return err + } + + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + conf := tccommon.BuildStateChangeConf([]string{}, []string{"0"}, 10*tccommon.ReadRetryTimeout, time.Second, service.TaskStatusRefreshFunc(ctx, *response.Response.RequestId, []string{})) + + if _, e := conf.WaitForState(); e != nil { + return e + } + _ = response + _ = instanceId + return nil +} diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_instance.md b/tencentcloud/services/gwlb/resource_tc_gwlb_instance.md new file mode 100644 index 0000000000..402c0a8f4f --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_instance.md @@ -0,0 +1,41 @@ +Provides a resource to create a gwlb gwlb_instance + +Example Usage + +```hcl +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} +``` + +Import + +gwlb gwlb_instance can be imported using the id, e.g. + +``` +terraform import tencentcloud_gwlb_instance.gwlb_instance gwlb_instance_id +``` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.go b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.go new file mode 100644 index 0000000000..2e1cae1a0e --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.go @@ -0,0 +1,139 @@ +package gwlb + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + gwlbv20240906 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudGwlbInstanceAssociateTargetGroups() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudGwlbInstanceAssociateTargetGroupsCreate, + Read: resourceTencentCloudGwlbInstanceAssociateTargetGroupsRead, + Delete: resourceTencentCloudGwlbInstanceAssociateTargetGroupsDelete, + Schema: map[string]*schema.Schema{ + "load_balancer_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "GWLB instance ID.", + }, + "target_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Target group ID.", + }, + }, + } +} + +func resourceTencentCloudGwlbInstanceAssociateTargetGroupsCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance_associate_target_groups.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + var ( + request = gwlbv20240906.NewAssociateTargetGroupsRequest() + response = gwlbv20240906.NewAssociateTargetGroupsResponse() + ) + loadBalancerId := d.Get("load_balancer_id").(string) + targetGroupId := d.Get("target_group_id").(string) + request.Associations = []*gwlbv20240906.TargetGroupAssociation{ + { + LoadBalancerId: helper.String(loadBalancerId), + TargetGroupId: helper.String(targetGroupId), + }, + } + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().AssociateTargetGroupsWithContext(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()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s create gwlb instance associate target groups failed, reason:%+v", logId, err) + return err + } + + _ = response + + d.SetId(strings.Join([]string{loadBalancerId, targetGroupId}, tccommon.FILED_SP)) + + return resourceTencentCloudGwlbInstanceAssociateTargetGroupsRead(d, meta) +} + +func resourceTencentCloudGwlbInstanceAssociateTargetGroupsRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance_associate_target_groups.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + items := strings.Split(d.Id(), tccommon.FILED_SP) + if len(items) < 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + + _ = d.Set("load_balancer_id", items[0]) + _ = d.Set("target_group_id", items[1]) + _ = ctx + return nil +} + +func resourceTencentCloudGwlbInstanceAssociateTargetGroupsDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_instance_associate_target_groups.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + items := strings.Split(d.Id(), tccommon.FILED_SP) + if len(items) < 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + + var ( + request = gwlbv20240906.NewDisassociateTargetGroupsRequest() + response = gwlbv20240906.NewDisassociateTargetGroupsResponse() + ) + + request.Associations = []*gwlbv20240906.TargetGroupAssociation{ + { + LoadBalancerId: helper.String(items[0]), + TargetGroupId: helper.String(items[1]), + }, + } + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().DisassociateTargetGroupsWithContext(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()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s delete gwlb instance associate target groups failed, reason:%+v", logId, err) + return err + } + + _ = response + return nil +} diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.md b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.md new file mode 100644 index 0000000000..4b532ce436 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups.md @@ -0,0 +1,53 @@ +Provides a resource to create a gwlb gwlb_instance_associate_target_groups + +Example Usage + +```hcl +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} + +resource "tencentcloud_gwlb_instance_associate_target_groups" "gwlb_instance_associate_target_groups" { + load_balancer_id = tencentcloud_gwlb_instance.gwlb_instance.id + target_group_id = tencentcloud_gwlb_target_group.gwlb_target_group.id +} +``` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups_test.go b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups_test.go new file mode 100644 index 0000000000..77ca781d55 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_associate_target_groups_test.go @@ -0,0 +1,76 @@ +package gwlb_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudGwlbInstanceAssociateTargetGroupsResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{ + { + Config: testAccGwlbInstanceAssociateTargetGroups, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_gwlb_instance_associate_target_groups.gwlb_instance_associate_target_groups", "id")), + }, + }, + }) +} + +const testAccGwlbInstanceAssociateTargetGroups = ` + +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} + +resource "tencentcloud_gwlb_instance_associate_target_groups" "gwlb_instance_associate_target_groups" { + load_balancer_id = tencentcloud_gwlb_instance.gwlb_instance.id + target_group_id = tencentcloud_gwlb_target_group.gwlb_target_group.id +} +` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_instance_test.go b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_test.go new file mode 100644 index 0000000000..f32a54e477 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_instance_test.go @@ -0,0 +1,97 @@ +package gwlb_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudGwlbInstanceResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{ + { + Config: testAccGwlbInstance, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_gwlb_instance.gwlb_instance", "id")), + }, + { + Config: testAccGwlbInstanceUpdate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_gwlb_instance.gwlb_instance", "id"), + resource.TestCheckResourceAttr("tencentcloud_gwlb_instance.gwlb_instance", "load_balancer_name", "tf-test-update"), + ), + }, + { + ResourceName: "tencentcloud_gwlb_instance.gwlb_instance", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccGwlbInstance = ` +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} +` + +const testAccGwlbInstanceUpdate = ` +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test-update" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} +` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_target_group.go b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group.go new file mode 100644 index 0000000000..8b8f49710d --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group.go @@ -0,0 +1,453 @@ +package gwlb + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + gwlbv20240906 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudGwlbTargetGroup() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudGwlbTargetGroupCreate, + Read: resourceTencentCloudGwlbTargetGroupRead, + Update: resourceTencentCloudGwlbTargetGroupUpdate, + Delete: resourceTencentCloudGwlbTargetGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "target_group_name": { + Type: schema.TypeString, + Optional: true, + Description: "Target group name, limited to 60 characters.", + }, + + "vpc_id": { + Type: schema.TypeString, + Optional: true, + Description: "VPCID attribute of target group. If this parameter is left blank, the default VPC will be used.", + }, + + "port": { + Type: schema.TypeInt, + Optional: true, + Description: "Default port of the target group, which can be used when servers are added later. Either 'Port' or 'TargetGroupInstances.N.port' must be filled in.", + }, + + "target_group_instances": { + Type: schema.TypeList, + Computed: true, + Description: "Real server bound to a target group.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bind_ip": { + Type: schema.TypeString, + Computed: true, + Description: "Private network IP of target group instance.", + }, + "port": { + Type: schema.TypeInt, + Computed: true, + Description: "Port of target group instance. Only 6081 is supported.", + }, + "weight": { + Type: schema.TypeInt, + Computed: true, + Description: "Weight of target group instance. Only 0 or 16 is supported, and non-0 is uniformly treated as 16.", + }, + }, + }, + }, + + "protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "GWLB target group protocol.\n" + + " - TENCENT_GENEVE: GENEVE standard protocol;\n" + + " - AWS_GENEVE: GENEVE compatibility protocol (a ticket is required for allowlisting).", + }, + + "health_check": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Description: "Health check settings.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "health_switch": { + Type: schema.TypeBool, + Required: true, + Description: "Whether to enable the health check.", + }, + "protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Protocol used for health check, which supports PING and TCP and is PING by default.\n" + + " - PING: icmp;\n" + + " - TCP: tcp.", + }, + "port": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Health check port, which is required when the probe protocol is TCP.", + }, + "timeout": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Health check timeout. The default is 2 seconds. Value range: 2-30 seconds.", + }, + "interval_time": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Detection interval time. The default is 5 seconds. Value range: 2-300 seconds.", + }, + "health_num": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Health detection threshold. The default is 3 times. Value range: 2-10 times.", + }, + "un_health_num": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Unhealth detection threshold. The default is 3 times. Value range: 2-10 times.", + }, + }, + }, + }, + + "schedule_algorithm": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Load balancing algorithm.\n" + + " - IP_HASH_3_ELASTIC: elastic hashing.", + }, + + "all_dead_to_alive": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Whether \"All Dead, All Alive\" is supported. It is supported by default.", + }, + }, + } +} + +func resourceTencentCloudGwlbTargetGroupCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + var ( + instanceId string + ) + var ( + request = gwlbv20240906.NewCreateTargetGroupRequest() + response = gwlbv20240906.NewCreateTargetGroupResponse() + ) + + if v, ok := d.GetOk("target_group_name"); ok { + request.TargetGroupName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("vpc_id"); ok { + request.VpcId = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("port"); ok { + request.Port = helper.IntUint64(v.(int)) + } + + if v, ok := d.GetOk("protocol"); ok { + request.Protocol = helper.String(v.(string)) + } + + if healthCheckMap, ok := helper.InterfacesHeadMap(d, "health_check"); ok { + targetGroupHealthCheck := gwlbv20240906.TargetGroupHealthCheck{} + if v, ok := healthCheckMap["health_switch"]; ok { + targetGroupHealthCheck.HealthSwitch = helper.Bool(v.(bool)) + } + if v, ok := healthCheckMap["protocol"]; ok { + targetGroupHealthCheck.Protocol = helper.String(v.(string)) + } + if v, ok := healthCheckMap["port"]; ok { + targetGroupHealthCheck.Port = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["timeout"]; ok { + targetGroupHealthCheck.Timeout = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["interval_time"]; ok { + targetGroupHealthCheck.IntervalTime = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["health_num"]; ok { + targetGroupHealthCheck.HealthNum = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["un_health_num"]; ok { + targetGroupHealthCheck.UnHealthNum = helper.IntInt64(v.(int)) + } + request.HealthCheck = &targetGroupHealthCheck + } + + if v, ok := d.GetOk("schedule_algorithm"); ok { + request.ScheduleAlgorithm = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("all_dead_to_alive"); ok { + request.AllDeadToAlive = helper.Bool(v.(bool)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().CreateTargetGroupWithContext(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()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s create gwlb target group failed, reason:%+v", logId, err) + return err + } + + instanceId = *response.Response.TargetGroupId + _ = response + + d.SetId(instanceId) + + return resourceTencentCloudGwlbTargetGroupRead(d, meta) +} + +func resourceTencentCloudGwlbTargetGroupRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + instanceId := d.Id() + + respData, err := service.DescribeGwlbTargetGroupById(ctx, instanceId) + if err != nil { + return err + } + + if respData == nil { + d.SetId("") + log.Printf("[WARN]%s resource `gwlb_target_group` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + return nil + } + if respData.TargetGroupId != nil { + instanceId = *respData.TargetGroupId + } + + if respData.VpcId != nil { + _ = d.Set("vpc_id", respData.VpcId) + } + + if respData.TargetGroupName != nil { + _ = d.Set("target_group_name", respData.TargetGroupName) + } + + if respData.Port != nil { + _ = d.Set("port", respData.Port) + } + + if respData.HealthCheck != nil { + healthCheck := make(map[string]interface{}) + if respData.HealthCheck.HealthSwitch != nil { + healthCheck["health_switch"] = respData.HealthCheck.HealthSwitch + } + if respData.HealthCheck.Protocol != nil { + healthCheck["protocol"] = respData.HealthCheck.Protocol + } + if respData.HealthCheck.Port != nil { + healthCheck["port"] = respData.HealthCheck.Port + } + if respData.HealthCheck.Timeout != nil { + healthCheck["timeout"] = respData.HealthCheck.Timeout + } + if respData.HealthCheck.IntervalTime != nil { + healthCheck["interval_time"] = respData.HealthCheck.IntervalTime + } + if respData.HealthCheck.HealthNum != nil { + healthCheck["health_num"] = respData.HealthCheck.HealthNum + } + if respData.HealthCheck.UnHealthNum != nil { + healthCheck["un_health_num"] = respData.HealthCheck.UnHealthNum + } + + _ = d.Set("health_check", []interface{}{healthCheck}) + } + + if respData.Protocol != nil { + _ = d.Set("protocol", respData.Protocol) + } + + if respData.ScheduleAlgorithm != nil { + _ = d.Set("schedule_algorithm", respData.ScheduleAlgorithm) + } + if respData.AllDeadToAlive != nil { + _ = d.Set("all_dead_to_alive", respData.AllDeadToAlive) + } + + targetGroupBackends, err := service.DescribeTargetGroupInstancesById(ctx, instanceId) + if err != nil { + return err + } + targetGroupInstanceList := make([]interface{}, 0) + for _, targetGroupBackend := range targetGroupBackends { + targetGroupBackendMap := make(map[string]interface{}) + if len(targetGroupBackend.PrivateIpAddresses) > 0 { + targetGroupBackendMap["bind_ip"] = targetGroupBackend.PrivateIpAddresses[0] + } + if targetGroupBackend.Port != nil { + targetGroupBackendMap["port"] = targetGroupBackend.Port + } + if targetGroupBackend.Weight != nil { + targetGroupBackendMap["weight"] = targetGroupBackend.Weight + } + } + _ = d.Set("target_group_instances", targetGroupInstanceList) + + return nil +} + +func resourceTencentCloudGwlbTargetGroupUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group.update")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + immutableArgs := []string{"vpc_id", "port", "protocol", "schedule_algorithm"} + for _, v := range immutableArgs { + if d.HasChange(v) { + return fmt.Errorf("argument `%s` cannot be changed", v) + } + } + instanceId := d.Id() + + needChange1 := false + mutableArgs1 := []string{"target_group_name", "health_check", "all_dead_to_alive"} + for _, v := range mutableArgs1 { + if d.HasChange(v) { + needChange1 = true + break + } + } + + if needChange1 { + request1 := gwlbv20240906.NewModifyTargetGroupAttributeRequest() + + request1.TargetGroupId = helper.String(instanceId) + + if v, ok := d.GetOk("target_group_name"); ok { + request1.TargetGroupName = helper.String(v.(string)) + } + + if healthCheckMap, ok := helper.InterfacesHeadMap(d, "health_check"); ok { + targetGroupHealthCheck := gwlbv20240906.TargetGroupHealthCheck{} + if v, ok := healthCheckMap["health_switch"]; ok { + targetGroupHealthCheck.HealthSwitch = helper.Bool(v.(bool)) + } + if v, ok := healthCheckMap["protocol"]; ok { + targetGroupHealthCheck.Protocol = helper.String(v.(string)) + } + if v, ok := healthCheckMap["port"]; ok { + targetGroupHealthCheck.Port = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["timeout"]; ok { + targetGroupHealthCheck.Timeout = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["interval_time"]; ok { + targetGroupHealthCheck.IntervalTime = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["health_num"]; ok { + targetGroupHealthCheck.HealthNum = helper.IntInt64(v.(int)) + } + if v, ok := healthCheckMap["un_health_num"]; ok { + targetGroupHealthCheck.UnHealthNum = helper.IntInt64(v.(int)) + } + request1.HealthCheck = &targetGroupHealthCheck + } + + if v, ok := d.GetOkExists("all_dead_to_alive"); ok { + request1.AllDeadToAlive = helper.Bool(v.(bool)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().ModifyTargetGroupAttributeWithContext(ctx, request1) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request1.GetAction(), request1.ToJsonString(), result.ToJsonString()) + } + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s update gwlb target group failed, reason:%+v", logId, err) + return err + } + } + + return resourceTencentCloudGwlbTargetGroupRead(d, meta) +} + +func resourceTencentCloudGwlbTargetGroupDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + instanceId := d.Id() + + var ( + request = gwlbv20240906.NewDeleteTargetGroupsRequest() + response = gwlbv20240906.NewDeleteTargetGroupsResponse() + ) + + request.TargetGroupIds = helper.Strings([]string{instanceId}) + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseGwlbV20240906Client().DeleteTargetGroupsWithContext(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()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s delete gwlb target group failed, reason:%+v", logId, err) + return err + } + + _ = response + _ = instanceId + return nil +} diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_target_group.md b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group.md new file mode 100644 index 0000000000..4866385eb6 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group.md @@ -0,0 +1,33 @@ +Provides a resource to create a gwlb gwlb_target_group + +Example Usage + +```hcl +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} +``` + +Import + +gwlb gwlb_target_group can be imported using the id, e.g. + +``` +terraform import tencentcloud_gwlb_target_group.gwlb_target_group gwlb_target_group_id +``` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.go b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.go new file mode 100644 index 0000000000..828cc3b4de --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.go @@ -0,0 +1,251 @@ +package gwlb + +import ( + "context" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + gwlbv20240906 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudGwlbTargetGroupRegisterInstances() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudGwlbTargetGroupRegisterInstancesCreate, + Read: resourceTencentCloudGwlbTargetGroupRegisterInstancesRead, + Delete: resourceTencentCloudGwlbTargetGroupRegisterInstancesDelete, + Update: resourceTencentCloudGwlbTargetGroupRegisterInstancesUpdate, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "target_group_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Target group ID.", + }, + + "target_group_instances": { + Type: schema.TypeSet, + Required: true, + Description: "Server instance array.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bind_ip": { + Type: schema.TypeString, + Required: true, + Description: "Private network IP of target group instance.", + }, + "port": { + Type: schema.TypeInt, + Optional: true, + Description: "Port of target group instance. Only 6081 is supported.", + }, + "weight": { + Type: schema.TypeInt, + Optional: true, + Description: "Weight of target group instance. Only 0 or 16 is supported, and non-0 is uniformly treated as 16.", + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudGwlbTargetGroupRegisterInstancesCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group_register_instances.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + var ( + targetGroupId string + targetGroupInstances []*gwlbv20240906.TargetGroupInstance + ) + + if v, ok := d.GetOk("target_group_id"); ok { + targetGroupId = v.(string) + } + + if v, ok := d.GetOk("target_group_instances"); ok { + targetGroupInstances = make([]*gwlbv20240906.TargetGroupInstance, 0) + for _, item := range v.(*schema.Set).List() { + targetGroupInstancesMap := item.(map[string]interface{}) + targetGroupInstance := gwlbv20240906.TargetGroupInstance{} + if v, ok := targetGroupInstancesMap["bind_ip"]; ok { + targetGroupInstance.BindIP = helper.String(v.(string)) + } + if v, ok := targetGroupInstancesMap["port"]; ok { + targetGroupInstance.Port = helper.IntUint64(v.(int)) + } + if v, ok := targetGroupInstancesMap["weight"]; ok { + targetGroupInstance.Weight = helper.IntUint64(v.(int)) + } + targetGroupInstances = append(targetGroupInstances, &targetGroupInstance) + } + } + + err := service.RegisterTargetGroupInstances(ctx, targetGroupId, targetGroupInstances) + if err != nil { + log.Printf("[CRITAL]%s create gwlb target group register instances failed, reason:%+v", logId, err) + return err + } + + d.SetId(targetGroupId) + + return resourceTencentCloudGwlbTargetGroupRegisterInstancesRead(d, meta) +} + +func resourceTencentCloudGwlbTargetGroupRegisterInstancesUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group_register_instances.update")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + targetGroupId := d.Id() + + if d.HasChange("target_group_instances") { + o, n := d.GetChange("target_group_instances") + os := o.(*schema.Set) + ns := n.(*schema.Set) + add := ns.Difference(os).List() + remove := os.Difference(ns).List() + + if len(remove) > 0 { + removeTargetGroupInstances := make([]*gwlbv20240906.TargetGroupInstance, 0) + for _, item := range remove { + targetGroupInstancesMap := item.(map[string]interface{}) + targetGroupInstance := gwlbv20240906.TargetGroupInstance{} + if v, ok := targetGroupInstancesMap["bind_ip"]; ok { + targetGroupInstance.BindIP = helper.String(v.(string)) + } + if v, ok := targetGroupInstancesMap["port"]; ok { + targetGroupInstance.Port = helper.IntUint64(v.(int)) + } + if v, ok := targetGroupInstancesMap["weight"]; ok { + targetGroupInstance.Weight = helper.IntUint64(v.(int)) + } + removeTargetGroupInstances = append(removeTargetGroupInstances, &targetGroupInstance) + } + err := service.DeregisterTargetGroupInstances(ctx, targetGroupId, removeTargetGroupInstances) + if err != nil { + log.Printf("[CRITAL]%s delete gwlb target group register instances failed, reason:%+v", logId, err) + return err + } + } + if len(add) > 0 { + addTargetGroupInstances := make([]*gwlbv20240906.TargetGroupInstance, 0) + for _, item := range add { + targetGroupInstancesMap := item.(map[string]interface{}) + targetGroupInstance := gwlbv20240906.TargetGroupInstance{} + if v, ok := targetGroupInstancesMap["bind_ip"]; ok { + targetGroupInstance.BindIP = helper.String(v.(string)) + } + if v, ok := targetGroupInstancesMap["port"]; ok { + targetGroupInstance.Port = helper.IntUint64(v.(int)) + } + if v, ok := targetGroupInstancesMap["weight"]; ok { + targetGroupInstance.Weight = helper.IntUint64(v.(int)) + } + addTargetGroupInstances = append(addTargetGroupInstances, &targetGroupInstance) + } + err := service.RegisterTargetGroupInstances(ctx, targetGroupId, addTargetGroupInstances) + if err != nil { + log.Printf("[CRITAL]%s create gwlb target group register instances failed, reason:%+v", logId, err) + return err + } + } + } + return resourceTencentCloudGwlbTargetGroupRegisterInstancesRead(d, meta) +} + +func resourceTencentCloudGwlbTargetGroupRegisterInstancesRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group_register_instances.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + targetGroupId := d.Id() + + respData, err := service.DescribeGwlbTargetGroupRegisterInstancesById(ctx, targetGroupId) + if err != nil { + return err + } + + if respData == nil { + d.SetId("") + log.Printf("[WARN]%s resource `gwlb_target_group_register_instances` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + return nil + } + + _ = d.Set("target_group_id", targetGroupId) + targetGroupInstances := make([]interface{}, 0) + for _, item := range respData.TargetGroupInstanceSet { + targetGroupInstanceMap := make(map[string]interface{}) + if len(item.PrivateIpAddresses) > 0 { + targetGroupInstanceMap["bind_ip"] = item.PrivateIpAddresses[0] + } + if item.Port != nil { + targetGroupInstanceMap["port"] = item.Port + } + if item.Weight != nil { + targetGroupInstanceMap["weight"] = item.Weight + } + targetGroupInstances = append(targetGroupInstances, targetGroupInstanceMap) + } + + _ = d.Set("target_group_instances", targetGroupInstances) + _ = targetGroupId + return nil +} + +func resourceTencentCloudGwlbTargetGroupRegisterInstancesDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_gwlb_target_group_register_instances.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service := GwlbService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + targetGroupId := d.Id() + + targetGroupInstances := make([]*gwlbv20240906.TargetGroupInstance, 0) + if v, ok := d.GetOk("target_group_instances"); ok { + for _, item := range v.(*schema.Set).List() { + targetGroupInstancesMap := item.(map[string]interface{}) + targetGroupInstance := gwlbv20240906.TargetGroupInstance{} + if v, ok := targetGroupInstancesMap["bind_ip"]; ok { + targetGroupInstance.BindIP = helper.String(v.(string)) + } + if v, ok := targetGroupInstancesMap["port"]; ok { + targetGroupInstance.Port = helper.IntUint64(v.(int)) + } + if v, ok := targetGroupInstancesMap["weight"]; ok { + targetGroupInstance.Weight = helper.IntUint64(v.(int)) + } + targetGroupInstances = append(targetGroupInstances, &targetGroupInstance) + } + } + err := service.DeregisterTargetGroupInstances(ctx, targetGroupId, targetGroupInstances) + if err != nil { + log.Printf("[CRITAL]%s delete gwlb target group register instances failed, reason:%+v", logId, err) + return err + } + + return nil +} diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.md b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.md new file mode 100644 index 0000000000..dbe5d4a101 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances.md @@ -0,0 +1,85 @@ +Provides a resource to create a gwlb gwlb_target_group_register_instances + +Example Usage + +```hcl +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} + +resource "tencentcloud_instance" "foo" { + system_disk_type = "CLOUD_PREMIUM" + instance_name = "tf-test" + image_id = data.tencentcloud_images.default.images.0.image_id + instance_type = "S5.MEDIUM2" + system_disk_size = 100 + subnet_id = tencentcloud_subnet.subnet.id + vpc_id = tencentcloud_vpc.vpc.id + hostname = "tf-test" + disable_security_service = true + allocate_public_ip = true + internet_max_bandwidth_out = 5 + availability_zone = var.availability_zone +} + +data "tencentcloud_images" "default" { + image_type = ["PUBLIC_IMAGE"] + image_name_regex = "Final" +} + +resource "tencentcloud_gwlb_target_group_register_instances" "gwlb_target_group_register_instances" { + target_group_id = tencentcloud_gwlb_target_group.gwlb_target_group.id + target_group_instances { + bind_ip = tencentcloud_instance.foo.private_ip + port = 6081 + weight = 0 + } +} +``` + +Import + +gwlb gwlb_target_group_register_instances can be imported using the id, e.g. + +``` +terraform import tencentcloud_gwlb_target_group_register_instances.gwlb_target_group_register_instances gwlb_target_group_register_instances_id +``` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances_test.go b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances_test.go new file mode 100644 index 0000000000..08f68d5d9f --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_register_instances_test.go @@ -0,0 +1,100 @@ +package gwlb_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudGwlbTargetGroupRegisterInstancesResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccGwlbTargetGroupRegisterInstances, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_gwlb_target_group_register_instances.gwlb_target_group_register_instances", "id")), + }, { + ResourceName: "tencentcloud_gwlb_target_group_register_instances.gwlb_target_group_register_instances", + ImportState: true, + }}, + }) +} + +const testAccGwlbTargetGroupRegisterInstances = ` +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} + +resource "tencentcloud_instance" "foo" { + system_disk_type = "CLOUD_PREMIUM" + instance_name = "tf-test" + image_id = data.tencentcloud_images.default.images.0.image_id + instance_type = "S5.MEDIUM2" + system_disk_size = 100 + subnet_id = tencentcloud_subnet.subnet.id + vpc_id = tencentcloud_vpc.vpc.id + hostname = "tf-test" + disable_security_service = true + allocate_public_ip = true + internet_max_bandwidth_out = 5 + availability_zone = var.availability_zone +} + +data "tencentcloud_images" "default" { + image_type = ["PUBLIC_IMAGE"] + image_name_regex = "Final" +} + +resource "tencentcloud_gwlb_target_group_register_instances" "gwlb_target_group_register_instances" { + target_group_id = tencentcloud_gwlb_target_group.gwlb_target_group.id + target_group_instances { + bind_ip = tencentcloud_instance.foo.private_ip + port = 6081 + weight = 0 + } +} +` diff --git a/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_test.go b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_test.go new file mode 100644 index 0000000000..18824460a0 --- /dev/null +++ b/tencentcloud/services/gwlb/resource_tc_gwlb_target_group_test.go @@ -0,0 +1,81 @@ +package gwlb_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudGwlbTargetGroupResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{ + { + Config: testAccGwlbTargetGroup, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_gwlb_target_group.gwlb_target_group", "id")), + }, + { + Config: testAccGwlbTargetGroupUpdate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_gwlb_target_group.gwlb_target_group", "id"), + resource.TestCheckResourceAttr("tencentcloud_gwlb_target_group.gwlb_target_group", "health_check.0.timeout", "5"), + ), + }, + { + ResourceName: "tencentcloud_gwlb_target_group.gwlb_target_group", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccGwlbTargetGroup = ` +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} +` + +const testAccGwlbTargetGroupUpdate = ` +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 5 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} +` diff --git a/tencentcloud/services/gwlb/service_tencentcloud_gwlb.go b/tencentcloud/services/gwlb/service_tencentcloud_gwlb.go new file mode 100644 index 0000000000..628a7f816b --- /dev/null +++ b/tencentcloud/services/gwlb/service_tencentcloud_gwlb.go @@ -0,0 +1,247 @@ +package gwlb + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + gwlbv20240906 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/connectivity" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/ratelimit" +) + +func NewGwlbService(client *connectivity.TencentCloudClient) GwlbService { + return GwlbService{client: client} +} + +type GwlbService struct { + client *connectivity.TencentCloudClient +} + +func (me *GwlbService) DescribeGwlbInstanceById(ctx context.Context, instanceId string) (gatewayLoadBalancer *gwlbv20240906.GatewayLoadBalancer, errRet error) { + logId := tccommon.GetLogId(ctx) + + request := gwlbv20240906.NewDescribeGatewayLoadBalancersRequest() + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + request.LoadBalancerIds = helper.Strings([]string{instanceId}) + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + ratelimit.Check(request.GetAction()) + response, e := me.client.UseGwlbV20240906Client().DescribeGatewayLoadBalancers(request) + if e != nil { + return tccommon.RetryError(e) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + if len(response.Response.LoadBalancerSet) > 0 { + gatewayLoadBalancer = response.Response.LoadBalancerSet[0] + } + return nil + }) + if err != nil { + errRet = err + return + } + return +} + +func (me *GwlbService) DescribeGwlbTargetGroupById(ctx context.Context, instanceId string) (ret *gwlbv20240906.TargetGroupInfo, errRet error) { + logId := tccommon.GetLogId(ctx) + + request := gwlbv20240906.NewDescribeTargetGroupListRequest() + + request.TargetGroupIds = helper.Strings([]string{instanceId}) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + ratelimit.Check(request.GetAction()) + response, e := me.client.UseGwlbV20240906Client().DescribeTargetGroupList(request) + if e != nil { + return tccommon.RetryError(e) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + if len(response.Response.TargetGroupSet) > 0 { + ret = response.Response.TargetGroupSet[0] + } + return nil + }) + if err != nil { + errRet = err + return + } + + return +} + +func (me *GwlbService) DescribeTargetGroupInstancesById(ctx context.Context, instanceId string) (targetGroupBackends []*gwlbv20240906.TargetGroupBackend, errRet error) { + logId := tccommon.GetLogId(ctx) + + request := gwlbv20240906.NewDescribeTargetGroupInstancesRequest() + + request.Filters = []*gwlbv20240906.Filter{ + { + Name: helper.String("TargetGroupId"), + Values: helper.Strings([]string{instanceId}), + }, + } + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + ratelimit.Check(request.GetAction()) + response, e := me.client.UseGwlbV20240906Client().DescribeTargetGroupInstances(request) + if e != nil { + return tccommon.RetryError(e) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + targetGroupBackends = response.Response.TargetGroupInstanceSet + return nil + }) + if err != nil { + errRet = err + return + } + + return +} + +func (me *GwlbService) DescribeGwlbTargetGroupRegisterInstancesById(ctx context.Context, targetGroupId string) (ret *gwlbv20240906.DescribeTargetGroupInstancesResponseParams, errRet error) { + logId := tccommon.GetLogId(ctx) + + request := gwlbv20240906.NewDescribeTargetGroupInstancesRequest() + request.Filters = []*gwlbv20240906.Filter{ + { + Name: helper.String("TargetGroupId"), + Values: helper.Strings([]string{targetGroupId}), + }, + } + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + ratelimit.Check(request.GetAction()) + response, e := me.client.UseGwlbV20240906Client().DescribeTargetGroupInstances(request) + if e != nil { + return tccommon.RetryError(e) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + ret = response.Response + return nil + }) + if err != nil { + errRet = err + return + } + + return +} + +func (me *GwlbService) RegisterTargetGroupInstances(ctx context.Context, targetGroupId string, targetGroupInstances []*gwlbv20240906.TargetGroupInstance) error { + logId := tccommon.GetLogId(ctx) + request := gwlbv20240906.NewRegisterTargetGroupInstancesRequest() + request.TargetGroupInstances = targetGroupInstances + request.TargetGroupId = helper.String(targetGroupId) + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := me.client.UseGwlbV20240906Client().RegisterTargetGroupInstancesWithContext(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 { + return err + } + + return nil +} + +func (me *GwlbService) DeregisterTargetGroupInstances(ctx context.Context, targetGroupId string, targetGroupInstances []*gwlbv20240906.TargetGroupInstance) error { + logId := tccommon.GetLogId(ctx) + + request := gwlbv20240906.NewDeregisterTargetGroupInstancesRequest() + request.TargetGroupId = helper.String(targetGroupId) + request.TargetGroupInstances = targetGroupInstances + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := me.client.UseGwlbV20240906Client().DeregisterTargetGroupInstancesWithContext(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 { + return err + } + + return nil +} + +func (me *GwlbService) DescribeTaskStatus(ctx context.Context, taskId string) (status *int64, errRet error) { + logId := tccommon.GetLogId(ctx) + + request := gwlbv20240906.NewDescribeTaskStatusRequest() + + request.TaskId = helper.String(taskId) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + ratelimit.Check(request.GetAction()) + response, e := me.client.UseGwlbV20240906Client().DescribeTaskStatus(request) + if e != nil { + return tccommon.RetryError(e) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + status = response.Response.Status + return nil + }) + if err != nil { + errRet = err + return + } + + return +} + +func (me *GwlbService) TaskStatusRefreshFunc(ctx context.Context, taskId string, failStates []string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + status, err := me.DescribeTaskStatus(ctx, taskId) + + if err != nil { + return nil, "", err + } + + if status == nil { + return nil, "", fmt.Errorf("task status is nil") + } + return status, helper.Int64ToStr(*status), nil + } +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/client.go new file mode 100644 index 0000000000..79fdc45290 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/client.go @@ -0,0 +1,1064 @@ +// 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 v20240906 + +import ( + "context" + "errors" + "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/profile" +) + +const APIVersion = "2024-09-06" + +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 NewAssociateTargetGroupsRequest() (request *AssociateTargetGroupsRequest) { + request = &AssociateTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "AssociateTargetGroups") + + + return +} + +func NewAssociateTargetGroupsResponse() (response *AssociateTargetGroupsResponse) { + response = &AssociateTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// AssociateTargetGroups +// This API is used to bind target groups to a CLB.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) AssociateTargetGroups(request *AssociateTargetGroupsRequest) (response *AssociateTargetGroupsResponse, err error) { + return c.AssociateTargetGroupsWithContext(context.Background(), request) +} + +// AssociateTargetGroups +// This API is used to bind target groups to a CLB.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) AssociateTargetGroupsWithContext(ctx context.Context, request *AssociateTargetGroupsRequest) (response *AssociateTargetGroupsResponse, err error) { + if request == nil { + request = NewAssociateTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("AssociateTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewAssociateTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewCreateGatewayLoadBalancerRequest() (request *CreateGatewayLoadBalancerRequest) { + request = &CreateGatewayLoadBalancerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "CreateGatewayLoadBalancer") + + + return +} + +func NewCreateGatewayLoadBalancerResponse() (response *CreateGatewayLoadBalancerResponse) { + response = &CreateGatewayLoadBalancerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// CreateGatewayLoadBalancer +// This API is used to create a GWLB instance. To use the GWLB service, you must purchase one or more GWLB instances. After this API is called successfully, a unique ID for the GWLB instance will be returned.Note: The default purchase quota for each account in each region is 10.This is an async API. After the API is called successfully, you can use the DescribeGatewayLoadBalancers API to query the status of the GWLB instance (such as creating and normal) to determine whether the creation is successful. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) CreateGatewayLoadBalancer(request *CreateGatewayLoadBalancerRequest) (response *CreateGatewayLoadBalancerResponse, err error) { + return c.CreateGatewayLoadBalancerWithContext(context.Background(), request) +} + +// CreateGatewayLoadBalancer +// This API is used to create a GWLB instance. To use the GWLB service, you must purchase one or more GWLB instances. After this API is called successfully, a unique ID for the GWLB instance will be returned.Note: The default purchase quota for each account in each region is 10.This is an async API. After the API is called successfully, you can use the DescribeGatewayLoadBalancers API to query the status of the GWLB instance (such as creating and normal) to determine whether the creation is successful. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) CreateGatewayLoadBalancerWithContext(ctx context.Context, request *CreateGatewayLoadBalancerRequest) (response *CreateGatewayLoadBalancerResponse, err error) { + if request == nil { + request = NewCreateGatewayLoadBalancerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateGatewayLoadBalancer require credential") + } + + request.SetContext(ctx) + + response = NewCreateGatewayLoadBalancerResponse() + err = c.Send(request, response) + return +} + +func NewCreateTargetGroupRequest() (request *CreateTargetGroupRequest) { + request = &CreateTargetGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "CreateTargetGroup") + + + return +} + +func NewCreateTargetGroupResponse() (response *CreateTargetGroupResponse) { + response = &CreateTargetGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// CreateTargetGroup +// This API is used to create a target group. This feature is in beta testing. If you need to use it, please [submit a ticket](https://console.cloud.tencent.com/workorder/category?level1_id=6&level2_id=163&source=0&data_title=%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1%20LB&step=1). +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) CreateTargetGroup(request *CreateTargetGroupRequest) (response *CreateTargetGroupResponse, err error) { + return c.CreateTargetGroupWithContext(context.Background(), request) +} + +// CreateTargetGroup +// This API is used to create a target group. This feature is in beta testing. If you need to use it, please [submit a ticket](https://console.cloud.tencent.com/workorder/category?level1_id=6&level2_id=163&source=0&data_title=%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1%20LB&step=1). +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) CreateTargetGroupWithContext(ctx context.Context, request *CreateTargetGroupRequest) (response *CreateTargetGroupResponse, err error) { + if request == nil { + request = NewCreateTargetGroupRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateTargetGroup require credential") + } + + request.SetContext(ctx) + + response = NewCreateTargetGroupResponse() + err = c.Send(request, response) + return +} + +func NewDeleteGatewayLoadBalancerRequest() (request *DeleteGatewayLoadBalancerRequest) { + request = &DeleteGatewayLoadBalancerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DeleteGatewayLoadBalancer") + + + return +} + +func NewDeleteGatewayLoadBalancerResponse() (response *DeleteGatewayLoadBalancerResponse) { + response = &DeleteGatewayLoadBalancerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeleteGatewayLoadBalancer +// This API is used to delete one or more specified GWLB instances. After successful deletion, the GWLB instances will be unbound from the backend service.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestId as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +func (c *Client) DeleteGatewayLoadBalancer(request *DeleteGatewayLoadBalancerRequest) (response *DeleteGatewayLoadBalancerResponse, err error) { + return c.DeleteGatewayLoadBalancerWithContext(context.Background(), request) +} + +// DeleteGatewayLoadBalancer +// This API is used to delete one or more specified GWLB instances. After successful deletion, the GWLB instances will be unbound from the backend service.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestId as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +func (c *Client) DeleteGatewayLoadBalancerWithContext(ctx context.Context, request *DeleteGatewayLoadBalancerRequest) (response *DeleteGatewayLoadBalancerResponse, err error) { + if request == nil { + request = NewDeleteGatewayLoadBalancerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteGatewayLoadBalancer require credential") + } + + request.SetContext(ctx) + + response = NewDeleteGatewayLoadBalancerResponse() + err = c.Send(request, response) + return +} + +func NewDeleteTargetGroupsRequest() (request *DeleteTargetGroupsRequest) { + request = &DeleteTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DeleteTargetGroups") + + + return +} + +func NewDeleteTargetGroupsResponse() (response *DeleteTargetGroupsResponse) { + response = &DeleteTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeleteTargetGroups +// This API is used to delete a target group. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeleteTargetGroups(request *DeleteTargetGroupsRequest) (response *DeleteTargetGroupsResponse, err error) { + return c.DeleteTargetGroupsWithContext(context.Background(), request) +} + +// DeleteTargetGroups +// This API is used to delete a target group. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeleteTargetGroupsWithContext(ctx context.Context, request *DeleteTargetGroupsRequest) (response *DeleteTargetGroupsResponse, err error) { + if request == nil { + request = NewDeleteTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewDeleteTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewDeregisterTargetGroupInstancesRequest() (request *DeregisterTargetGroupInstancesRequest) { + request = &DeregisterTargetGroupInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DeregisterTargetGroupInstances") + + + return +} + +func NewDeregisterTargetGroupInstancesResponse() (response *DeregisterTargetGroupInstancesResponse) { + response = &DeregisterTargetGroupInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeregisterTargetGroupInstances +// This API is used to unbind a server from a target group. +// +// This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeregisterTargetGroupInstances(request *DeregisterTargetGroupInstancesRequest) (response *DeregisterTargetGroupInstancesResponse, err error) { + return c.DeregisterTargetGroupInstancesWithContext(context.Background(), request) +} + +// DeregisterTargetGroupInstances +// This API is used to unbind a server from a target group. +// +// This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeregisterTargetGroupInstancesWithContext(ctx context.Context, request *DeregisterTargetGroupInstancesRequest) (response *DeregisterTargetGroupInstancesResponse, err error) { + if request == nil { + request = NewDeregisterTargetGroupInstancesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeregisterTargetGroupInstances require credential") + } + + request.SetContext(ctx) + + response = NewDeregisterTargetGroupInstancesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeGatewayLoadBalancersRequest() (request *DescribeGatewayLoadBalancersRequest) { + request = &DescribeGatewayLoadBalancersRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeGatewayLoadBalancers") + + + return +} + +func NewDescribeGatewayLoadBalancersResponse() (response *DescribeGatewayLoadBalancersResponse) { + response = &DescribeGatewayLoadBalancersResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeGatewayLoadBalancers +// This API is used to query the list of GWLB instances in a region. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeGatewayLoadBalancers(request *DescribeGatewayLoadBalancersRequest) (response *DescribeGatewayLoadBalancersResponse, err error) { + return c.DescribeGatewayLoadBalancersWithContext(context.Background(), request) +} + +// DescribeGatewayLoadBalancers +// This API is used to query the list of GWLB instances in a region. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeGatewayLoadBalancersWithContext(ctx context.Context, request *DescribeGatewayLoadBalancersRequest) (response *DescribeGatewayLoadBalancersResponse, err error) { + if request == nil { + request = NewDescribeGatewayLoadBalancersRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeGatewayLoadBalancers require credential") + } + + request.SetContext(ctx) + + response = NewDescribeGatewayLoadBalancersResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupInstanceStatusRequest() (request *DescribeTargetGroupInstanceStatusRequest) { + request = &DescribeTargetGroupInstanceStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroupInstanceStatus") + + + return +} + +func NewDescribeTargetGroupInstanceStatusResponse() (response *DescribeTargetGroupInstanceStatusResponse) { + response = &DescribeTargetGroupInstanceStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroupInstanceStatus +// This API is used to query the backend service status of a target group. Currently, only GWLB type target groups support querying backend service status. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeTargetGroupInstanceStatus(request *DescribeTargetGroupInstanceStatusRequest) (response *DescribeTargetGroupInstanceStatusResponse, err error) { + return c.DescribeTargetGroupInstanceStatusWithContext(context.Background(), request) +} + +// DescribeTargetGroupInstanceStatus +// This API is used to query the backend service status of a target group. Currently, only GWLB type target groups support querying backend service status. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeTargetGroupInstanceStatusWithContext(ctx context.Context, request *DescribeTargetGroupInstanceStatusRequest) (response *DescribeTargetGroupInstanceStatusResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupInstanceStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroupInstanceStatus require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupInstanceStatusResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupInstancesRequest() (request *DescribeTargetGroupInstancesRequest) { + request = &DescribeTargetGroupInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroupInstances") + + + return +} + +func NewDescribeTargetGroupInstancesResponse() (response *DescribeTargetGroupInstancesResponse) { + response = &DescribeTargetGroupInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroupInstances +// This API is used to obtain information on servers bound to a target group. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupInstances(request *DescribeTargetGroupInstancesRequest) (response *DescribeTargetGroupInstancesResponse, err error) { + return c.DescribeTargetGroupInstancesWithContext(context.Background(), request) +} + +// DescribeTargetGroupInstances +// This API is used to obtain information on servers bound to a target group. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupInstancesWithContext(ctx context.Context, request *DescribeTargetGroupInstancesRequest) (response *DescribeTargetGroupInstancesResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupInstancesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroupInstances require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupInstancesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupListRequest() (request *DescribeTargetGroupListRequest) { + request = &DescribeTargetGroupListRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroupList") + + + return +} + +func NewDescribeTargetGroupListResponse() (response *DescribeTargetGroupListResponse) { + response = &DescribeTargetGroupListResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroupList +// This API is used to obtain a target group list. +// +// error code that may be returned: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupList(request *DescribeTargetGroupListRequest) (response *DescribeTargetGroupListResponse, err error) { + return c.DescribeTargetGroupListWithContext(context.Background(), request) +} + +// DescribeTargetGroupList +// This API is used to obtain a target group list. +// +// error code that may be returned: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupListWithContext(ctx context.Context, request *DescribeTargetGroupListRequest) (response *DescribeTargetGroupListResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupListRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroupList require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupListResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupsRequest() (request *DescribeTargetGroupsRequest) { + request = &DescribeTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroups") + + + return +} + +func NewDescribeTargetGroupsResponse() (response *DescribeTargetGroupsResponse) { + response = &DescribeTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroups +// This API is used to query target group information. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroups(request *DescribeTargetGroupsRequest) (response *DescribeTargetGroupsResponse, err error) { + return c.DescribeTargetGroupsWithContext(context.Background(), request) +} + +// DescribeTargetGroups +// This API is used to query target group information. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupsWithContext(ctx context.Context, request *DescribeTargetGroupsRequest) (response *DescribeTargetGroupsResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTaskStatusRequest() (request *DescribeTaskStatusRequest) { + request = &DescribeTaskStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTaskStatus") + + + return +} + +func NewDescribeTaskStatusResponse() (response *DescribeTaskStatusResponse) { + response = &DescribeTaskStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTaskStatus +// This API is used to query the execution status of an async task. After non-query APIs (for example, used to create/delete CLB instances) are called successfully, this API needs to be used to query whether the task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_REGIONNOTFOUND = "InvalidParameter.RegionNotFound" +func (c *Client) DescribeTaskStatus(request *DescribeTaskStatusRequest) (response *DescribeTaskStatusResponse, err error) { + return c.DescribeTaskStatusWithContext(context.Background(), request) +} + +// DescribeTaskStatus +// This API is used to query the execution status of an async task. After non-query APIs (for example, used to create/delete CLB instances) are called successfully, this API needs to be used to query whether the task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_REGIONNOTFOUND = "InvalidParameter.RegionNotFound" +func (c *Client) DescribeTaskStatusWithContext(ctx context.Context, request *DescribeTaskStatusRequest) (response *DescribeTaskStatusResponse, err error) { + if request == nil { + request = NewDescribeTaskStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTaskStatus require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTaskStatusResponse() + err = c.Send(request, response) + return +} + +func NewDisassociateTargetGroupsRequest() (request *DisassociateTargetGroupsRequest) { + request = &DisassociateTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DisassociateTargetGroups") + + + return +} + +func NewDisassociateTargetGroupsResponse() (response *DisassociateTargetGroupsResponse) { + response = &DisassociateTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DisassociateTargetGroups +// This API is used to disassociate a CLB from a target group.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DisassociateTargetGroups(request *DisassociateTargetGroupsRequest) (response *DisassociateTargetGroupsResponse, err error) { + return c.DisassociateTargetGroupsWithContext(context.Background(), request) +} + +// DisassociateTargetGroups +// This API is used to disassociate a CLB from a target group.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DisassociateTargetGroupsWithContext(ctx context.Context, request *DisassociateTargetGroupsRequest) (response *DisassociateTargetGroupsResponse, err error) { + if request == nil { + request = NewDisassociateTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DisassociateTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewDisassociateTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewInquirePriceCreateGatewayLoadBalancerRequest() (request *InquirePriceCreateGatewayLoadBalancerRequest) { + request = &InquirePriceCreateGatewayLoadBalancerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "InquirePriceCreateGatewayLoadBalancer") + + + return +} + +func NewInquirePriceCreateGatewayLoadBalancerResponse() (response *InquirePriceCreateGatewayLoadBalancerResponse) { + response = &InquirePriceCreateGatewayLoadBalancerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// InquirePriceCreateGatewayLoadBalancer +// This API is used to query the price for creating a GWLB. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) InquirePriceCreateGatewayLoadBalancer(request *InquirePriceCreateGatewayLoadBalancerRequest) (response *InquirePriceCreateGatewayLoadBalancerResponse, err error) { + return c.InquirePriceCreateGatewayLoadBalancerWithContext(context.Background(), request) +} + +// InquirePriceCreateGatewayLoadBalancer +// This API is used to query the price for creating a GWLB. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) InquirePriceCreateGatewayLoadBalancerWithContext(ctx context.Context, request *InquirePriceCreateGatewayLoadBalancerRequest) (response *InquirePriceCreateGatewayLoadBalancerResponse, err error) { + if request == nil { + request = NewInquirePriceCreateGatewayLoadBalancerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("InquirePriceCreateGatewayLoadBalancer require credential") + } + + request.SetContext(ctx) + + response = NewInquirePriceCreateGatewayLoadBalancerResponse() + err = c.Send(request, response) + return +} + +func NewModifyGatewayLoadBalancerAttributeRequest() (request *ModifyGatewayLoadBalancerAttributeRequest) { + request = &ModifyGatewayLoadBalancerAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "ModifyGatewayLoadBalancerAttribute") + + + return +} + +func NewModifyGatewayLoadBalancerAttributeResponse() (response *ModifyGatewayLoadBalancerAttributeResponse) { + response = &ModifyGatewayLoadBalancerAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyGatewayLoadBalancerAttribute +// This API is used to modify the attributes of a CLB instance. It supports modifying the name and bandwidth cap of the CLB instance. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_DUPLICATE = "InvalidParameterValue.Duplicate" +func (c *Client) ModifyGatewayLoadBalancerAttribute(request *ModifyGatewayLoadBalancerAttributeRequest) (response *ModifyGatewayLoadBalancerAttributeResponse, err error) { + return c.ModifyGatewayLoadBalancerAttributeWithContext(context.Background(), request) +} + +// ModifyGatewayLoadBalancerAttribute +// This API is used to modify the attributes of a CLB instance. It supports modifying the name and bandwidth cap of the CLB instance. +// +// error code that may be returned: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_DUPLICATE = "InvalidParameterValue.Duplicate" +func (c *Client) ModifyGatewayLoadBalancerAttributeWithContext(ctx context.Context, request *ModifyGatewayLoadBalancerAttributeRequest) (response *ModifyGatewayLoadBalancerAttributeResponse, err error) { + if request == nil { + request = NewModifyGatewayLoadBalancerAttributeRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyGatewayLoadBalancerAttribute require credential") + } + + request.SetContext(ctx) + + response = NewModifyGatewayLoadBalancerAttributeResponse() + err = c.Send(request, response) + return +} + +func NewModifyTargetGroupAttributeRequest() (request *ModifyTargetGroupAttributeRequest) { + request = &ModifyTargetGroupAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "ModifyTargetGroupAttribute") + + + return +} + +func NewModifyTargetGroupAttributeResponse() (response *ModifyTargetGroupAttributeResponse) { + response = &ModifyTargetGroupAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyTargetGroupAttribute +// This API is used to modify the name, health check, and other attributes of the target group. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupAttribute(request *ModifyTargetGroupAttributeRequest) (response *ModifyTargetGroupAttributeResponse, err error) { + return c.ModifyTargetGroupAttributeWithContext(context.Background(), request) +} + +// ModifyTargetGroupAttribute +// This API is used to modify the name, health check, and other attributes of the target group. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupAttributeWithContext(ctx context.Context, request *ModifyTargetGroupAttributeRequest) (response *ModifyTargetGroupAttributeResponse, err error) { + if request == nil { + request = NewModifyTargetGroupAttributeRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyTargetGroupAttribute require credential") + } + + request.SetContext(ctx) + + response = NewModifyTargetGroupAttributeResponse() + err = c.Send(request, response) + return +} + +func NewModifyTargetGroupInstancesWeightRequest() (request *ModifyTargetGroupInstancesWeightRequest) { + request = &ModifyTargetGroupInstancesWeightRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "ModifyTargetGroupInstancesWeight") + + + return +} + +func NewModifyTargetGroupInstancesWeightResponse() (response *ModifyTargetGroupInstancesWeightResponse) { + response = &ModifyTargetGroupInstancesWeightResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyTargetGroupInstancesWeight +// This API is used to modify the server weight of a target group.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupInstancesWeight(request *ModifyTargetGroupInstancesWeightRequest) (response *ModifyTargetGroupInstancesWeightResponse, err error) { + return c.ModifyTargetGroupInstancesWeightWithContext(context.Background(), request) +} + +// ModifyTargetGroupInstancesWeight +// This API is used to modify the server weight of a target group.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupInstancesWeightWithContext(ctx context.Context, request *ModifyTargetGroupInstancesWeightRequest) (response *ModifyTargetGroupInstancesWeightResponse, err error) { + if request == nil { + request = NewModifyTargetGroupInstancesWeightRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyTargetGroupInstancesWeight require credential") + } + + request.SetContext(ctx) + + response = NewModifyTargetGroupInstancesWeightResponse() + err = c.Send(request, response) + return +} + +func NewRegisterTargetGroupInstancesRequest() (request *RegisterTargetGroupInstancesRequest) { + request = &RegisterTargetGroupInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "RegisterTargetGroupInstances") + + + return +} + +func NewRegisterTargetGroupInstancesResponse() (response *RegisterTargetGroupInstancesResponse) { + response = &RegisterTargetGroupInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// RegisterTargetGroupInstances +// This API is used to register servers to a target group.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) RegisterTargetGroupInstances(request *RegisterTargetGroupInstancesRequest) (response *RegisterTargetGroupInstancesResponse, err error) { + return c.RegisterTargetGroupInstancesWithContext(context.Background(), request) +} + +// RegisterTargetGroupInstances +// This API is used to register servers to a target group.This is an async API. After the API return succeeds, you can call the DescribeTaskStatus API with the returned RequestID as an input parameter to check whether this task is successful. +// +// error code that may be returned: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) RegisterTargetGroupInstancesWithContext(ctx context.Context, request *RegisterTargetGroupInstancesRequest) (response *RegisterTargetGroupInstancesResponse, err error) { + if request == nil { + request = NewRegisterTargetGroupInstancesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("RegisterTargetGroupInstances require credential") + } + + request.SetContext(ctx) + + response = NewRegisterTargetGroupInstancesResponse() + err = c.Send(request, response) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/errors.go new file mode 100644 index 0000000000..cb00b84e5a --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/errors.go @@ -0,0 +1,52 @@ +// 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 v20240906 + +const ( + // error codes for specific actions + + // Operation failed. + FAILEDOPERATION = "FailedOperation" + + // FailedOperation.ResourceInOperating + FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" + + // Internal error. + INTERNALERROR = "InternalError" + + // Parameter error. + INVALIDPARAMETER = "InvalidParameter" + + // InvalidParameter.FormatError + INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" + + // InvalidParameter.RegionNotFound + INVALIDPARAMETER_REGIONNOTFOUND = "InvalidParameter.RegionNotFound" + + // Invalid parameter value. + INVALIDPARAMETERVALUE = "InvalidParameterValue" + + // The same value exists. + INVALIDPARAMETERVALUE_DUPLICATE = "InvalidParameterValue.Duplicate" + + // InvalidParameterValue.Length + INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" + + // The quota limit is exceeded. + LIMITEXCEEDED = "LimitExceeded" + + // Unauthorized operation. + UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +) diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/models.go new file mode 100644 index 0000000000..7272207abd --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906/models.go @@ -0,0 +1,1528 @@ +// 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 v20240906 + +import ( + tcerr "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/errors" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/json" +) + +// Predefined struct for user +type AssociateTargetGroupsRequestParams struct { + // Binding relationship array. A single request supports up to 20 items. + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +type AssociateTargetGroupsRequest struct { + *tchttp.BaseRequest + + // Binding relationship array. A single request supports up to 20 items. + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +func (r *AssociateTargetGroupsRequest) 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 *AssociateTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Associations") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "AssociateTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type AssociateTargetGroupsResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type AssociateTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *AssociateTargetGroupsResponseParams `json:"Response"` +} + +func (r *AssociateTargetGroupsResponse) 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 *AssociateTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssociationItem struct { + // Associated GWLB instance ID + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // GWLB instance name + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` +} + +// Predefined struct for user +type CreateGatewayLoadBalancerRequestParams struct { + // ID of the VPC to which the backend target device of the GWLB belongs, such as vpc-12345678. It can be obtained through the DescribeVpcEx interface. If left blank, it defaults to DefaultVPC. This parameter is required when a private network CLB instance is created. + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // Subnet ID of the VPC to which the backend target device of the GWLB belongs. + SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"` + + // GWLB instance name. It supports input of 1 to 60 characters. If not filled in, it will be generated automatically by default. + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // Number of GWLBs to create, with a default of 1. The maximum batch creation quantity is 10. + Number *uint64 `json:"Number,omitnil,omitempty" name:"Number"` + + // While the GWLB is purchased, it is tagged, with a maximum of 20 tag key-value pairs. + Tags []*TagInfo `json:"Tags,omitnil,omitempty" name:"Tags"` + + // GWLB instance billing type, which currently supports POSTPAID_BY_HOUR only. The default is POSTPAID_BY_HOUR. + LBChargeType *string `json:"LBChargeType,omitnil,omitempty" name:"LBChargeType"` +} + +type CreateGatewayLoadBalancerRequest struct { + *tchttp.BaseRequest + + // ID of the VPC to which the backend target device of the GWLB belongs, such as vpc-12345678. It can be obtained through the DescribeVpcEx interface. If left blank, it defaults to DefaultVPC. This parameter is required when a private network CLB instance is created. + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // Subnet ID of the VPC to which the backend target device of the GWLB belongs. + SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"` + + // GWLB instance name. It supports input of 1 to 60 characters. If not filled in, it will be generated automatically by default. + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // Number of GWLBs to create, with a default of 1. The maximum batch creation quantity is 10. + Number *uint64 `json:"Number,omitnil,omitempty" name:"Number"` + + // While the GWLB is purchased, it is tagged, with a maximum of 20 tag key-value pairs. + Tags []*TagInfo `json:"Tags,omitnil,omitempty" name:"Tags"` + + // GWLB instance billing type, which currently supports POSTPAID_BY_HOUR only. The default is POSTPAID_BY_HOUR. + LBChargeType *string `json:"LBChargeType,omitnil,omitempty" name:"LBChargeType"` +} + +func (r *CreateGatewayLoadBalancerRequest) 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 *CreateGatewayLoadBalancerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "VpcId") + delete(f, "SubnetId") + delete(f, "LoadBalancerName") + delete(f, "Number") + delete(f, "Tags") + delete(f, "LBChargeType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateGatewayLoadBalancerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateGatewayLoadBalancerResponseParams struct { + // Array of unique GWLB instance IDs.In certain scenarios, for example, when there is a delay in creation, this field may return null; at this time, you can query the created resource ID through the DescribeTaskStatus API using the RequestId or DealName parameter returned by the API.Note: this field may return `null`, indicating that no valid values can be obtained. + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // Order number. + // + // Note: this field may return `null`, indicating that no valid values can be obtained. + DealName *string `json:"DealName,omitnil,omitempty" name:"DealName"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type CreateGatewayLoadBalancerResponse struct { + *tchttp.BaseResponse + Response *CreateGatewayLoadBalancerResponseParams `json:"Response"` +} + +func (r *CreateGatewayLoadBalancerResponse) 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 *CreateGatewayLoadBalancerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateTargetGroupRequestParams struct { + // Target group name, limited to 60 characters. + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // VPCID attribute of target group. If this parameter is left blank, the default VPC will be used. + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // Default port of the target group, which can be used when servers are added later. Either 'Port' or 'TargetGroupInstances.N.port' must be filled in. + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // Real server bound to a target group + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` + + // GWLB target group protocol. + // - TENCENT_GENEVE: GENEVE standard protocol + // + // - AWS_GENEVE: GENEVE compatibility protocol (a ticket is required for allowlisting) + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // Health check settings. + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // Load balancing algorithm. + // - IP_HASH_3_ELASTIC: elastic hashing + ScheduleAlgorithm *string `json:"ScheduleAlgorithm,omitnil,omitempty" name:"ScheduleAlgorithm"` + + // Whether "All Dead, All Alive" is supported. It is supported by default. + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +type CreateTargetGroupRequest struct { + *tchttp.BaseRequest + + // Target group name, limited to 60 characters. + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // VPCID attribute of target group. If this parameter is left blank, the default VPC will be used. + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // Default port of the target group, which can be used when servers are added later. Either 'Port' or 'TargetGroupInstances.N.port' must be filled in. + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // Real server bound to a target group + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` + + // GWLB target group protocol. + // - TENCENT_GENEVE: GENEVE standard protocol + // + // - AWS_GENEVE: GENEVE compatibility protocol (a ticket is required for allowlisting) + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // Health check settings. + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // Load balancing algorithm. + // - IP_HASH_3_ELASTIC: elastic hashing + ScheduleAlgorithm *string `json:"ScheduleAlgorithm,omitnil,omitempty" name:"ScheduleAlgorithm"` + + // Whether "All Dead, All Alive" is supported. It is supported by default. + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +func (r *CreateTargetGroupRequest) 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 *CreateTargetGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupName") + delete(f, "VpcId") + delete(f, "Port") + delete(f, "TargetGroupInstances") + delete(f, "Protocol") + delete(f, "HealthCheck") + delete(f, "ScheduleAlgorithm") + delete(f, "AllDeadToAlive") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateTargetGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateTargetGroupResponseParams struct { + // ID generated after target group creation + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type CreateTargetGroupResponse struct { + *tchttp.BaseResponse + Response *CreateTargetGroupResponseParams `json:"Response"` +} + +func (r *CreateTargetGroupResponse) 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 *CreateTargetGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteGatewayLoadBalancerRequestParams struct { + // Array of GWLB instance IDs to be deleted, with the array size up to 20. + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` +} + +type DeleteGatewayLoadBalancerRequest struct { + *tchttp.BaseRequest + + // Array of GWLB instance IDs to be deleted, with the array size up to 20. + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` +} + +func (r *DeleteGatewayLoadBalancerRequest) 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 *DeleteGatewayLoadBalancerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "LoadBalancerIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteGatewayLoadBalancerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteGatewayLoadBalancerResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeleteGatewayLoadBalancerResponse struct { + *tchttp.BaseResponse + Response *DeleteGatewayLoadBalancerResponseParams `json:"Response"` +} + +func (r *DeleteGatewayLoadBalancerResponse) 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 *DeleteGatewayLoadBalancerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteTargetGroupsRequestParams struct { + // Target group ID list. + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` +} + +type DeleteTargetGroupsRequest struct { + *tchttp.BaseRequest + + // Target group ID list. + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` +} + +func (r *DeleteTargetGroupsRequest) 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 *DeleteTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteTargetGroupsResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeleteTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *DeleteTargetGroupsResponseParams `json:"Response"` +} + +func (r *DeleteTargetGroupsResponse) 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 *DeleteTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeregisterTargetGroupInstancesRequestParams struct { + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Information on server to be unbound. + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +type DeregisterTargetGroupInstancesRequest struct { + *tchttp.BaseRequest + + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Information on server to be unbound. + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +func (r *DeregisterTargetGroupInstancesRequest) 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 *DeregisterTargetGroupInstancesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstances") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeregisterTargetGroupInstancesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeregisterTargetGroupInstancesResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeregisterTargetGroupInstancesResponse struct { + *tchttp.BaseResponse + Response *DeregisterTargetGroupInstancesResponseParams `json:"Response"` +} + +func (r *DeregisterTargetGroupInstancesResponse) 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 *DeregisterTargetGroupInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeGatewayLoadBalancersRequestParams struct { + // GWLB instance ID. Batch filtering is supported with a maximum of 20 instance IDs. + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // Number of GWLB instances returned in a batch, with a default value of 20 and a maximum value of 100. + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // Starting offset for returning the list of GWLB instances, with a default value of 0. + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // Filter criteria for querying the CLB details list. For each request, the maximum value of Filters is 10, and the maximum value of Filter.Values is 100.Filter.Name and Filter.Values are both required. Detailed filter criteria are as follows:- name - String - required: No - (filter criteria) filter by GWLB instance name, such as "gwlb-xxxx".- VpcId - String - required: No - (filter criteria) filter by the VPC to which the GWLB instance belongs, such as "vpc-bhqk****". + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // Search field, for fuzzy matching of name and VIP. + SearchKey *string `json:"SearchKey,omitnil,omitempty" name:"SearchKey"` +} + +type DescribeGatewayLoadBalancersRequest struct { + *tchttp.BaseRequest + + // GWLB instance ID. Batch filtering is supported with a maximum of 20 instance IDs. + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // Number of GWLB instances returned in a batch, with a default value of 20 and a maximum value of 100. + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // Starting offset for returning the list of GWLB instances, with a default value of 0. + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // Filter criteria for querying the CLB details list. For each request, the maximum value of Filters is 10, and the maximum value of Filter.Values is 100.Filter.Name and Filter.Values are both required. Detailed filter criteria are as follows:- name - String - required: No - (filter criteria) filter by GWLB instance name, such as "gwlb-xxxx".- VpcId - String - required: No - (filter criteria) filter by the VPC to which the GWLB instance belongs, such as "vpc-bhqk****". + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // Search field, for fuzzy matching of name and VIP. + SearchKey *string `json:"SearchKey,omitnil,omitempty" name:"SearchKey"` +} + +func (r *DescribeGatewayLoadBalancersRequest) 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 *DescribeGatewayLoadBalancersRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "LoadBalancerIds") + delete(f, "Limit") + delete(f, "Offset") + delete(f, "Filters") + delete(f, "SearchKey") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeGatewayLoadBalancersRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeGatewayLoadBalancersResponseParams struct { + // Total number of CLB instances that meet the filter criteria. This value is independent of the Limit in the input parameters. + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // Returned GWLB instance array. + LoadBalancerSet []*GatewayLoadBalancer `json:"LoadBalancerSet,omitnil,omitempty" name:"LoadBalancerSet"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeGatewayLoadBalancersResponse struct { + *tchttp.BaseResponse + Response *DescribeGatewayLoadBalancersResponseParams `json:"Response"` +} + +func (r *DescribeGatewayLoadBalancersResponse) 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 *DescribeGatewayLoadBalancersResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstanceStatusRequestParams struct { + // Unique target group ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // List of backend service IPs bound to the target group + TargetGroupInstanceIps []*string `json:"TargetGroupInstanceIps,omitnil,omitempty" name:"TargetGroupInstanceIps"` +} + +type DescribeTargetGroupInstanceStatusRequest struct { + *tchttp.BaseRequest + + // Unique target group ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // List of backend service IPs bound to the target group + TargetGroupInstanceIps []*string `json:"TargetGroupInstanceIps,omitnil,omitempty" name:"TargetGroupInstanceIps"` +} + +func (r *DescribeTargetGroupInstanceStatusRequest) 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 *DescribeTargetGroupInstanceStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstanceIps") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupInstanceStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstanceStatusResponseParams struct { + // Health check backend RS status list + TargetGroupInstanceSet []*TargetGroupInstanceStatus `json:"TargetGroupInstanceSet,omitnil,omitempty" name:"TargetGroupInstanceSet"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupInstanceStatusResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupInstanceStatusResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupInstanceStatusResponse) 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 *DescribeTargetGroupInstanceStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstancesRequestParams struct { + // Filter criteria. Currently, only filtering by TargetGroupId, BindIP, or InstanceId is supported. + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // Number of displayed results. Default value: 20. + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // Displayed offset. Default value: 0. + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` +} + +type DescribeTargetGroupInstancesRequest struct { + *tchttp.BaseRequest + + // Filter criteria. Currently, only filtering by TargetGroupId, BindIP, or InstanceId is supported. + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // Number of displayed results. Default value: 20. + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // Displayed offset. Default value: 0. + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` +} + +func (r *DescribeTargetGroupInstancesRequest) 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 *DescribeTargetGroupInstancesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Filters") + delete(f, "Limit") + delete(f, "Offset") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupInstancesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstancesResponseParams struct { + // Number of results returned for the current query. + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // Information on bound server. + TargetGroupInstanceSet []*TargetGroupBackend `json:"TargetGroupInstanceSet,omitnil,omitempty" name:"TargetGroupInstanceSet"` + + // Actual statistical quantity, which is not affected by Limit, Offset, or CAM. + RealCount *uint64 `json:"RealCount,omitnil,omitempty" name:"RealCount"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupInstancesResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupInstancesResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupInstancesResponse) 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 *DescribeTargetGroupInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupListRequestParams struct { + // Target group ID array. + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // Filter criterion array, which supports TargetGroupVpcId and TargetGroupName. + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // Starting display offset. + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // Limit on the number of displayed entries. Default value: 20. + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` +} + +type DescribeTargetGroupListRequest struct { + *tchttp.BaseRequest + + // Target group ID array. + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // Filter criterion array, which supports TargetGroupVpcId and TargetGroupName. + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // Starting display offset. + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // Limit on the number of displayed entries. Default value: 20. + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` +} + +func (r *DescribeTargetGroupListRequest) 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 *DescribeTargetGroupListRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupIds") + delete(f, "Filters") + delete(f, "Offset") + delete(f, "Limit") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupListRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupListResponseParams struct { + // Number of displayed results. + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // Collection of displayed target group information. + TargetGroupSet []*TargetGroupInfo `json:"TargetGroupSet,omitnil,omitempty" name:"TargetGroupSet"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupListResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupListResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupListResponse) 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 *DescribeTargetGroupListResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupsRequestParams struct { + // Target group ID, which is mutually exclusive with Filters. + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // Limit on the number of displayed entries. Default value: 20. + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // Starting display offset. + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // Filter criterion array, which supports TargetGroupVpcId and TargetGroupName. + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` +} + +type DescribeTargetGroupsRequest struct { + *tchttp.BaseRequest + + // Target group ID, which is mutually exclusive with Filters. + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // Limit on the number of displayed entries. Default value: 20. + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // Starting display offset. + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // Filter criterion array, which supports TargetGroupVpcId and TargetGroupName. + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` +} + +func (r *DescribeTargetGroupsRequest) 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 *DescribeTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupIds") + delete(f, "Limit") + delete(f, "Offset") + delete(f, "Filters") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupsResponseParams struct { + // Number of displayed results. + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // Collection of displayed target group information. + TargetGroupSet []*TargetGroupInfo `json:"TargetGroupSet,omitnil,omitempty" name:"TargetGroupSet"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupsResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupsResponse) 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 *DescribeTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTaskStatusRequestParams struct { + // Request ID, which is the RequestId parameter returned by the API. + TaskId *string `json:"TaskId,omitnil,omitempty" name:"TaskId"` +} + +type DescribeTaskStatusRequest struct { + *tchttp.BaseRequest + + // Request ID, which is the RequestId parameter returned by the API. + TaskId *string `json:"TaskId,omitnil,omitempty" name:"TaskId"` +} + +func (r *DescribeTaskStatusRequest) 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 *DescribeTaskStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TaskId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTaskStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTaskStatusResponseParams struct { + // Current status of task. Valid values: 0 (succeeded), 1 (failed), 2 (in progress). + Status *int64 `json:"Status,omitnil,omitempty" name:"Status"` + + // Array of unique CLB instance IDs. + // + // Note: This field may return null, indicating that no valid value can be obtained. + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // Auxiliary description information, such as failure causes. + // Note: This field may return null, indicating that no valid value can be obtained. + Message *string `json:"Message,omitnil,omitempty" name:"Message"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTaskStatusResponse struct { + *tchttp.BaseResponse + Response *DescribeTaskStatusResponseParams `json:"Response"` +} + +func (r *DescribeTaskStatusResponse) 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 *DescribeTaskStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DisassociateTargetGroupsRequestParams struct { + // List of target groups to unbind. + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +type DisassociateTargetGroupsRequest struct { + *tchttp.BaseRequest + + // List of target groups to unbind. + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +func (r *DisassociateTargetGroupsRequest) 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 *DisassociateTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Associations") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DisassociateTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DisassociateTargetGroupsResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DisassociateTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *DisassociateTargetGroupsResponseParams `json:"Response"` +} + +func (r *DisassociateTargetGroupsResponse) 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 *DisassociateTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type Filter struct { + // Filter name + Name *string `json:"Name,omitnil,omitempty" name:"Name"` + + // Filter value array + Values []*string `json:"Values,omitnil,omitempty" name:"Values"` +} + +type GatewayLoadBalancer struct { + // GWLB instance ID. + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // Name of the GWLB instance. + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // VPC to which the GWLB belongs.Note: this field may return `null`, indicating that no valid values can be obtained. + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // Subnet to which the GWLB belongs. + SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"` + + // Virtual IP of GWLB for providing service. + Vips []*string `json:"Vips,omitnil,omitempty" name:"Vips"` + + // GWLB instance status.0: creating, 1: normal operation, 3: deleting. + Status *uint64 `json:"Status,omitnil,omitempty" name:"Status"` + + // Unique ID of associated target group.Note: this field may return `null`, indicating that no valid values can be obtained. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Whether to enable the deletion protection feature.Note: this field may return `null`, indicating that no valid values can be obtained. + DeleteProtect *bool `json:"DeleteProtect,omitnil,omitempty" name:"DeleteProtect"` + + // Tag information on the CLB instance.Note: this field may return `null`, indicating that no valid values can be obtained. + Tags []*TagInfo `json:"Tags,omitnil,omitempty" name:"Tags"` + + // Creation time. + CreateTime *string `json:"CreateTime,omitnil,omitempty" name:"CreateTime"` + + // Billing type of the GWLB instance. POSTPAID_BY_HOUR: pay-as-you-goNote: this field may return `null`, indicating that no valid values can be obtained. + ChargeType *string `json:"ChargeType,omitnil,omitempty" name:"ChargeType"` + + // 0: Not isolated; 1: Isolated. + // + // Note: this field may return `null`, indicating that no valid values can be obtained. + Isolation *uint64 `json:"Isolation,omitnil,omitempty" name:"Isolation"` + + // CLB instance isolation time + // + // Note: this field may return `null`, indicating that no valid values can be obtained. + IsolatedTime *string `json:"IsolatedTime,omitnil,omitempty" name:"IsolatedTime"` +} + +// Predefined struct for user +type InquirePriceCreateGatewayLoadBalancerRequestParams struct { + // Number of GWLB instances for inquiry, with a default of 1 + GoodsNum *uint64 `json:"GoodsNum,omitnil,omitempty" name:"GoodsNum"` +} + +type InquirePriceCreateGatewayLoadBalancerRequest struct { + *tchttp.BaseRequest + + // Number of GWLB instances for inquiry, with a default of 1 + GoodsNum *uint64 `json:"GoodsNum,omitnil,omitempty" name:"GoodsNum"` +} + +func (r *InquirePriceCreateGatewayLoadBalancerRequest) 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 *InquirePriceCreateGatewayLoadBalancerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "GoodsNum") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "InquirePriceCreateGatewayLoadBalancerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type InquirePriceCreateGatewayLoadBalancerResponseParams struct { + // This parameter represents the corresponding price. + Price *Price `json:"Price,omitnil,omitempty" name:"Price"` + + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type InquirePriceCreateGatewayLoadBalancerResponse struct { + *tchttp.BaseResponse + Response *InquirePriceCreateGatewayLoadBalancerResponseParams `json:"Response"` +} + +func (r *InquirePriceCreateGatewayLoadBalancerResponse) 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 *InquirePriceCreateGatewayLoadBalancerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ItemPrice struct { + // Postpaid unit price. Unit: CNY. + // + // Note: This field may return null, indicating that no valid value can be obtained. + UnitPrice *float64 `json:"UnitPrice,omitnil,omitempty" name:"UnitPrice"` + + // Pay-as-you-go billing unit. Valid values: HOUR: indicates that the billing unit is calculated by hour. Current scenarios involving this billing unit include: postpaid by hour for instances (POSTPAID_BY_HOUR).Note: This field may return null, indicating that no valid value can be obtained. + ChargeUnit *string `json:"ChargeUnit,omitnil,omitempty" name:"ChargeUnit"` + + // Original price of pre-payment (in CNY). + // + // Note: This field may return null, indicating that no valid value can be obtained. + OriginalPrice *float64 `json:"OriginalPrice,omitnil,omitempty" name:"OriginalPrice"` + + // Discount price of prepaid costs, unit: CNY. + // + // Note: This field may return null, indicating that no valid value can be obtained. + DiscountPrice *float64 `json:"DiscountPrice,omitnil,omitempty" name:"DiscountPrice"` + + // Discounted unit price for pay-as-you-go. Unit: CNY.Note: This field may return null, indicating that no valid value can be obtained. + UnitPriceDiscount *float64 `json:"UnitPriceDiscount,omitnil,omitempty" name:"UnitPriceDiscount"` + + // Discount, such as 20.0 representing 80% off. + // + // Note: This field may return null, indicating that no valid value can be obtained. + Discount *float64 `json:"Discount,omitnil,omitempty" name:"Discount"` +} + +// Predefined struct for user +type ModifyGatewayLoadBalancerAttributeRequestParams struct { + // Unique GWLB ID. + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // GWLB instance name. It supports input of 1 to 60 characters. + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` +} + +type ModifyGatewayLoadBalancerAttributeRequest struct { + *tchttp.BaseRequest + + // Unique GWLB ID. + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // GWLB instance name. It supports input of 1 to 60 characters. + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` +} + +func (r *ModifyGatewayLoadBalancerAttributeRequest) 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 *ModifyGatewayLoadBalancerAttributeRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "LoadBalancerId") + delete(f, "LoadBalancerName") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyGatewayLoadBalancerAttributeRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyGatewayLoadBalancerAttributeResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyGatewayLoadBalancerAttributeResponse struct { + *tchttp.BaseResponse + Response *ModifyGatewayLoadBalancerAttributeResponseParams `json:"Response"` +} + +func (r *ModifyGatewayLoadBalancerAttributeResponse) 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 *ModifyGatewayLoadBalancerAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupAttributeRequestParams struct { + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // New name of target group. + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // Health check details. + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // Whether "All Dead, All Alive" is supported. + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +type ModifyTargetGroupAttributeRequest struct { + *tchttp.BaseRequest + + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // New name of target group. + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // Health check details. + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // Whether "All Dead, All Alive" is supported. + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +func (r *ModifyTargetGroupAttributeRequest) 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 *ModifyTargetGroupAttributeRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupName") + delete(f, "HealthCheck") + delete(f, "AllDeadToAlive") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyTargetGroupAttributeRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupAttributeResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyTargetGroupAttributeResponse struct { + *tchttp.BaseResponse + Response *ModifyTargetGroupAttributeResponseParams `json:"Response"` +} + +func (r *ModifyTargetGroupAttributeResponse) 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 *ModifyTargetGroupAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupInstancesWeightRequestParams struct { + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Instance binding configuration array. + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +type ModifyTargetGroupInstancesWeightRequest struct { + *tchttp.BaseRequest + + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Instance binding configuration array. + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +func (r *ModifyTargetGroupInstancesWeightRequest) 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 *ModifyTargetGroupInstancesWeightRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstances") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyTargetGroupInstancesWeightRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupInstancesWeightResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyTargetGroupInstancesWeightResponse struct { + *tchttp.BaseResponse + Response *ModifyTargetGroupInstancesWeightResponseParams `json:"Response"` +} + +func (r *ModifyTargetGroupInstancesWeightResponse) 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 *ModifyTargetGroupInstancesWeightResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type Price struct { + // It describes the instance price.Note: This field may return null, indicating that no valid value can be obtained. + InstancePrice *ItemPrice `json:"InstancePrice,omitnil,omitempty" name:"InstancePrice"` + + // It describes the price of GLCU. + // Note: This field may return null, indicating that no valid value can be obtained. + LcuPrice *ItemPrice `json:"LcuPrice,omitnil,omitempty" name:"LcuPrice"` +} + +// Predefined struct for user +type RegisterTargetGroupInstancesRequestParams struct { + // Target group ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Server instance array + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +type RegisterTargetGroupInstancesRequest struct { + *tchttp.BaseRequest + + // Target group ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Server instance array + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +func (r *RegisterTargetGroupInstancesRequest) 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 *RegisterTargetGroupInstancesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstances") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "RegisterTargetGroupInstancesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type RegisterTargetGroupInstancesResponseParams struct { + // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type RegisterTargetGroupInstancesResponse struct { + *tchttp.BaseResponse + Response *RegisterTargetGroupInstancesResponseParams `json:"Response"` +} + +func (r *RegisterTargetGroupInstancesResponse) 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 *RegisterTargetGroupInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type TagInfo struct { + // Tag key + TagKey *string `json:"TagKey,omitnil,omitempty" name:"TagKey"` + + // Tag value + TagValue *string `json:"TagValue,omitnil,omitempty" name:"TagValue"` +} + +type TargetGroupAssociation struct { + // GWLB instance ID. + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // Target group ID. + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` +} + +type TargetGroupBackend struct { + // Target group ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // Backend service type. Valid values: CVM, ENI (to be supported soon) + Type *string `json:"Type,omitnil,omitempty" name:"Type"` + + // Unique backend service ID + InstanceId *string `json:"InstanceId,omitnil,omitempty" name:"InstanceId"` + + // Listening port of backend service + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // Forwarding weight of backend service. Value range: [0, 100]. Default value: 10. + Weight *uint64 `json:"Weight,omitnil,omitempty" name:"Weight"` + + // Public network IP of the real server + // + // Note: This field may return null, indicating that no valid value can be obtained. + PublicIpAddresses []*string `json:"PublicIpAddresses,omitnil,omitempty" name:"PublicIpAddresses"` + + // Private network IP of backend serviceNote: This field may return null, indicating that no valid value can be obtained. + PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitnil,omitempty" name:"PrivateIpAddresses"` + + // Instance name of the real server + // + // Note: This field may return null, indicating that no valid value can be obtained. + InstanceName *string `json:"InstanceName,omitnil,omitempty" name:"InstanceName"` + + // Real server binding time + // + // Note: This field may return null, indicating that no valid value can be obtained. + RegisteredTime *string `json:"RegisteredTime,omitnil,omitempty" name:"RegisteredTime"` + + // Unique ID of the ENI + // + // Note: This field may return null, indicating that no valid value can be obtained. + EniId *string `json:"EniId,omitnil,omitempty" name:"EniId"` + + // Available zone ID of backend serviceNote: This field may return null, indicating that no valid value can be obtained. + ZoneId *uint64 `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` +} + +type TargetGroupHealthCheck struct { + // Whether to enable the health check. + HealthSwitch *bool `json:"HealthSwitch,omitnil,omitempty" name:"HealthSwitch"` + + // Protocol used for health check, which supports PING and TCP and is PING by default. + // + // - PING: icmp + // - TCP: tcp + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // Health check port, which is required when the probe protocol is TCP. + Port *int64 `json:"Port,omitnil,omitempty" name:"Port"` + + // Health check timeout. The default is 2 seconds. Value range: 2-30 seconds. + Timeout *int64 `json:"Timeout,omitnil,omitempty" name:"Timeout"` + + // Detection interval time. The default is 5 seconds. Value range: 2-300 seconds. + IntervalTime *int64 `json:"IntervalTime,omitnil,omitempty" name:"IntervalTime"` + + // Health detection threshold. The default is 3 times. Value range: 2-10 times. + HealthNum *int64 `json:"HealthNum,omitnil,omitempty" name:"HealthNum"` + + // Unhealth detection threshold. The default is 3 times. Value range: 2-10 times. + UnHealthNum *int64 `json:"UnHealthNum,omitnil,omitempty" name:"UnHealthNum"` +} + +type TargetGroupInfo struct { + // Target group ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // VPCID of target group + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // Target group name + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // Default port of a target group + // + // Note: This field may return null, indicating that no valid value can be obtained. + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // Target group creation time + CreatedTime *string `json:"CreatedTime,omitnil,omitempty" name:"CreatedTime"` + + // Target group modification time + UpdatedTime *string `json:"UpdatedTime,omitnil,omitempty" name:"UpdatedTime"` + + // Associated rule array. This parameter cannot be obtained when the DescribeTargetGroupList API is called.Note: This field may return null, indicating that no valid value can be obtained. + AssociatedRule []*AssociationItem `json:"AssociatedRule,omitnil,omitempty" name:"AssociatedRule"` + + // Backend protocol type.Note: This field may return null, indicating that no valid value can be obtained. + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // Scheduling algorithm. + // ip_hash_3: elastic hashing + // Note: This field may return null, indicating that no valid value can be obtained. + ScheduleAlgorithm *string `json:"ScheduleAlgorithm,omitnil,omitempty" name:"ScheduleAlgorithm"` + + // Health check details.Note: This field may return null, indicating that no valid value can be obtained. + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // Whether "All Dead, All Alive" is supported.Note: This field may return null, indicating that no valid value can be obtained. + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` + + // Number of rules associated with the target group.Note: This field may return null, indicating that no valid value can be obtained. + AssociatedRuleCount *int64 `json:"AssociatedRuleCount,omitnil,omitempty" name:"AssociatedRuleCount"` + + // Number of instances in the target group.Note: This field may return null, indicating that no valid value can be obtained. + RegisteredInstancesCount *int64 `json:"RegisteredInstancesCount,omitnil,omitempty" name:"RegisteredInstancesCount"` +} + +type TargetGroupInstance struct { + // Private network IP of target group instance. + BindIP *string `json:"BindIP,omitnil,omitempty" name:"BindIP"` + + // Port of target group instance. Only 6081 is supported. + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // Weight of target group instance. Only 0 or 16 is supported, and non-0 is uniformly treated as 16. + Weight *uint64 `json:"Weight,omitnil,omitempty" name:"Weight"` +} + +type TargetGroupInstanceStatus struct { + // IP of backend RS + InstanceIp *string `json:"InstanceIp,omitnil,omitempty" name:"InstanceIp"` + + // Health check status, with parameter values and meanings as follows:● on: indicates being under detection.● off: indicates that the health check is disabled.● health: indicates being healthy.● unhealth: indicates being abnormal. + Status *string `json:"Status,omitnil,omitempty" name:"Status"` +} \ No newline at end of file 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 e99ffca9eb..02eb30e053 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,6 +3,7 @@ package common import ( "context" "io" + //"log" "math/rand" "net/url" @@ -265,7 +266,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.1133" + params["RequestClient"] = "SDK_GO_1.0.1134" if requestClient != "" { params["RequestClient"] += ": " + requestClient } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/LICENSE b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/LICENSE new file mode 100644 index 0000000000..efc75a2253 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/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/gwlb/v20240906/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/client.go new file mode 100644 index 0000000000..b3c93fee3b --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/client.go @@ -0,0 +1,1096 @@ +// 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 v20240906 + +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 = "2024-09-06" + +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 NewAssociateTargetGroupsRequest() (request *AssociateTargetGroupsRequest) { + request = &AssociateTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "AssociateTargetGroups") + + + return +} + +func NewAssociateTargetGroupsResponse() (response *AssociateTargetGroupsResponse) { + response = &AssociateTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// AssociateTargetGroups +// 本接口(AssociateTargetGroups)用来将目标组绑定到负载均衡。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) AssociateTargetGroups(request *AssociateTargetGroupsRequest) (response *AssociateTargetGroupsResponse, err error) { + return c.AssociateTargetGroupsWithContext(context.Background(), request) +} + +// AssociateTargetGroups +// 本接口(AssociateTargetGroups)用来将目标组绑定到负载均衡。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) AssociateTargetGroupsWithContext(ctx context.Context, request *AssociateTargetGroupsRequest) (response *AssociateTargetGroupsResponse, err error) { + if request == nil { + request = NewAssociateTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("AssociateTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewAssociateTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewCreateGatewayLoadBalancerRequest() (request *CreateGatewayLoadBalancerRequest) { + request = &CreateGatewayLoadBalancerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "CreateGatewayLoadBalancer") + + + return +} + +func NewCreateGatewayLoadBalancerResponse() (response *CreateGatewayLoadBalancerResponse) { + response = &CreateGatewayLoadBalancerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// CreateGatewayLoadBalancer +// 本接口(CreateGatewayLoadBalancer)用来创建网关负载均衡实例。为了使用网关负载均衡服务,您必须购买一个或多个网关负载均衡实例。成功调用该接口后,会返回网关负载均衡实例的唯一 ID。 +// +// 注意:单个账号在每个地域的默认购买配额为:10个。 +// +// 本接口为异步接口,接口成功返回后,可使用 DescribeGatewayLoadBalancers 接口查询负载均衡实例的状态(如创建中、正常),以确定是否创建成功。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) CreateGatewayLoadBalancer(request *CreateGatewayLoadBalancerRequest) (response *CreateGatewayLoadBalancerResponse, err error) { + return c.CreateGatewayLoadBalancerWithContext(context.Background(), request) +} + +// CreateGatewayLoadBalancer +// 本接口(CreateGatewayLoadBalancer)用来创建网关负载均衡实例。为了使用网关负载均衡服务,您必须购买一个或多个网关负载均衡实例。成功调用该接口后,会返回网关负载均衡实例的唯一 ID。 +// +// 注意:单个账号在每个地域的默认购买配额为:10个。 +// +// 本接口为异步接口,接口成功返回后,可使用 DescribeGatewayLoadBalancers 接口查询负载均衡实例的状态(如创建中、正常),以确定是否创建成功。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) CreateGatewayLoadBalancerWithContext(ctx context.Context, request *CreateGatewayLoadBalancerRequest) (response *CreateGatewayLoadBalancerResponse, err error) { + if request == nil { + request = NewCreateGatewayLoadBalancerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateGatewayLoadBalancer require credential") + } + + request.SetContext(ctx) + + response = NewCreateGatewayLoadBalancerResponse() + err = c.Send(request, response) + return +} + +func NewCreateTargetGroupRequest() (request *CreateTargetGroupRequest) { + request = &CreateTargetGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "CreateTargetGroup") + + + return +} + +func NewCreateTargetGroupResponse() (response *CreateTargetGroupResponse) { + response = &CreateTargetGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// CreateTargetGroup +// 创建目标组。该功能正在内测中,如需使用,请通过[工单申请](https://console.cloud.tencent.com/workorder/category?level1_id=6&level2_id=163&source=0&data_title=%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1%20LB&step=1)。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) CreateTargetGroup(request *CreateTargetGroupRequest) (response *CreateTargetGroupResponse, err error) { + return c.CreateTargetGroupWithContext(context.Background(), request) +} + +// CreateTargetGroup +// 创建目标组。该功能正在内测中,如需使用,请通过[工单申请](https://console.cloud.tencent.com/workorder/category?level1_id=6&level2_id=163&source=0&data_title=%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1%20LB&step=1)。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) CreateTargetGroupWithContext(ctx context.Context, request *CreateTargetGroupRequest) (response *CreateTargetGroupResponse, err error) { + if request == nil { + request = NewCreateTargetGroupRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateTargetGroup require credential") + } + + request.SetContext(ctx) + + response = NewCreateTargetGroupResponse() + err = c.Send(request, response) + return +} + +func NewDeleteGatewayLoadBalancerRequest() (request *DeleteGatewayLoadBalancerRequest) { + request = &DeleteGatewayLoadBalancerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DeleteGatewayLoadBalancer") + + + return +} + +func NewDeleteGatewayLoadBalancerResponse() (response *DeleteGatewayLoadBalancerResponse) { + response = &DeleteGatewayLoadBalancerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeleteGatewayLoadBalancer +// DeleteGatewayLoadBalancer 接口用以删除指定的一个或多个网关负载均衡实例。成功删除后,会把网关负载均衡实例与后端服务解绑。 +// +// 本接口为异步接口,接口返回成功后,需以返回的 RequestId 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +func (c *Client) DeleteGatewayLoadBalancer(request *DeleteGatewayLoadBalancerRequest) (response *DeleteGatewayLoadBalancerResponse, err error) { + return c.DeleteGatewayLoadBalancerWithContext(context.Background(), request) +} + +// DeleteGatewayLoadBalancer +// DeleteGatewayLoadBalancer 接口用以删除指定的一个或多个网关负载均衡实例。成功删除后,会把网关负载均衡实例与后端服务解绑。 +// +// 本接口为异步接口,接口返回成功后,需以返回的 RequestId 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +func (c *Client) DeleteGatewayLoadBalancerWithContext(ctx context.Context, request *DeleteGatewayLoadBalancerRequest) (response *DeleteGatewayLoadBalancerResponse, err error) { + if request == nil { + request = NewDeleteGatewayLoadBalancerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteGatewayLoadBalancer require credential") + } + + request.SetContext(ctx) + + response = NewDeleteGatewayLoadBalancerResponse() + err = c.Send(request, response) + return +} + +func NewDeleteTargetGroupsRequest() (request *DeleteTargetGroupsRequest) { + request = &DeleteTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DeleteTargetGroups") + + + return +} + +func NewDeleteTargetGroupsResponse() (response *DeleteTargetGroupsResponse) { + response = &DeleteTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeleteTargetGroups +// 删除目标组 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeleteTargetGroups(request *DeleteTargetGroupsRequest) (response *DeleteTargetGroupsResponse, err error) { + return c.DeleteTargetGroupsWithContext(context.Background(), request) +} + +// DeleteTargetGroups +// 删除目标组 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeleteTargetGroupsWithContext(ctx context.Context, request *DeleteTargetGroupsRequest) (response *DeleteTargetGroupsResponse, err error) { + if request == nil { + request = NewDeleteTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewDeleteTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewDeregisterTargetGroupInstancesRequest() (request *DeregisterTargetGroupInstancesRequest) { + request = &DeregisterTargetGroupInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DeregisterTargetGroupInstances") + + + return +} + +func NewDeregisterTargetGroupInstancesResponse() (response *DeregisterTargetGroupInstancesResponse) { + response = &DeregisterTargetGroupInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeregisterTargetGroupInstances +// 从目标组中解绑服务器。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeregisterTargetGroupInstances(request *DeregisterTargetGroupInstancesRequest) (response *DeregisterTargetGroupInstancesResponse, err error) { + return c.DeregisterTargetGroupInstancesWithContext(context.Background(), request) +} + +// DeregisterTargetGroupInstances +// 从目标组中解绑服务器。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DeregisterTargetGroupInstancesWithContext(ctx context.Context, request *DeregisterTargetGroupInstancesRequest) (response *DeregisterTargetGroupInstancesResponse, err error) { + if request == nil { + request = NewDeregisterTargetGroupInstancesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeregisterTargetGroupInstances require credential") + } + + request.SetContext(ctx) + + response = NewDeregisterTargetGroupInstancesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeGatewayLoadBalancersRequest() (request *DescribeGatewayLoadBalancersRequest) { + request = &DescribeGatewayLoadBalancersRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeGatewayLoadBalancers") + + + return +} + +func NewDescribeGatewayLoadBalancersResponse() (response *DescribeGatewayLoadBalancersResponse) { + response = &DescribeGatewayLoadBalancersResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeGatewayLoadBalancers +// 查询一个地域的网关负载均衡实例列表。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_INVALIDFILTER = "InvalidParameterValue.InvalidFilter" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeGatewayLoadBalancers(request *DescribeGatewayLoadBalancersRequest) (response *DescribeGatewayLoadBalancersResponse, err error) { + return c.DescribeGatewayLoadBalancersWithContext(context.Background(), request) +} + +// DescribeGatewayLoadBalancers +// 查询一个地域的网关负载均衡实例列表。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_INVALIDFILTER = "InvalidParameterValue.InvalidFilter" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeGatewayLoadBalancersWithContext(ctx context.Context, request *DescribeGatewayLoadBalancersRequest) (response *DescribeGatewayLoadBalancersResponse, err error) { + if request == nil { + request = NewDescribeGatewayLoadBalancersRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeGatewayLoadBalancers require credential") + } + + request.SetContext(ctx) + + response = NewDescribeGatewayLoadBalancersResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupInstanceStatusRequest() (request *DescribeTargetGroupInstanceStatusRequest) { + request = &DescribeTargetGroupInstanceStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroupInstanceStatus") + + + return +} + +func NewDescribeTargetGroupInstanceStatusResponse() (response *DescribeTargetGroupInstanceStatusResponse) { + response = &DescribeTargetGroupInstanceStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroupInstanceStatus +// 查询目标组后端服务状态。目前仅支持网关负载均衡类型的目标组支持查询后端服务状态。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_INVALIDFILTER = "InvalidParameterValue.InvalidFilter" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeTargetGroupInstanceStatus(request *DescribeTargetGroupInstanceStatusRequest) (response *DescribeTargetGroupInstanceStatusResponse, err error) { + return c.DescribeTargetGroupInstanceStatusWithContext(context.Background(), request) +} + +// DescribeTargetGroupInstanceStatus +// 查询目标组后端服务状态。目前仅支持网关负载均衡类型的目标组支持查询后端服务状态。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE_INVALIDFILTER = "InvalidParameterValue.InvalidFilter" +// INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" +func (c *Client) DescribeTargetGroupInstanceStatusWithContext(ctx context.Context, request *DescribeTargetGroupInstanceStatusRequest) (response *DescribeTargetGroupInstanceStatusResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupInstanceStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroupInstanceStatus require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupInstanceStatusResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupInstancesRequest() (request *DescribeTargetGroupInstancesRequest) { + request = &DescribeTargetGroupInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroupInstances") + + + return +} + +func NewDescribeTargetGroupInstancesResponse() (response *DescribeTargetGroupInstancesResponse) { + response = &DescribeTargetGroupInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroupInstances +// 获取目标组绑定的服务器信息。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupInstances(request *DescribeTargetGroupInstancesRequest) (response *DescribeTargetGroupInstancesResponse, err error) { + return c.DescribeTargetGroupInstancesWithContext(context.Background(), request) +} + +// DescribeTargetGroupInstances +// 获取目标组绑定的服务器信息。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupInstancesWithContext(ctx context.Context, request *DescribeTargetGroupInstancesRequest) (response *DescribeTargetGroupInstancesResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupInstancesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroupInstances require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupInstancesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupListRequest() (request *DescribeTargetGroupListRequest) { + request = &DescribeTargetGroupListRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroupList") + + + return +} + +func NewDescribeTargetGroupListResponse() (response *DescribeTargetGroupListResponse) { + response = &DescribeTargetGroupListResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroupList +// 获取目标组列表 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupList(request *DescribeTargetGroupListRequest) (response *DescribeTargetGroupListResponse, err error) { + return c.DescribeTargetGroupListWithContext(context.Background(), request) +} + +// DescribeTargetGroupList +// 获取目标组列表 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupListWithContext(ctx context.Context, request *DescribeTargetGroupListRequest) (response *DescribeTargetGroupListResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupListRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroupList require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupListResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTargetGroupsRequest() (request *DescribeTargetGroupsRequest) { + request = &DescribeTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTargetGroups") + + + return +} + +func NewDescribeTargetGroupsResponse() (response *DescribeTargetGroupsResponse) { + response = &DescribeTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTargetGroups +// 查询目标组信息 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroups(request *DescribeTargetGroupsRequest) (response *DescribeTargetGroupsResponse, err error) { + return c.DescribeTargetGroupsWithContext(context.Background(), request) +} + +// DescribeTargetGroups +// 查询目标组信息 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DescribeTargetGroupsWithContext(ctx context.Context, request *DescribeTargetGroupsRequest) (response *DescribeTargetGroupsResponse, err error) { + if request == nil { + request = NewDescribeTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTaskStatusRequest() (request *DescribeTaskStatusRequest) { + request = &DescribeTaskStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DescribeTaskStatus") + + + return +} + +func NewDescribeTaskStatusResponse() (response *DescribeTaskStatusResponse) { + response = &DescribeTaskStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeTaskStatus +// 本接口用于查询异步任务的执行状态,对于非查询类的接口(创建/删除负载均衡实例等),在接口调用成功后,都需要使用本接口查询任务最终是否执行成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_REGIONNOTFOUND = "InvalidParameter.RegionNotFound" +func (c *Client) DescribeTaskStatus(request *DescribeTaskStatusRequest) (response *DescribeTaskStatusResponse, err error) { + return c.DescribeTaskStatusWithContext(context.Background(), request) +} + +// DescribeTaskStatus +// 本接口用于查询异步任务的执行状态,对于非查询类的接口(创建/删除负载均衡实例等),在接口调用成功后,都需要使用本接口查询任务最终是否执行成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_REGIONNOTFOUND = "InvalidParameter.RegionNotFound" +func (c *Client) DescribeTaskStatusWithContext(ctx context.Context, request *DescribeTaskStatusRequest) (response *DescribeTaskStatusResponse, err error) { + if request == nil { + request = NewDescribeTaskStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTaskStatus require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTaskStatusResponse() + err = c.Send(request, response) + return +} + +func NewDisassociateTargetGroupsRequest() (request *DisassociateTargetGroupsRequest) { + request = &DisassociateTargetGroupsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "DisassociateTargetGroups") + + + return +} + +func NewDisassociateTargetGroupsResponse() (response *DisassociateTargetGroupsResponse) { + response = &DisassociateTargetGroupsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DisassociateTargetGroups +// 解除负载均衡和目标组的关联关系。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DisassociateTargetGroups(request *DisassociateTargetGroupsRequest) (response *DisassociateTargetGroupsResponse, err error) { + return c.DisassociateTargetGroupsWithContext(context.Background(), request) +} + +// DisassociateTargetGroups +// 解除负载均衡和目标组的关联关系。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) DisassociateTargetGroupsWithContext(ctx context.Context, request *DisassociateTargetGroupsRequest) (response *DisassociateTargetGroupsResponse, err error) { + if request == nil { + request = NewDisassociateTargetGroupsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DisassociateTargetGroups require credential") + } + + request.SetContext(ctx) + + response = NewDisassociateTargetGroupsResponse() + err = c.Send(request, response) + return +} + +func NewInquirePriceCreateGatewayLoadBalancerRequest() (request *InquirePriceCreateGatewayLoadBalancerRequest) { + request = &InquirePriceCreateGatewayLoadBalancerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "InquirePriceCreateGatewayLoadBalancer") + + + return +} + +func NewInquirePriceCreateGatewayLoadBalancerResponse() (response *InquirePriceCreateGatewayLoadBalancerResponse) { + response = &InquirePriceCreateGatewayLoadBalancerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// InquirePriceCreateGatewayLoadBalancer +// InquirePriceCreateGatewayLoadBalancer接口查询创建网关负载均衡的价格。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) InquirePriceCreateGatewayLoadBalancer(request *InquirePriceCreateGatewayLoadBalancerRequest) (response *InquirePriceCreateGatewayLoadBalancerResponse, err error) { + return c.InquirePriceCreateGatewayLoadBalancerWithContext(context.Background(), request) +} + +// InquirePriceCreateGatewayLoadBalancer +// InquirePriceCreateGatewayLoadBalancer接口查询创建网关负载均衡的价格。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) InquirePriceCreateGatewayLoadBalancerWithContext(ctx context.Context, request *InquirePriceCreateGatewayLoadBalancerRequest) (response *InquirePriceCreateGatewayLoadBalancerResponse, err error) { + if request == nil { + request = NewInquirePriceCreateGatewayLoadBalancerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("InquirePriceCreateGatewayLoadBalancer require credential") + } + + request.SetContext(ctx) + + response = NewInquirePriceCreateGatewayLoadBalancerResponse() + err = c.Send(request, response) + return +} + +func NewModifyGatewayLoadBalancerAttributeRequest() (request *ModifyGatewayLoadBalancerAttributeRequest) { + request = &ModifyGatewayLoadBalancerAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "ModifyGatewayLoadBalancerAttribute") + + + return +} + +func NewModifyGatewayLoadBalancerAttributeResponse() (response *ModifyGatewayLoadBalancerAttributeResponse) { + response = &ModifyGatewayLoadBalancerAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyGatewayLoadBalancerAttribute +// ModifyGatewayLoadBalancerAttribute 接口用于修改负载均衡实例的属性。支持修改负载均衡实例的名称、带宽上限。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_DUPLICATE = "InvalidParameterValue.Duplicate" +func (c *Client) ModifyGatewayLoadBalancerAttribute(request *ModifyGatewayLoadBalancerAttributeRequest) (response *ModifyGatewayLoadBalancerAttributeResponse, err error) { + return c.ModifyGatewayLoadBalancerAttributeWithContext(context.Background(), request) +} + +// ModifyGatewayLoadBalancerAttribute +// ModifyGatewayLoadBalancerAttribute 接口用于修改负载均衡实例的属性。支持修改负载均衡实例的名称、带宽上限。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_DUPLICATE = "InvalidParameterValue.Duplicate" +func (c *Client) ModifyGatewayLoadBalancerAttributeWithContext(ctx context.Context, request *ModifyGatewayLoadBalancerAttributeRequest) (response *ModifyGatewayLoadBalancerAttributeResponse, err error) { + if request == nil { + request = NewModifyGatewayLoadBalancerAttributeRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyGatewayLoadBalancerAttribute require credential") + } + + request.SetContext(ctx) + + response = NewModifyGatewayLoadBalancerAttributeResponse() + err = c.Send(request, response) + return +} + +func NewModifyTargetGroupAttributeRequest() (request *ModifyTargetGroupAttributeRequest) { + request = &ModifyTargetGroupAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "ModifyTargetGroupAttribute") + + + return +} + +func NewModifyTargetGroupAttributeResponse() (response *ModifyTargetGroupAttributeResponse) { + response = &ModifyTargetGroupAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyTargetGroupAttribute +// 修改目标组的名称、健康探测等属性。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupAttribute(request *ModifyTargetGroupAttributeRequest) (response *ModifyTargetGroupAttributeResponse, err error) { + return c.ModifyTargetGroupAttributeWithContext(context.Background(), request) +} + +// ModifyTargetGroupAttribute +// 修改目标组的名称、健康探测等属性。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupAttributeWithContext(ctx context.Context, request *ModifyTargetGroupAttributeRequest) (response *ModifyTargetGroupAttributeResponse, err error) { + if request == nil { + request = NewModifyTargetGroupAttributeRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyTargetGroupAttribute require credential") + } + + request.SetContext(ctx) + + response = NewModifyTargetGroupAttributeResponse() + err = c.Send(request, response) + return +} + +func NewModifyTargetGroupInstancesWeightRequest() (request *ModifyTargetGroupInstancesWeightRequest) { + request = &ModifyTargetGroupInstancesWeightRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "ModifyTargetGroupInstancesWeight") + + + return +} + +func NewModifyTargetGroupInstancesWeightResponse() (response *ModifyTargetGroupInstancesWeightResponse) { + response = &ModifyTargetGroupInstancesWeightResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyTargetGroupInstancesWeight +// 修改目标组的服务器权重。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupInstancesWeight(request *ModifyTargetGroupInstancesWeightRequest) (response *ModifyTargetGroupInstancesWeightResponse, err error) { + return c.ModifyTargetGroupInstancesWeightWithContext(context.Background(), request) +} + +// ModifyTargetGroupInstancesWeight +// 修改目标组的服务器权重。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) ModifyTargetGroupInstancesWeightWithContext(ctx context.Context, request *ModifyTargetGroupInstancesWeightRequest) (response *ModifyTargetGroupInstancesWeightResponse, err error) { + if request == nil { + request = NewModifyTargetGroupInstancesWeightRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyTargetGroupInstancesWeight require credential") + } + + request.SetContext(ctx) + + response = NewModifyTargetGroupInstancesWeightResponse() + err = c.Send(request, response) + return +} + +func NewRegisterTargetGroupInstancesRequest() (request *RegisterTargetGroupInstancesRequest) { + request = &RegisterTargetGroupInstancesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("gwlb", APIVersion, "RegisterTargetGroupInstances") + + + return +} + +func NewRegisterTargetGroupInstancesResponse() (response *RegisterTargetGroupInstancesResponse) { + response = &RegisterTargetGroupInstancesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// RegisterTargetGroupInstances +// 注册服务器到目标组。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) RegisterTargetGroupInstances(request *RegisterTargetGroupInstancesRequest) (response *RegisterTargetGroupInstancesResponse, err error) { + return c.RegisterTargetGroupInstancesWithContext(context.Background(), request) +} + +// RegisterTargetGroupInstances +// 注册服务器到目标组。 +// +// 本接口为异步接口,本接口返回成功后需以返回的 RequestID 为入参,调用 DescribeTaskStatus 接口查询本次任务是否成功。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// LIMITEXCEEDED = "LimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +func (c *Client) RegisterTargetGroupInstancesWithContext(ctx context.Context, request *RegisterTargetGroupInstancesRequest) (response *RegisterTargetGroupInstancesResponse, err error) { + if request == nil { + request = NewRegisterTargetGroupInstancesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("RegisterTargetGroupInstances require credential") + } + + request.SetContext(ctx) + + response = NewRegisterTargetGroupInstancesResponse() + err = c.Send(request, response) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/errors.go new file mode 100644 index 0000000000..ea825fc09e --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/errors.go @@ -0,0 +1,55 @@ +// 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 v20240906 + +const ( + // 此产品的特有错误码 + + // 操作失败。 + FAILEDOPERATION = "FailedOperation" + + // FailedOperation.ResourceInOperating + FAILEDOPERATION_RESOURCEINOPERATING = "FailedOperation.ResourceInOperating" + + // 内部错误。 + INTERNALERROR = "InternalError" + + // 参数错误。 + INVALIDPARAMETER = "InvalidParameter" + + // InvalidParameter.FormatError + INVALIDPARAMETER_FORMATERROR = "InvalidParameter.FormatError" + + // InvalidParameter.RegionNotFound + INVALIDPARAMETER_REGIONNOTFOUND = "InvalidParameter.RegionNotFound" + + // 参数取值错误。 + INVALIDPARAMETERVALUE = "InvalidParameterValue" + + // 存在相同的值。 + INVALIDPARAMETERVALUE_DUPLICATE = "InvalidParameterValue.Duplicate" + + // Filter参数输入错误。 + INVALIDPARAMETERVALUE_INVALIDFILTER = "InvalidParameterValue.InvalidFilter" + + // InvalidParameterValue.Length + INVALIDPARAMETERVALUE_LENGTH = "InvalidParameterValue.Length" + + // 超过配额限制。 + LIMITEXCEEDED = "LimitExceeded" + + // 未授权操作。 + UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +) diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/models.go new file mode 100644 index 0000000000..d2b73522fa --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906/models.go @@ -0,0 +1,1569 @@ +// 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 v20240906 + +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 AssociateTargetGroupsRequestParams struct { + // 绑定的关系数组。一次请求最多支持20个。 + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +type AssociateTargetGroupsRequest struct { + *tchttp.BaseRequest + + // 绑定的关系数组。一次请求最多支持20个。 + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +func (r *AssociateTargetGroupsRequest) 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 *AssociateTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Associations") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "AssociateTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type AssociateTargetGroupsResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type AssociateTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *AssociateTargetGroupsResponseParams `json:"Response"` +} + +func (r *AssociateTargetGroupsResponse) 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 *AssociateTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type AssociationItem struct { + // 关联到的网关负载均衡实例ID + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // 网关负载均衡实例名称 + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` +} + +// Predefined struct for user +type CreateGatewayLoadBalancerRequestParams struct { + // 网关负载均衡后端目标设备所属的私有网络 ID,如vpc-azd4dt1c,可以通过 [DescribeVpcs](https://cloud.tencent.com/document/product/215/15778) 接口获取。 + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // 网关负载均衡后端目标设备所属的私有网络的子网ID。 + SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"` + + // 网关负载均衡实例名称。可支持输入1-60个字符。不填写时默认自动生成。 + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // 创建网关负载均衡的个数,默认值为 1。批量创建数量最大支持10个。 + Number *uint64 `json:"Number,omitnil,omitempty" name:"Number"` + + // 购买网关负载均衡的同时,给负载均衡打上标签,最大支持20个标签键值对。 + Tags []*TagInfo `json:"Tags,omitnil,omitempty" name:"Tags"` + + // 网关负载均衡实例计费类型,当前只支持传POSTPAID_BY_HOUR,默认是POSTPAID_BY_HOUR。 + LBChargeType *string `json:"LBChargeType,omitnil,omitempty" name:"LBChargeType"` +} + +type CreateGatewayLoadBalancerRequest struct { + *tchttp.BaseRequest + + // 网关负载均衡后端目标设备所属的私有网络 ID,如vpc-azd4dt1c,可以通过 [DescribeVpcs](https://cloud.tencent.com/document/product/215/15778) 接口获取。 + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // 网关负载均衡后端目标设备所属的私有网络的子网ID。 + SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"` + + // 网关负载均衡实例名称。可支持输入1-60个字符。不填写时默认自动生成。 + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // 创建网关负载均衡的个数,默认值为 1。批量创建数量最大支持10个。 + Number *uint64 `json:"Number,omitnil,omitempty" name:"Number"` + + // 购买网关负载均衡的同时,给负载均衡打上标签,最大支持20个标签键值对。 + Tags []*TagInfo `json:"Tags,omitnil,omitempty" name:"Tags"` + + // 网关负载均衡实例计费类型,当前只支持传POSTPAID_BY_HOUR,默认是POSTPAID_BY_HOUR。 + LBChargeType *string `json:"LBChargeType,omitnil,omitempty" name:"LBChargeType"` +} + +func (r *CreateGatewayLoadBalancerRequest) 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 *CreateGatewayLoadBalancerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "VpcId") + delete(f, "SubnetId") + delete(f, "LoadBalancerName") + delete(f, "Number") + delete(f, "Tags") + delete(f, "LBChargeType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateGatewayLoadBalancerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateGatewayLoadBalancerResponseParams struct { + // 由网关负载均衡实例唯一 ID 组成的数组。 + // 存在某些场景,如创建出现延迟时,此字段可能返回为空;此时可以根据接口返回的RequestId或DealName参数,通过DescribeTaskStatus接口查询创建的资源ID。 + // 注意:此字段可能返回 null,表示取不到有效值。 + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // 订单号。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DealName *string `json:"DealName,omitnil,omitempty" name:"DealName"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type CreateGatewayLoadBalancerResponse struct { + *tchttp.BaseResponse + Response *CreateGatewayLoadBalancerResponseParams `json:"Response"` +} + +func (r *CreateGatewayLoadBalancerResponse) 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 *CreateGatewayLoadBalancerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateTargetGroupRequestParams struct { + // 目标组名称,限定60个字符。 + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // 目标组的vpcid属性,不填则使用默认vpc + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // 目标组的默认端口, 后续添加服务器时可使用该默认端口。Port和TargetGroupInstances.N中的port二者必填其一。仅支持6081。 + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // 目标组绑定的后端服务器 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` + + // 网关负载均衡目标组协议。 + // - TENCENT_GENEVE :GENEVE 标准协议 + // - AWS_GENEVE:GENEVE 兼容协议 + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // 健康检查设置。 + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // 均衡算法。 + // - IP_HASH_3_ELASTIC:弹性哈希 + ScheduleAlgorithm *string `json:"ScheduleAlgorithm,omitnil,omitempty" name:"ScheduleAlgorithm"` + + // 是否支持全死全活。默认支持。 + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +type CreateTargetGroupRequest struct { + *tchttp.BaseRequest + + // 目标组名称,限定60个字符。 + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // 目标组的vpcid属性,不填则使用默认vpc + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // 目标组的默认端口, 后续添加服务器时可使用该默认端口。Port和TargetGroupInstances.N中的port二者必填其一。仅支持6081。 + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // 目标组绑定的后端服务器 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` + + // 网关负载均衡目标组协议。 + // - TENCENT_GENEVE :GENEVE 标准协议 + // - AWS_GENEVE:GENEVE 兼容协议 + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // 健康检查设置。 + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // 均衡算法。 + // - IP_HASH_3_ELASTIC:弹性哈希 + ScheduleAlgorithm *string `json:"ScheduleAlgorithm,omitnil,omitempty" name:"ScheduleAlgorithm"` + + // 是否支持全死全活。默认支持。 + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +func (r *CreateTargetGroupRequest) 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 *CreateTargetGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupName") + delete(f, "VpcId") + delete(f, "Port") + delete(f, "TargetGroupInstances") + delete(f, "Protocol") + delete(f, "HealthCheck") + delete(f, "ScheduleAlgorithm") + delete(f, "AllDeadToAlive") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateTargetGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateTargetGroupResponseParams struct { + // 创建目标组后生成的id + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type CreateTargetGroupResponse struct { + *tchttp.BaseResponse + Response *CreateTargetGroupResponseParams `json:"Response"` +} + +func (r *CreateTargetGroupResponse) 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 *CreateTargetGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteGatewayLoadBalancerRequestParams struct { + // 要删除的网关负载均衡实例 ID数组,数组大小最大支持20。 + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` +} + +type DeleteGatewayLoadBalancerRequest struct { + *tchttp.BaseRequest + + // 要删除的网关负载均衡实例 ID数组,数组大小最大支持20。 + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` +} + +func (r *DeleteGatewayLoadBalancerRequest) 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 *DeleteGatewayLoadBalancerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "LoadBalancerIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteGatewayLoadBalancerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteGatewayLoadBalancerResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeleteGatewayLoadBalancerResponse struct { + *tchttp.BaseResponse + Response *DeleteGatewayLoadBalancerResponseParams `json:"Response"` +} + +func (r *DeleteGatewayLoadBalancerResponse) 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 *DeleteGatewayLoadBalancerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteTargetGroupsRequestParams struct { + // 目标组ID列表。 + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` +} + +type DeleteTargetGroupsRequest struct { + *tchttp.BaseRequest + + // 目标组ID列表。 + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` +} + +func (r *DeleteTargetGroupsRequest) 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 *DeleteTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteTargetGroupsResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeleteTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *DeleteTargetGroupsResponseParams `json:"Response"` +} + +func (r *DeleteTargetGroupsResponse) 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 *DeleteTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeregisterTargetGroupInstancesRequestParams struct { + // 目标组ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 待解绑的服务器信息。 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +type DeregisterTargetGroupInstancesRequest struct { + *tchttp.BaseRequest + + // 目标组ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 待解绑的服务器信息。 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +func (r *DeregisterTargetGroupInstancesRequest) 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 *DeregisterTargetGroupInstancesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstances") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeregisterTargetGroupInstancesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeregisterTargetGroupInstancesResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeregisterTargetGroupInstancesResponse struct { + *tchttp.BaseResponse + Response *DeregisterTargetGroupInstancesResponseParams `json:"Response"` +} + +func (r *DeregisterTargetGroupInstancesResponse) 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 *DeregisterTargetGroupInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeGatewayLoadBalancersRequestParams struct { + // 网关负载均衡实例ID。支持批量筛选的实例ID数量上限为20个。 + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // 一次批量返回网关负载均衡实例的数量,默认为20,最大值为100。 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 返回网关负载均衡实例列表的起始偏移量,默认0。 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 查询负载均衡详细信息列表的过滤条件,每次请求的Filters的上限为10,Filter.Values的上限为100。 + // Filter.Name和Filter.Values皆为必填项。详细的过滤条件如下: + // - VpcId - String - 是否必填:否 - (过滤条件)按照网关负载均衡实例所属的私有网络过滤,如“vpc-bhqk****”。 + // - Vips - String - 是否必填:否 - (过滤条件)按照网关负载均衡实例所属的私有网络过滤,如“10.1.1.1” + // - tag:tag-key - String - 是否必填:否 - (过滤条件)按照GWLB标签键值对进行过滤,tag-key使用具体的标签键进行替换。 + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 搜索字段,模糊匹配名称、VIP。 + SearchKey *string `json:"SearchKey,omitnil,omitempty" name:"SearchKey"` +} + +type DescribeGatewayLoadBalancersRequest struct { + *tchttp.BaseRequest + + // 网关负载均衡实例ID。支持批量筛选的实例ID数量上限为20个。 + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // 一次批量返回网关负载均衡实例的数量,默认为20,最大值为100。 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 返回网关负载均衡实例列表的起始偏移量,默认0。 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 查询负载均衡详细信息列表的过滤条件,每次请求的Filters的上限为10,Filter.Values的上限为100。 + // Filter.Name和Filter.Values皆为必填项。详细的过滤条件如下: + // - VpcId - String - 是否必填:否 - (过滤条件)按照网关负载均衡实例所属的私有网络过滤,如“vpc-bhqk****”。 + // - Vips - String - 是否必填:否 - (过滤条件)按照网关负载均衡实例所属的私有网络过滤,如“10.1.1.1” + // - tag:tag-key - String - 是否必填:否 - (过滤条件)按照GWLB标签键值对进行过滤,tag-key使用具体的标签键进行替换。 + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 搜索字段,模糊匹配名称、VIP。 + SearchKey *string `json:"SearchKey,omitnil,omitempty" name:"SearchKey"` +} + +func (r *DescribeGatewayLoadBalancersRequest) 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 *DescribeGatewayLoadBalancersRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "LoadBalancerIds") + delete(f, "Limit") + delete(f, "Offset") + delete(f, "Filters") + delete(f, "SearchKey") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeGatewayLoadBalancersRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeGatewayLoadBalancersResponseParams struct { + // 满足过滤条件的负载均衡实例总数。此数值与入参中的Limit无关。 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 返回的网关负载均衡实例数组。 + LoadBalancerSet []*GatewayLoadBalancer `json:"LoadBalancerSet,omitnil,omitempty" name:"LoadBalancerSet"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeGatewayLoadBalancersResponse struct { + *tchttp.BaseResponse + Response *DescribeGatewayLoadBalancersResponseParams `json:"Response"` +} + +func (r *DescribeGatewayLoadBalancersResponse) 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 *DescribeGatewayLoadBalancersResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstanceStatusRequestParams struct { + // 目标组唯一id + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 目标组绑定的后端服务ip列表 + TargetGroupInstanceIps []*string `json:"TargetGroupInstanceIps,omitnil,omitempty" name:"TargetGroupInstanceIps"` +} + +type DescribeTargetGroupInstanceStatusRequest struct { + *tchttp.BaseRequest + + // 目标组唯一id + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 目标组绑定的后端服务ip列表 + TargetGroupInstanceIps []*string `json:"TargetGroupInstanceIps,omitnil,omitempty" name:"TargetGroupInstanceIps"` +} + +func (r *DescribeTargetGroupInstanceStatusRequest) 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 *DescribeTargetGroupInstanceStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstanceIps") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupInstanceStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstanceStatusResponseParams struct { + // 健康检查后端rs状态列表 + TargetGroupInstanceSet []*TargetGroupInstanceStatus `json:"TargetGroupInstanceSet,omitnil,omitempty" name:"TargetGroupInstanceSet"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupInstanceStatusResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupInstanceStatusResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupInstanceStatusResponse) 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 *DescribeTargetGroupInstanceStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstancesRequestParams struct { + // 过滤条件,当前仅支持TargetGroupId,BindIP,InstanceId过滤。 + // + // - TargetGroupId - String - 是否必填:否 - (过滤条件)目标组ID,如“lbtg-5xunivs0”。 + // - BindIP - String - 是否必填:否 - (过滤条件)目标组绑定实例的内网IP地址,如“10.1.1.1” + // - InstanceId - String - 是否必填:否 - (过滤条件)目标组绑定实例的名称,如“ins-mxzlf9ke” + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 显示数量限制,默认20。 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 显示的偏移量,默认为0。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` +} + +type DescribeTargetGroupInstancesRequest struct { + *tchttp.BaseRequest + + // 过滤条件,当前仅支持TargetGroupId,BindIP,InstanceId过滤。 + // + // - TargetGroupId - String - 是否必填:否 - (过滤条件)目标组ID,如“lbtg-5xunivs0”。 + // - BindIP - String - 是否必填:否 - (过滤条件)目标组绑定实例的内网IP地址,如“10.1.1.1” + // - InstanceId - String - 是否必填:否 - (过滤条件)目标组绑定实例的名称,如“ins-mxzlf9ke” + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 显示数量限制,默认20。 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 显示的偏移量,默认为0。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` +} + +func (r *DescribeTargetGroupInstancesRequest) 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 *DescribeTargetGroupInstancesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Filters") + delete(f, "Limit") + delete(f, "Offset") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupInstancesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupInstancesResponseParams struct { + // 本次查询的结果数量。 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 绑定的服务器信息。 + TargetGroupInstanceSet []*TargetGroupBackend `json:"TargetGroupInstanceSet,omitnil,omitempty" name:"TargetGroupInstanceSet"` + + // 实际统计数量,不受Limit、Offset、CAM的影响。 + RealCount *uint64 `json:"RealCount,omitnil,omitempty" name:"RealCount"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupInstancesResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupInstancesResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupInstancesResponse) 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 *DescribeTargetGroupInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupListRequestParams struct { + // 目标组ID数组。 + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // 过滤条件数组。 + // + // - TargetGroupVpcId - String - 是否必填:否 - (过滤条件)按照目标组所属的私有网络过滤,如“vpc-bhqk****”。 + // - TargetGroupName - String - 是否必填:否 - (过滤条件)按照目标组的名称过滤,如“tg_name” + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 显示的偏移起始量。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 显示条数限制,默认为20。 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` +} + +type DescribeTargetGroupListRequest struct { + *tchttp.BaseRequest + + // 目标组ID数组。 + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // 过滤条件数组。 + // + // - TargetGroupVpcId - String - 是否必填:否 - (过滤条件)按照目标组所属的私有网络过滤,如“vpc-bhqk****”。 + // - TargetGroupName - String - 是否必填:否 - (过滤条件)按照目标组的名称过滤,如“tg_name” + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` + + // 显示的偏移起始量。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 显示条数限制,默认为20。 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` +} + +func (r *DescribeTargetGroupListRequest) 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 *DescribeTargetGroupListRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupIds") + delete(f, "Filters") + delete(f, "Offset") + delete(f, "Limit") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupListRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupListResponseParams struct { + // 显示的结果数量。 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 显示的目标组信息集合。 + TargetGroupSet []*TargetGroupInfo `json:"TargetGroupSet,omitnil,omitempty" name:"TargetGroupSet"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupListResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupListResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupListResponse) 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 *DescribeTargetGroupListResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupsRequestParams struct { + // 目标组ID,与Filters互斥。 + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // 显示条数限制,默认为20。 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 显示的偏移起始量。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 过滤条件数组。 + // + // - TargetGroupVpcId - String - 是否必填:否 - (过滤条件)按照目标组所属的私有网络过滤,如“vpc-bhqk****”。 + // - TargetGroupName - String - 是否必填:否 - (过滤条件)按照目标组的名称过滤,如“tg_name” + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` +} + +type DescribeTargetGroupsRequest struct { + *tchttp.BaseRequest + + // 目标组ID,与Filters互斥。 + TargetGroupIds []*string `json:"TargetGroupIds,omitnil,omitempty" name:"TargetGroupIds"` + + // 显示条数限制,默认为20。 + Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 显示的偏移起始量。 + Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 过滤条件数组。 + // + // - TargetGroupVpcId - String - 是否必填:否 - (过滤条件)按照目标组所属的私有网络过滤,如“vpc-bhqk****”。 + // - TargetGroupName - String - 是否必填:否 - (过滤条件)按照目标组的名称过滤,如“tg_name” + Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"` +} + +func (r *DescribeTargetGroupsRequest) 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 *DescribeTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupIds") + delete(f, "Limit") + delete(f, "Offset") + delete(f, "Filters") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTargetGroupsResponseParams struct { + // 显示的结果数量。 + TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 显示的目标组信息集合。 + TargetGroupSet []*TargetGroupInfo `json:"TargetGroupSet,omitnil,omitempty" name:"TargetGroupSet"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *DescribeTargetGroupsResponseParams `json:"Response"` +} + +func (r *DescribeTargetGroupsResponse) 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 *DescribeTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTaskStatusRequestParams struct { + // 请求ID,即接口返回的 RequestId 参数。 + TaskId *string `json:"TaskId,omitnil,omitempty" name:"TaskId"` +} + +type DescribeTaskStatusRequest struct { + *tchttp.BaseRequest + + // 请求ID,即接口返回的 RequestId 参数。 + TaskId *string `json:"TaskId,omitnil,omitempty" name:"TaskId"` +} + +func (r *DescribeTaskStatusRequest) 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 *DescribeTaskStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TaskId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTaskStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTaskStatusResponseParams struct { + // 任务的当前状态。 0:成功,1:失败,2:进行中。 + Status *int64 `json:"Status,omitnil,omitempty" name:"Status"` + + // 由负载均衡实例唯一 ID 组成的数组。 + // 注意:此字段可能返回 null,表示取不到有效值。 + LoadBalancerIds []*string `json:"LoadBalancerIds,omitnil,omitempty" name:"LoadBalancerIds"` + + // 辅助描述信息,如失败原因等。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Message *string `json:"Message,omitnil,omitempty" name:"Message"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeTaskStatusResponse struct { + *tchttp.BaseResponse + Response *DescribeTaskStatusResponseParams `json:"Response"` +} + +func (r *DescribeTaskStatusResponse) 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 *DescribeTaskStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DisassociateTargetGroupsRequestParams struct { + // 待解绑的目标组列表。 + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +type DisassociateTargetGroupsRequest struct { + *tchttp.BaseRequest + + // 待解绑的目标组列表。 + Associations []*TargetGroupAssociation `json:"Associations,omitnil,omitempty" name:"Associations"` +} + +func (r *DisassociateTargetGroupsRequest) 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 *DisassociateTargetGroupsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Associations") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DisassociateTargetGroupsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DisassociateTargetGroupsResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DisassociateTargetGroupsResponse struct { + *tchttp.BaseResponse + Response *DisassociateTargetGroupsResponseParams `json:"Response"` +} + +func (r *DisassociateTargetGroupsResponse) 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 *DisassociateTargetGroupsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type Filter struct { + // 过滤器的名称 + Name *string `json:"Name,omitnil,omitempty" name:"Name"` + + // 过滤器的值数组 + Values []*string `json:"Values,omitnil,omitempty" name:"Values"` +} + +type GatewayLoadBalancer struct { + // 网关负载均衡实例 ID。 + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // 网关负载均衡实例的名称。 + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // 网关负载均衡所属私有网络。 + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // 网关负载均衡所属子网。 + SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"` + + // 网关负载均衡提供服务的虚拟IP。 + Vips []*string `json:"Vips,omitnil,omitempty" name:"Vips"` + + // 网关负载均衡实例状态。 + // 0:创建中,1:正常运行,3:删除中。 + Status *uint64 `json:"Status,omitnil,omitempty" name:"Status"` + + // 关联的目标组唯一ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 是否开启删除保护功能。 + DeleteProtect *bool `json:"DeleteProtect,omitnil,omitempty" name:"DeleteProtect"` + + // 负载均衡实例的标签信息。 + Tags []*TagInfo `json:"Tags,omitnil,omitempty" name:"Tags"` + + // 创建时间。 + CreateTime *string `json:"CreateTime,omitnil,omitempty" name:"CreateTime"` + + // 网关负载均衡实例的计费类型,POSTPAID_BY_HOUR:按量计费 + ChargeType *string `json:"ChargeType,omitnil,omitempty" name:"ChargeType"` + + // 0:表示未被隔离,1:表示被隔离。 + Isolation *uint64 `json:"Isolation,omitnil,omitempty" name:"Isolation"` + + // 网关负载均衡实例被隔离的时间 + IsolatedTime *string `json:"IsolatedTime,omitnil,omitempty" name:"IsolatedTime"` + + // 是否开启配置修改保护功能。 + OperateProtect *bool `json:"OperateProtect,omitnil,omitempty" name:"OperateProtect"` +} + +// Predefined struct for user +type InquirePriceCreateGatewayLoadBalancerRequestParams struct { + // 询价的网关负载均衡实例个数,默认为1 + GoodsNum *uint64 `json:"GoodsNum,omitnil,omitempty" name:"GoodsNum"` +} + +type InquirePriceCreateGatewayLoadBalancerRequest struct { + *tchttp.BaseRequest + + // 询价的网关负载均衡实例个数,默认为1 + GoodsNum *uint64 `json:"GoodsNum,omitnil,omitempty" name:"GoodsNum"` +} + +func (r *InquirePriceCreateGatewayLoadBalancerRequest) 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 *InquirePriceCreateGatewayLoadBalancerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "GoodsNum") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "InquirePriceCreateGatewayLoadBalancerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type InquirePriceCreateGatewayLoadBalancerResponseParams struct { + // 该参数表示对应的价格。 + Price *Price `json:"Price,omitnil,omitempty" name:"Price"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type InquirePriceCreateGatewayLoadBalancerResponse struct { + *tchttp.BaseResponse + Response *InquirePriceCreateGatewayLoadBalancerResponseParams `json:"Response"` +} + +func (r *InquirePriceCreateGatewayLoadBalancerResponse) 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 *InquirePriceCreateGatewayLoadBalancerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ItemPrice struct { + // 后付费单价,单位:元。 + // 注意:此字段可能返回 null,表示取不到有效值。 + UnitPrice *float64 `json:"UnitPrice,omitnil,omitempty" name:"UnitPrice"` + + // 后付费计价单元,可取值范围: HOUR:表示计价单元是按每小时来计算。当前涉及该计价单元的场景有:实例按小时后付费(POSTPAID_BY_HOUR)。 + // 注意:此字段可能返回 null,表示取不到有效值。 + ChargeUnit *string `json:"ChargeUnit,omitnil,omitempty" name:"ChargeUnit"` + + // 预支费用的原价,单位:元。 + // 注意:此字段可能返回 null,表示取不到有效值。 + OriginalPrice *float64 `json:"OriginalPrice,omitnil,omitempty" name:"OriginalPrice"` + + // 预支费用的折扣价,单位:元。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DiscountPrice *float64 `json:"DiscountPrice,omitnil,omitempty" name:"DiscountPrice"` + + // 后付费的折扣单价,单位:元。 + // 注意:此字段可能返回 null,表示取不到有效值。 + UnitPriceDiscount *float64 `json:"UnitPriceDiscount,omitnil,omitempty" name:"UnitPriceDiscount"` + + // 折扣,如20.0代表2折。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Discount *float64 `json:"Discount,omitnil,omitempty" name:"Discount"` +} + +// Predefined struct for user +type ModifyGatewayLoadBalancerAttributeRequestParams struct { + // 网关负载均衡的唯一ID。 + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // 网关负载均衡实例名称。可支持输入1-60个字符。 + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // 是否开启删除保护。 + DeleteProtect *bool `json:"DeleteProtect,omitnil,omitempty" name:"DeleteProtect"` +} + +type ModifyGatewayLoadBalancerAttributeRequest struct { + *tchttp.BaseRequest + + // 网关负载均衡的唯一ID。 + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // 网关负载均衡实例名称。可支持输入1-60个字符。 + LoadBalancerName *string `json:"LoadBalancerName,omitnil,omitempty" name:"LoadBalancerName"` + + // 是否开启删除保护。 + DeleteProtect *bool `json:"DeleteProtect,omitnil,omitempty" name:"DeleteProtect"` +} + +func (r *ModifyGatewayLoadBalancerAttributeRequest) 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 *ModifyGatewayLoadBalancerAttributeRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "LoadBalancerId") + delete(f, "LoadBalancerName") + delete(f, "DeleteProtect") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyGatewayLoadBalancerAttributeRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyGatewayLoadBalancerAttributeResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyGatewayLoadBalancerAttributeResponse struct { + *tchttp.BaseResponse + Response *ModifyGatewayLoadBalancerAttributeResponseParams `json:"Response"` +} + +func (r *ModifyGatewayLoadBalancerAttributeResponse) 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 *ModifyGatewayLoadBalancerAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupAttributeRequestParams struct { + // 目标组的ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 目标组的新名称。 + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // 健康检查详情。 + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // 是否支持全死全活。 + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +type ModifyTargetGroupAttributeRequest struct { + *tchttp.BaseRequest + + // 目标组的ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 目标组的新名称。 + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // 健康检查详情。 + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // 是否支持全死全活。 + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` +} + +func (r *ModifyTargetGroupAttributeRequest) 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 *ModifyTargetGroupAttributeRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupName") + delete(f, "HealthCheck") + delete(f, "AllDeadToAlive") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyTargetGroupAttributeRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupAttributeResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyTargetGroupAttributeResponse struct { + *tchttp.BaseResponse + Response *ModifyTargetGroupAttributeResponseParams `json:"Response"` +} + +func (r *ModifyTargetGroupAttributeResponse) 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 *ModifyTargetGroupAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupInstancesWeightRequestParams struct { + // 目标组ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 实例绑定配置数组。 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +type ModifyTargetGroupInstancesWeightRequest struct { + *tchttp.BaseRequest + + // 目标组ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 实例绑定配置数组。 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +func (r *ModifyTargetGroupInstancesWeightRequest) 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 *ModifyTargetGroupInstancesWeightRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstances") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyTargetGroupInstancesWeightRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyTargetGroupInstancesWeightResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyTargetGroupInstancesWeightResponse struct { + *tchttp.BaseResponse + Response *ModifyTargetGroupInstancesWeightResponseParams `json:"Response"` +} + +func (r *ModifyTargetGroupInstancesWeightResponse) 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 *ModifyTargetGroupInstancesWeightResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type Price struct { + // 描述了实例价格。 + // 注意:此字段可能返回 null,表示取不到有效值。 + InstancePrice *ItemPrice `json:"InstancePrice,omitnil,omitempty" name:"InstancePrice"` + + // 描述了GLCU的价格。 + // 注意:此字段可能返回 null,表示取不到有效值。 + LcuPrice *ItemPrice `json:"LcuPrice,omitnil,omitempty" name:"LcuPrice"` +} + +// Predefined struct for user +type RegisterTargetGroupInstancesRequestParams struct { + // 目标组ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 服务器实例数组 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +type RegisterTargetGroupInstancesRequest struct { + *tchttp.BaseRequest + + // 目标组ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 服务器实例数组 + TargetGroupInstances []*TargetGroupInstance `json:"TargetGroupInstances,omitnil,omitempty" name:"TargetGroupInstances"` +} + +func (r *RegisterTargetGroupInstancesRequest) 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 *RegisterTargetGroupInstancesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "TargetGroupId") + delete(f, "TargetGroupInstances") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "RegisterTargetGroupInstancesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type RegisterTargetGroupInstancesResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type RegisterTargetGroupInstancesResponse struct { + *tchttp.BaseResponse + Response *RegisterTargetGroupInstancesResponseParams `json:"Response"` +} + +func (r *RegisterTargetGroupInstancesResponse) 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 *RegisterTargetGroupInstancesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type TagInfo struct { + // 标签的键 + TagKey *string `json:"TagKey,omitnil,omitempty" name:"TagKey"` + + // 标签的值 + TagValue *string `json:"TagValue,omitnil,omitempty" name:"TagValue"` +} + +type TargetGroupAssociation struct { + // 网关负载均衡实例ID。 + LoadBalancerId *string `json:"LoadBalancerId,omitnil,omitempty" name:"LoadBalancerId"` + + // 目标组ID。 + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` +} + +type TargetGroupBackend struct { + // 目标组ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 后端服务的类型,可取:CVM、ENI + Type *string `json:"Type,omitnil,omitempty" name:"Type"` + + // 后端服务的唯一 ID + InstanceId *string `json:"InstanceId,omitnil,omitempty" name:"InstanceId"` + + // 后端服务的监听端口 + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // 后端服务的转发权重,取值为0或16 + Weight *uint64 `json:"Weight,omitnil,omitempty" name:"Weight"` + + // 后端服务的外网 IP + // 注意:此字段可能返回 null,表示取不到有效值。 + PublicIpAddresses []*string `json:"PublicIpAddresses,omitnil,omitempty" name:"PublicIpAddresses"` + + // 后端服务的内网 IP + // 注意:此字段可能返回 null,表示取不到有效值。 + PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitnil,omitempty" name:"PrivateIpAddresses"` + + // 后端服务的实例名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + InstanceName *string `json:"InstanceName,omitnil,omitempty" name:"InstanceName"` + + // 后端服务被绑定的时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + RegisteredTime *string `json:"RegisteredTime,omitnil,omitempty" name:"RegisteredTime"` + + // 弹性网卡唯一ID + // 注意:此字段可能返回 null,表示取不到有效值。 + EniId *string `json:"EniId,omitnil,omitempty" name:"EniId"` + + // 后端服务的可用区ID + // 注意:此字段可能返回 null,表示取不到有效值。 + ZoneId *uint64 `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` +} + +type TargetGroupHealthCheck struct { + // 是否开启健康检查。 + HealthSwitch *bool `json:"HealthSwitch,omitnil,omitempty" name:"HealthSwitch"` + + // 健康检查使用的协议。支持PING和TCP两种方式,默认为PING。 + // + // - icmp: 使用PING的方式进行健康检查 + // - tcp: 使用TCP连接的方式进行健康检查 + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // 健康检查端口,探测协议为tcp时,该参数必填。 + Port *int64 `json:"Port,omitnil,omitempty" name:"Port"` + + // 健康检查超时时间。 默认为2秒。 可配置范围:2 - 30秒。 + Timeout *int64 `json:"Timeout,omitnil,omitempty" name:"Timeout"` + + // 检测间隔时间。 默认为5秒。 可配置范围:2 - 300秒。 + IntervalTime *int64 `json:"IntervalTime,omitnil,omitempty" name:"IntervalTime"` + + // 检测健康阈值。 默认为3秒。 可配置范围:2 - 10次。 + HealthNum *int64 `json:"HealthNum,omitnil,omitempty" name:"HealthNum"` + + // 检测不健康阈值。 默认为3秒。 可配置范围:2 - 10次。 + UnHealthNum *int64 `json:"UnHealthNum,omitnil,omitempty" name:"UnHealthNum"` +} + +type TargetGroupInfo struct { + // 目标组ID + TargetGroupId *string `json:"TargetGroupId,omitnil,omitempty" name:"TargetGroupId"` + + // 目标组的vpcid + VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"` + + // 目标组的名字 + TargetGroupName *string `json:"TargetGroupName,omitnil,omitempty" name:"TargetGroupName"` + + // 目标组的默认端口 + // 注意:此字段可能返回 null,表示取不到有效值。 + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // 目标组的创建时间 + CreatedTime *string `json:"CreatedTime,omitnil,omitempty" name:"CreatedTime"` + + // 目标组的修改时间 + UpdatedTime *string `json:"UpdatedTime,omitnil,omitempty" name:"UpdatedTime"` + + // 关联到的规则数组。在DescribeTargetGroupList接口调用时无法获取到该参数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AssociatedRule []*AssociationItem `json:"AssociatedRule,omitnil,omitempty" name:"AssociatedRule"` + + // 网关负载均衡目标组协议。 + // - tencent_geneve :GENEVE 标准协议 + // - aws_geneve:GENEVE 兼容协议 + // 注意:此字段可能返回 null,表示取不到有效值。 + Protocol *string `json:"Protocol,omitnil,omitempty" name:"Protocol"` + + // 均衡算法。 + // - ip_hash_3_elastic:弹性哈希 + // 注意:此字段可能返回 null,表示取不到有效值。 + ScheduleAlgorithm *string `json:"ScheduleAlgorithm,omitnil,omitempty" name:"ScheduleAlgorithm"` + + // 健康检查详情。 + // 注意:此字段可能返回 null,表示取不到有效值。 + HealthCheck *TargetGroupHealthCheck `json:"HealthCheck,omitnil,omitempty" name:"HealthCheck"` + + // 是否支持全死全活。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AllDeadToAlive *bool `json:"AllDeadToAlive,omitnil,omitempty" name:"AllDeadToAlive"` + + // 目标组已关联的规则数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AssociatedRuleCount *int64 `json:"AssociatedRuleCount,omitnil,omitempty" name:"AssociatedRuleCount"` + + // 目标组内的实例数量。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RegisteredInstancesCount *int64 `json:"RegisteredInstancesCount,omitnil,omitempty" name:"RegisteredInstancesCount"` +} + +type TargetGroupInstance struct { + // 目标组实例的内网IP。 + BindIP *string `json:"BindIP,omitnil,omitempty" name:"BindIP"` + + // 目标组实例的端口,只支持6081。 + Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` + + // 目标组实例的权重,只支持0或16,非0统一按16处理。 + Weight *uint64 `json:"Weight,omitnil,omitempty" name:"Weight"` +} + +type TargetGroupInstanceStatus struct { + // 后端rs的IP + InstanceIp *string `json:"InstanceIp,omitnil,omitempty" name:"InstanceIp"` + + // 健康检查状态,参数值及含义如下: + // ● on:表示探测中。 + // ● off:表示健康检查关闭。 + // ● health:表示健康。 + // ● unhealth:表示异常。 + Status *string `json:"Status,omitnil,omitempty" name:"Status"` +} \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index 84a57c2bbe..f82a487ca8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1095,6 +1095,7 @@ github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/json github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/profile github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/regions github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/cvm/v20170312 +github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/gwlb/v20240906 github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/mdl/v20200326 github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/privatedns/v20201028 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/antiddos v1.0.799 @@ -1166,7 +1167,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1078 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1133 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1134 ## explicit; go 1.11 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors @@ -1228,6 +1229,9 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es/v20180416 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.970 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap/v20180529 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb v1.0.1127 +## explicit; go 1.14 +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gwlb/v20240906 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms/v20190118 diff --git a/website/docs/r/gwlb_instance.html.markdown b/website/docs/r/gwlb_instance.html.markdown new file mode 100644 index 0000000000..97fd7fb4a9 --- /dev/null +++ b/website/docs/r/gwlb_instance.html.markdown @@ -0,0 +1,83 @@ +--- +subcategory: "Gateway Load Balancer(GWLB)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_gwlb_instance" +sidebar_current: "docs-tencentcloud-resource-gwlb_instance" +description: |- + Provides a resource to create a gwlb gwlb_instance +--- + +# tencentcloud_gwlb_instance + +Provides a resource to create a gwlb gwlb_instance + +## Example Usage + +```hcl +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `subnet_id` - (Required, String) Subnet ID of the VPC to which the backend target device of the GWLB belongs. +* `vpc_id` - (Required, String) ID of the VPC to which the backend target device of the GWLB belongs, such as vpc-12345678. It can be obtained through the DescribeVpcEx interface. If left blank, it defaults to DefaultVPC. This parameter is required when a private network CLB instance is created. +* `lb_charge_type` - (Optional, String) GWLB instance billing type, which currently supports POSTPAID_BY_HOUR only. The default is POSTPAID_BY_HOUR. +* `load_balancer_name` - (Optional, String) GWLB instance name. It supports input of 1 to 60 characters. If not filled in, it will be generated automatically by default. +* `tags` - (Optional, List) While the GWLB is purchased, it is tagged, with a maximum of 20 tag key-value pairs. + +The `tags` object supports the following: + +* `tag_key` - (Required, String) Tag key. +* `tag_value` - (Required, String) Tag value. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `create_time` - Create time. +* `delete_protect` - Whether to turn on the deletion protection function. +* `isolated_time` - Time when the Gateway Load Balancer instance was isolated. +* `isolation` - 0: means not quarantined, 1: means quarantined. +* `operate_protect` - Whether to enable the configuration modification protection function. +* `status` - Gateway Load Balancer instance status. 0: Creating, 1: Running normally, 3: Removing. +* `target_group_id` - Unique ID of the associated target group. +* `vips` - Gateway Load Balancer provides virtual IP services. + + +## Import + +gwlb gwlb_instance can be imported using the id, e.g. + +``` +terraform import tencentcloud_gwlb_instance.gwlb_instance gwlb_instance_id +``` + diff --git a/website/docs/r/gwlb_instance_associate_target_groups.html.markdown b/website/docs/r/gwlb_instance_associate_target_groups.html.markdown new file mode 100644 index 0000000000..9fcbc98e1d --- /dev/null +++ b/website/docs/r/gwlb_instance_associate_target_groups.html.markdown @@ -0,0 +1,80 @@ +--- +subcategory: "Gateway Load Balancer(GWLB)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_gwlb_instance_associate_target_groups" +sidebar_current: "docs-tencentcloud-resource-gwlb_instance_associate_target_groups" +description: |- + Provides a resource to create a gwlb gwlb_instance_associate_target_groups +--- + +# tencentcloud_gwlb_instance_associate_target_groups + +Provides a resource to create a gwlb gwlb_instance_associate_target_groups + +## Example Usage + +```hcl +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} + +resource "tencentcloud_gwlb_instance_associate_target_groups" "gwlb_instance_associate_target_groups" { + load_balancer_id = tencentcloud_gwlb_instance.gwlb_instance.id + target_group_id = tencentcloud_gwlb_target_group.gwlb_target_group.id +} +``` + +## Argument Reference + +The following arguments are supported: + +* `load_balancer_id` - (Required, String, ForceNew) GWLB instance ID. +* `target_group_id` - (Required, String, ForceNew) Target group ID. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + diff --git a/website/docs/r/gwlb_target_group.html.markdown b/website/docs/r/gwlb_target_group.html.markdown new file mode 100644 index 0000000000..37795e1b8a --- /dev/null +++ b/website/docs/r/gwlb_target_group.html.markdown @@ -0,0 +1,83 @@ +--- +subcategory: "Gateway Load Balancer(GWLB)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_gwlb_target_group" +sidebar_current: "docs-tencentcloud-resource-gwlb_target_group" +description: |- + Provides a resource to create a gwlb gwlb_target_group +--- + +# tencentcloud_gwlb_target_group + +Provides a resource to create a gwlb gwlb_target_group + +## Example Usage + +```hcl +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `all_dead_to_alive` - (Optional, Bool) Whether "All Dead, All Alive" is supported. It is supported by default. +* `health_check` - (Optional, List) Health check settings. +* `port` - (Optional, Int) Default port of the target group, which can be used when servers are added later. Either 'Port' or 'TargetGroupInstances.N.port' must be filled in. +* `protocol` - (Optional, String) GWLB target group protocol. + - TENCENT_GENEVE: GENEVE standard protocol; + - AWS_GENEVE: GENEVE compatibility protocol (a ticket is required for allowlisting). +* `schedule_algorithm` - (Optional, String) Load balancing algorithm. + - IP_HASH_3_ELASTIC: elastic hashing. +* `target_group_name` - (Optional, String) Target group name, limited to 60 characters. +* `vpc_id` - (Optional, String) VPCID attribute of target group. If this parameter is left blank, the default VPC will be used. + +The `health_check` object supports the following: + +* `health_switch` - (Required, Bool) Whether to enable the health check. +* `health_num` - (Optional, Int) Health detection threshold. The default is 3 times. Value range: 2-10 times. +* `interval_time` - (Optional, Int) Detection interval time. The default is 5 seconds. Value range: 2-300 seconds. +* `port` - (Optional, Int) Health check port, which is required when the probe protocol is TCP. +* `protocol` - (Optional, String) Protocol used for health check, which supports PING and TCP and is PING by default. + - PING: icmp; + - TCP: tcp. +* `timeout` - (Optional, Int) Health check timeout. The default is 2 seconds. Value range: 2-30 seconds. +* `un_health_num` - (Optional, Int) Unhealth detection threshold. The default is 3 times. Value range: 2-10 times. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `target_group_instances` - Real server bound to a target group. + * `bind_ip` - Private network IP of target group instance. + * `port` - Port of target group instance. Only 6081 is supported. + * `weight` - Weight of target group instance. Only 0 or 16 is supported, and non-0 is uniformly treated as 16. + + +## Import + +gwlb gwlb_target_group can be imported using the id, e.g. + +``` +terraform import tencentcloud_gwlb_target_group.gwlb_target_group gwlb_target_group_id +``` + diff --git a/website/docs/r/gwlb_target_group_register_instances.html.markdown b/website/docs/r/gwlb_target_group_register_instances.html.markdown new file mode 100644 index 0000000000..e32e55fdea --- /dev/null +++ b/website/docs/r/gwlb_target_group_register_instances.html.markdown @@ -0,0 +1,118 @@ +--- +subcategory: "Gateway Load Balancer(GWLB)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_gwlb_target_group_register_instances" +sidebar_current: "docs-tencentcloud-resource-gwlb_target_group_register_instances" +description: |- + Provides a resource to create a gwlb gwlb_target_group_register_instances +--- + +# tencentcloud_gwlb_target_group_register_instances + +Provides a resource to create a gwlb gwlb_target_group_register_instances + +## Example Usage + +```hcl +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = var.availability_zone + name = "subnet" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.20.0/28" + is_multicast = false +} + +resource "tencentcloud_gwlb_instance" "gwlb_instance" { + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + load_balancer_name = "tf-test" + lb_charge_type = "POSTPAID_BY_HOUR" + tags { + tag_key = "test_key" + tag_value = "tag_value" + } +} + +resource "tencentcloud_gwlb_target_group" "gwlb_target_group" { + target_group_name = "tf-test" + vpc_id = tencentcloud_vpc.vpc.id + port = 6081 + health_check { + health_switch = true + protocol = "tcp" + port = 6081 + timeout = 2 + interval_time = 5 + health_num = 3 + un_health_num = 3 + } +} + +resource "tencentcloud_instance" "foo" { + system_disk_type = "CLOUD_PREMIUM" + instance_name = "tf-test" + image_id = data.tencentcloud_images.default.images.0.image_id + instance_type = "S5.MEDIUM2" + system_disk_size = 100 + subnet_id = tencentcloud_subnet.subnet.id + vpc_id = tencentcloud_vpc.vpc.id + hostname = "tf-test" + disable_security_service = true + allocate_public_ip = true + internet_max_bandwidth_out = 5 + availability_zone = var.availability_zone +} + +data "tencentcloud_images" "default" { + image_type = ["PUBLIC_IMAGE"] + image_name_regex = "Final" +} + +resource "tencentcloud_gwlb_target_group_register_instances" "gwlb_target_group_register_instances" { + target_group_id = tencentcloud_gwlb_target_group.gwlb_target_group.id + target_group_instances { + bind_ip = tencentcloud_instance.foo.private_ip + port = 6081 + weight = 0 + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `target_group_id` - (Required, String, ForceNew) Target group ID. +* `target_group_instances` - (Required, Set) Server instance array. + +The `target_group_instances` object supports the following: + +* `bind_ip` - (Required, String) Private network IP of target group instance. +* `port` - (Optional, Int) Port of target group instance. Only 6081 is supported. +* `weight` - (Optional, Int) Weight of target group instance. Only 0 or 16 is supported, and non-0 is uniformly treated as 16. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +gwlb gwlb_target_group_register_instances can be imported using the id, e.g. + +``` +terraform import tencentcloud_gwlb_target_group_register_instances.gwlb_target_group_register_instances gwlb_target_group_register_instances_id +``` + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index bdcde75bb2..a1031f68bd 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -2645,6 +2645,29 @@ +
  • + Gateway Load Balancer(GWLB) + +
  • Global Application Acceleration(GAAP)