From 827bc24e4cd73b1c40b2c9f32b52be7db5232f1b Mon Sep 17 00:00:00 2001 From: Kagashino Date: Wed, 6 Apr 2022 15:56:23 +0800 Subject: [PATCH] feat: tke_cluster - support cluster level settings --- go.mod | 4 +- go.sum | 4 + tencentcloud/basic_test.go | 12 +- tencentcloud/resource_tc_eni_test.go | 2 +- .../resource_tc_kubernetes_cluster.go | 29 +- .../resource_tc_kubernetes_cluster_test.go | 178 +++++++++- tencentcloud/service_tencentcloud_tke.go | 73 +++- .../tencentcloud/common/http/request.go | 2 +- .../tencentcloud/tke/v20180525/client.go | 224 +++++++++++++ .../tencentcloud/tke/v20180525/models.go | 311 +++++++++++++++++- vendor/modules.txt | 4 +- .../docs/r/kubernetes_cluster.html.markdown | 4 +- 12 files changed, 815 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index 94df9a3d52..40766e6c90 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.283 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.291 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.376 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.378 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.351 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.359 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dayu v1.0.335 @@ -54,7 +54,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr v1.0.267 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.268 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.370 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.378 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.357 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss v1.0.199 diff --git a/go.sum b/go.sum index 3632e4dfd4..eb4c7df281 100644 --- a/go.sum +++ b/go.sum @@ -511,6 +511,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.370 h1:FlmN github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.370/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.376 h1:pXsCDParuAiDUt/SuDBeJ0Fv90kItYMbk37W1cMVHck= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.376/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.378 h1:o+GKr3tHDivmoWxBXX5oeJC8EmmNV64g/yw5s0RjBdg= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.378/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.199 h1:ajgJogYSIQ5u1PIbiV5nsvr5K0fYpm1/T7Dy+mxEM6U= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.199/go.mod h1:AqyM/ZZMD7q5mHBqNY9YImbSpEpoEe7E/vrTbUWX+po= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.351 h1:zqJsH5pxGT57La7NAOOyMQxsuM11pupNBwV1dzXcT24= @@ -578,6 +580,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.369 h1:bp9vCew github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.369/go.mod h1:HlPCDRZ3zUnEXifuTNbCiEOwKn/2LmA6ziPkCr3VHsk= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.370 h1:rzExiYuyKD9JhRAyQzoECLz8RRyT0bNgLxmDjPQxTRg= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.370/go.mod h1:qs+mOMyRpnBtCNHBl70LMH826P1kbYDIjgX2+p5nqMg= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.378 h1:gVtRJRENcLw2LxA06oS0OOOeRADStVrrpIyKjlrmkW4= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.378/go.mod h1:3fugxjsjhR7P3HeVRsUCMIM2P7KnIvqnPhcsImS7zN0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199 h1:6Yt74l4pA5QtzhwMNIEUt0spXdSBKH744DDqTHJOCP0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199/go.mod h1:Yw6OQ33z3s4k0HVYTNSffB12qOzEJ2Zf1Vj4+5S3sRs= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.199 h1:UDZ59pvaqjDy2QIsMsv9hxm0BEJLmPIbHF1ms0MqaRk= diff --git a/tencentcloud/basic_test.go b/tencentcloud/basic_test.go index 7501079111..830ebf9067 100644 --- a/tencentcloud/basic_test.go +++ b/tencentcloud/basic_test.go @@ -3,6 +3,7 @@ package tencentcloud import ( "os" "regexp" + "time" ) /* @@ -22,6 +23,15 @@ const ( var persistResource = regexp.MustCompile("^(keep|Default)") +// Check if resource should persist instead of recycled +func isResourcePersist(name string, createdTime *time.Time) bool { + createdWithin30Minutes := false + if createdTime != nil { + createdWithin30Minutes = createdTime.Add(time.Minute * 30).After(time.Now()) + } + return persistResource.MatchString(name) || createdWithin30Minutes +} + // vpn const defaultVpnDataSource = ` data "tencentcloud_vpn_gateways" "foo" { @@ -75,7 +85,7 @@ const ( tkeExclusiveVpcName = "keep_tke_exclusive_vpc" tkeExclusiveSubnetId = "subnet-ljyn7h30" defaultTkeClusterId = "cls-ely08ic4" - defaultTkeClusterName = "preset_tke_cluster" + defaultTkeClusterName = "keep-tke-cluster" ) /* diff --git a/tencentcloud/resource_tc_eni_test.go b/tencentcloud/resource_tc_eni_test.go index 7ad11ad3c9..3f3a1f04f4 100644 --- a/tencentcloud/resource_tc_eni_test.go +++ b/tencentcloud/resource_tc_eni_test.go @@ -34,7 +34,7 @@ func testSweepEniInstance(region string) error { client: client.apiV3Conn, } - instances, err := vpcService.DescribeEniByFilters(ctx, nil, nil, nil, nil, nil, nil,nil,nil) + instances, err := vpcService.DescribeEniByFilters(ctx, nil, nil, nil, nil, nil, nil, nil, nil) if err != nil { return fmt.Errorf("get instance list error: %s", err.Error()) } diff --git a/tencentcloud/resource_tc_kubernetes_cluster.go b/tencentcloud/resource_tc_kubernetes_cluster.go index 70113febd8..46f98e48ee 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/resource_tc_kubernetes_cluster.go @@ -893,7 +893,17 @@ func resourceTencentCloudTkeCluster() *schema.Resource { ForceNew: true, Optional: true, Default: false, - Description: "Indicates whether to enable cluster node auto scaler. Default is false.", + Description: "Indicates whether to enable cluster node auto scaling. Default is false.", + }, + "cluster_level": { + Type: schema.TypeString, + Optional: true, + Description: "Specify cluster level, valid for managed cluster.", + }, + "auto_upgrade_cluster_level": { + Type: schema.TypeBool, + Optional: true, + Description: "Whether the cluster level auto upgraded, valid for managed cluster.", }, "node_pool_global_config": { Type: schema.TypeList, @@ -1781,6 +1791,14 @@ func resourceTencentCloudTkeClusterCreate(d *schema.ResourceData, meta interface basic.ClusterDescription = v.(string) } + if v, ok := d.GetOk("cluster_level"); ok { + basic.ClusterLevel = v.(string) + } + + if v, ok := d.GetOk("auto_upgrade_cluster_level"); ok { + basic.AutoUpgradeClusterLevel = v.(bool) + } + advanced.Ipvs = d.Get("cluster_ipvs").(bool) advanced.AsEnabled = d.Get("cluster_as_enabled").(bool) advanced.ContainerRuntime = d.Get("container_runtime").(string) @@ -2623,16 +2641,15 @@ func resourceTencentCloudTkeClusterUpdate(d *schema.ResourceData, meta interface d.SetPartial("managed_cluster_internet_security_policies") } - if d.HasChange("project_id") || d.HasChange("cluster_name") || d.HasChange("cluster_desc") { + if d.HasChange("project_id") || d.HasChange("cluster_name") || d.HasChange("cluster_desc") || d.HasChange("cluster_level") || d.HasChange("auto_upgrade_cluster_level") { projectId := int64(d.Get("project_id").(int)) clusterName := d.Get("cluster_name").(string) clusterDesc := d.Get("cluster_desc").(string) - if err := tkeService.ModifyClusterAttribute(ctx, id, projectId, clusterName, clusterDesc); err != nil { + clusterLevel := d.Get("cluster_level").(string) + autoUpgradeClusterLevel := d.Get("auto_upgrade_cluster_level").(bool) + if err := tkeService.ModifyClusterAttribute(ctx, id, projectId, clusterName, clusterDesc, clusterLevel, autoUpgradeClusterLevel); err != nil { return err } - d.SetPartial("project_id") - d.SetPartial("cluster_name") - d.SetPartial("cluster_desc") } //upgrade k8s cluster version diff --git a/tencentcloud/resource_tc_kubernetes_cluster_test.go b/tencentcloud/resource_tc_kubernetes_cluster_test.go index 6222690de6..a035385f43 100644 --- a/tencentcloud/resource_tc_kubernetes_cluster_test.go +++ b/tencentcloud/resource_tc_kubernetes_cluster_test.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "testing" + "time" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" @@ -13,6 +14,38 @@ import ( var testTkeClusterName = "tencentcloud_kubernetes_cluster" var testTkeClusterResourceKey = testTkeClusterName + ".managed_cluster" +func init() { + // go test -v ./tencentcloud -sweep=ap-guangzhou -sweep-run=tencentcloud_kubernetes_cluster + resource.AddTestSweepers("tencentcloud_kubernetes_cluster", &resource.Sweeper{ + Name: "tencentcloud_kubernetes_cluster", + F: func(r string) error { + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + cli, _ := sharedClientForRegion(r) + client := cli.(*TencentCloudClient).apiV3Conn + service := TkeService{client: client} + clusters, err := service.DescribeClusters(ctx, "", "") + if err != nil { + return err + } + + for _, v := range clusters { + id := v.ClusterId + name := v.ClusterName + createdTime, _ := time.Parse(time.RFC3339, v.CreatedTime) + if isResourcePersist(name, &createdTime) { + continue + } + if err := service.DeleteCluster(ctx, id); err != nil { + return err + } + } + + return nil + }, + }) +} + func TestAccTencentCloudTkeResource(t *testing.T) { t.Parallel() resource.Test(t, resource.TestCase{ @@ -53,6 +86,38 @@ func TestAccTencentCloudTkeResource(t *testing.T) { }) } +func TestAccTencentCloudTkeResourceClusterLevel(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckTkeDestroy, + Steps: []resource.TestStep{ + { + Config: testAccTkeClusterLevel, + Check: resource.ComposeTestCheckFunc( + testAccCheckTkeExists(testTkeClusterResourceKey), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "cluster_cidr", "10.31.0.0/16"), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "cluster_max_pod_num", "32"), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "cluster_name", "test"), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "cluster_level", "L5"), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "auto_upgrade_cluster_level", "true"), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "worker_instances_list.#", "1"), + resource.TestCheckResourceAttrSet(testTkeClusterResourceKey, "worker_instances_list.0.instance_id"), + ), + }, + { + Config: testAccTkeClusterLevelUpdate, + Check: resource.ComposeTestCheckFunc( + testAccCheckTkeExists(testTkeClusterResourceKey), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "cluster_level", "L20"), + resource.TestCheckResourceAttr(testTkeClusterResourceKey, "auto_upgrade_cluster_level", "false"), + ), + }, + }, + }) +} + func testAccCheckTkeDestroy(s *terraform.State) error { logId := getLogId(contextNil) ctx := context.WithValue(context.TODO(), logIdKey, logId) @@ -154,7 +219,7 @@ data "tencentcloud_vpc_subnets" "vpc" { } resource "tencentcloud_kubernetes_cluster" "managed_cluster" { - vpc_id = "vpc-rkojp4kn" + vpc_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.vpc_id cluster_cidr = var.cluster_cidr cluster_max_pod_num = 32 cluster_name = "test" @@ -173,8 +238,8 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" internet_max_bandwidth_out = 100 public_ip_assigned = true - subnet_id = "subnet-fmcdf57e" - img_id = "img-rkiynh11" + subnet_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id + img_id = "`+defaultTkeOSImageId+`" data_disk { disk_type = "CLOUD_PREMIUM" @@ -189,7 +254,6 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { enhanced_monitor_service = false user_data = "dGVzdA==" password = "ZZXXccvv1212" - cam_role_name = "TKE_TEST" } cluster_deploy_type = "MANAGED_CLUSTER" @@ -211,3 +275,109 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { `, key, value, ) } + +const testAccTkeClusterLevel = ` +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +variable "cluster_cidr" { + default = "10.31.0.0/16" +} + +variable "default_instance_type" { + default = "S1.SMALL1" +} + +data "tencentcloud_vpc_subnets" "vpc" { + is_default = true + availability_zone = var.availability_zone +} + +resource "tencentcloud_kubernetes_cluster" "managed_cluster" { + vpc_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.vpc_id + cluster_cidr = var.cluster_cidr + cluster_max_pod_num = 32 + cluster_name = "test" + cluster_desc = "test cluster desc" + cluster_max_service_num = 32 + cluster_version = "1.18.4" + cluster_os = "tlinux2.2(tkernel3)x86_64" + cluster_level = "L5" + auto_upgrade_cluster_level = true + worker_config { + count = 1 + availability_zone = var.availability_zone + instance_type = var.default_instance_type + system_disk_type = "CLOUD_SSD" + system_disk_size = 60 + internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" + internet_max_bandwidth_out = 100 + public_ip_assigned = true + subnet_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id + img_id = "` + defaultTkeOSImageId + `" + + enhanced_security_service = false + enhanced_monitor_service = false + user_data = "dGVzdA==" + password = "ZZXXccvv1212" + } + + cluster_deploy_type = "MANAGED_CLUSTER" + + unschedulable = 0 +} +` + +const testAccTkeClusterLevelUpdate = ` +variable "availability_zone" { + default = "ap-guangzhou-3" +} + +variable "cluster_cidr" { + default = "10.31.0.0/16" +} + +variable "default_instance_type" { + default = "S1.SMALL1" +} + +data "tencentcloud_vpc_subnets" "vpc" { + is_default = true + availability_zone = var.availability_zone +} + +resource "tencentcloud_kubernetes_cluster" "managed_cluster" { + vpc_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.vpc_id + cluster_cidr = var.cluster_cidr + cluster_max_pod_num = 32 + cluster_name = "test" + cluster_desc = "test cluster desc" + cluster_max_service_num = 32 + cluster_version = "1.18.4" + cluster_os = "tlinux2.2(tkernel3)x86_64" + cluster_level = "L20" + auto_upgrade_cluster_level = false + worker_config { + count = 1 + availability_zone = var.availability_zone + instance_type = var.default_instance_type + system_disk_type = "CLOUD_SSD" + system_disk_size = 60 + internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" + internet_max_bandwidth_out = 100 + public_ip_assigned = true + subnet_id = data.tencentcloud_vpc_subnets.vpc.instance_list.0.subnet_id + img_id = "` + defaultTkeOSImageId + `" + + enhanced_security_service = false + enhanced_monitor_service = false + user_data = "dGVzdA==" + password = "ZZXXccvv1212" + } + + cluster_deploy_type = "MANAGED_CLUSTER" + + unschedulable = 0 +} +` diff --git a/tencentcloud/service_tencentcloud_tke.go b/tencentcloud/service_tencentcloud_tke.go index 8f4953ab56..6b368661b5 100644 --- a/tencentcloud/service_tencentcloud_tke.go +++ b/tencentcloud/service_tencentcloud_tke.go @@ -17,17 +17,19 @@ import ( ) type ClusterBasicSetting struct { - ClusterId string - ClusterOs string - ClusterOsType string - ClusterVersion string - ClusterName string - ClusterDescription string - VpcId string - ProjectId int64 - ClusterNodeNum int64 - ClusterStatus string - Tags map[string]string + ClusterId string + ClusterOs string + ClusterOsType string + ClusterVersion string + ClusterName string + ClusterDescription string + ClusterLevel string + AutoUpgradeClusterLevel bool + VpcId string + ProjectId int64 + ClusterNodeNum int64 + ClusterStatus string + Tags map[string]string } type ClusterAdvancedSettings struct { @@ -82,7 +84,8 @@ type ClusterInfo struct { ClusterCidrSettings ClusterAdvancedSettings - DeployType string + DeployType string + CreatedTime string } type InstanceInfo struct { @@ -232,6 +235,7 @@ func (me *TkeService) DescribeClusters(ctx context.Context, id string, name stri clusterInfo.MaxNodePodNum = int64(*cluster.ClusterNetworkSettings.MaxNodePodNum) clusterInfo.DeployType = strings.ToUpper(*cluster.ClusterType) clusterInfo.Ipvs = *cluster.ClusterNetworkSettings.Ipvs + clusterInfo.CreatedTime = *cluster.CreatedTime if len(cluster.TagSpecification) > 0 { clusterInfo.Tags = make(map[string]string) @@ -306,6 +310,33 @@ func (me *TkeService) DescribeCluster(ctx context.Context, id string) ( return } +func (me *TkeService) DescribeClusterLevelAttribute(ctx context.Context, id string) (clusterLevels []*tke.ClusterLevelAttribute, errRet error) { + logId := getLogId(ctx) + request := tke.NewDescribeClusterLevelAttributeRequest() + 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.ClusterID = &id + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTkeClient().DescribeClusterLevelAttribute(request) + + if err != nil { + errRet = err + return + } + + clusterLevels = response.Response.Items + + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + func (me *TkeService) DescribeClusterConfig(ctx context.Context, id string) (config string, errRet error) { logId := getLogId(ctx) @@ -422,6 +453,12 @@ func (me *TkeService) CreateCluster(ctx context.Context, request.ClusterBasicSettings.ClusterDescription = &basic.ClusterDescription request.ClusterBasicSettings.ClusterName = &basic.ClusterName request.ClusterBasicSettings.OsCustomizeType = &basic.ClusterOsType + request.ClusterBasicSettings.ClusterLevel = &basic.ClusterLevel + if &basic.AutoUpgradeClusterLevel != nil { + request.ClusterBasicSettings.AutoUpgradeClusterLevel = &tke.AutoUpgradeClusterLevel{ + IsAutoUpgrade: &basic.AutoUpgradeClusterLevel, + } + } for k, v := range tags { if len(request.ClusterBasicSettings.TagSpecification) == 0 { request.ClusterBasicSettings.TagSpecification = []*tke.TagSpecification{{ @@ -904,7 +941,7 @@ func (me *TkeService) ModifyClusterEndpointSP(ctx context.Context, id string, se return } -func (me *TkeService) ModifyClusterAttribute(ctx context.Context, id string, projectId int64, clusterName string, clusterDesc string) (errRet error) { +func (me *TkeService) ModifyClusterAttribute(ctx context.Context, id string, projectId int64, clusterName, clusterDesc, clusterLevel string, autoUpgradeClusterLevel bool) (errRet error) { logId := getLogId(ctx) request := tke.NewModifyClusterAttributeRequest() defer func() { @@ -917,6 +954,16 @@ func (me *TkeService) ModifyClusterAttribute(ctx context.Context, id string, pro request.ClusterName = &clusterName request.ClusterDesc = &clusterDesc + if clusterLevel != "" { + request.ClusterLevel = &clusterLevel + } + + if autoUpgradeClusterLevel { + request.AutoUpgradeClusterLevel = &tke.AutoUpgradeClusterLevel{ + IsAutoUpgrade: &autoUpgradeClusterLevel, + } + } + ratelimit.Check(request.GetAction()) _, err := me.client.UseTkeClient().ModifyClusterAttribute(request) 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 21ad145d74..ed16f98e8c 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 @@ -240,7 +240,7 @@ func CompleteCommonParams(request Request, region 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.376" + params["RequestClient"] = "SDK_GO_1.0.378" } func ConstructParams(req Request) (err error) { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go index 71ff8f9e98..f85c737d3e 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go @@ -74,6 +74,7 @@ func NewAcquireClusterAdminRoleResponse() (response *AcquireClusterAdminRoleResp // INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" // RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" // UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" @@ -94,6 +95,7 @@ func (c *Client) AcquireClusterAdminRole(request *AcquireClusterAdminRoleRequest // INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" // RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" // UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" @@ -2426,6 +2428,7 @@ func NewDescribeAvailableClusterVersionResponse() (response *DescribeAvailableCl // INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" func (c *Client) DescribeAvailableClusterVersion(request *DescribeAvailableClusterVersionRequest) (response *DescribeAvailableClusterVersionResponse, err error) { return c.DescribeAvailableClusterVersionWithContext(context.Background(), request) @@ -2440,6 +2443,7 @@ func (c *Client) DescribeAvailableClusterVersion(request *DescribeAvailableClust // INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" func (c *Client) DescribeAvailableClusterVersionWithContext(ctx context.Context, request *DescribeAvailableClusterVersionRequest) (response *DescribeAvailableClusterVersionResponse, err error) { if request == nil { @@ -2675,6 +2679,7 @@ func NewDescribeClusterCommonNamesResponse() (response *DescribeClusterCommonNam // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" +// RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" // UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" // UNSUPPORTEDOPERATION_NOTINWHITELIST = "UnsupportedOperation.NotInWhitelist" func (c *Client) DescribeClusterCommonNames(request *DescribeClusterCommonNamesRequest) (response *DescribeClusterCommonNamesResponse, err error) { @@ -2691,6 +2696,7 @@ func (c *Client) DescribeClusterCommonNames(request *DescribeClusterCommonNamesR // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" +// RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" // UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" // UNSUPPORTEDOPERATION_NOTINWHITELIST = "UnsupportedOperation.NotInWhitelist" func (c *Client) DescribeClusterCommonNamesWithContext(ctx context.Context, request *DescribeClusterCommonNamesRequest) (response *DescribeClusterCommonNamesResponse, err error) { @@ -3032,6 +3038,7 @@ func NewDescribeClusterKubeconfigResponse() (response *DescribeClusterKubeconfig // 可能返回的错误码: // INTERNALERROR = "InternalError" // INTERNALERROR_CAMNOAUTH = "InternalError.CamNoAuth" +// INTERNALERROR_COMPONENTCLIENTHTTP = "InternalError.ComponentClientHttp" // INTERNALERROR_DB = "InternalError.Db" // INTERNALERROR_KUBECLIENTCONNECTION = "InternalError.KubeClientConnection" // INTERNALERROR_KUBERNETESCLIENTBUILDERROR = "InternalError.KubernetesClientBuildError" @@ -3042,6 +3049,7 @@ func NewDescribeClusterKubeconfigResponse() (response *DescribeClusterKubeconfig // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_CLUSTERNOTFOUND = "InvalidParameter.ClusterNotFound" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" // RESOURCENOTFOUND_KUBERNETESRESOURCENOTFOUND = "ResourceNotFound.KubernetesResourceNotFound" // UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" @@ -3055,6 +3063,7 @@ func (c *Client) DescribeClusterKubeconfig(request *DescribeClusterKubeconfigReq // 可能返回的错误码: // INTERNALERROR = "InternalError" // INTERNALERROR_CAMNOAUTH = "InternalError.CamNoAuth" +// INTERNALERROR_COMPONENTCLIENTHTTP = "InternalError.ComponentClientHttp" // INTERNALERROR_DB = "InternalError.Db" // INTERNALERROR_KUBECLIENTCONNECTION = "InternalError.KubeClientConnection" // INTERNALERROR_KUBERNETESCLIENTBUILDERROR = "InternalError.KubernetesClientBuildError" @@ -3065,6 +3074,7 @@ func (c *Client) DescribeClusterKubeconfig(request *DescribeClusterKubeconfigReq // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETER_CLUSTERNOTFOUND = "InvalidParameter.ClusterNotFound" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" // RESOURCENOTFOUND_CLUSTERNOTFOUND = "ResourceNotFound.ClusterNotFound" // RESOURCENOTFOUND_KUBERNETESRESOURCENOTFOUND = "ResourceNotFound.KubernetesResourceNotFound" // UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" @@ -3084,6 +3094,104 @@ func (c *Client) DescribeClusterKubeconfigWithContext(ctx context.Context, reque return } +func NewDescribeClusterLevelAttributeRequest() (request *DescribeClusterLevelAttributeRequest) { + request = &DescribeClusterLevelAttributeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tke", APIVersion, "DescribeClusterLevelAttribute") + + + return +} + +func NewDescribeClusterLevelAttributeResponse() (response *DescribeClusterLevelAttributeResponse) { + response = &DescribeClusterLevelAttributeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeClusterLevelAttribute +// 获取集群规模 +// +// 可能返回的错误码: +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +func (c *Client) DescribeClusterLevelAttribute(request *DescribeClusterLevelAttributeRequest) (response *DescribeClusterLevelAttributeResponse, err error) { + return c.DescribeClusterLevelAttributeWithContext(context.Background(), request) +} + +// DescribeClusterLevelAttribute +// 获取集群规模 +// +// 可能返回的错误码: +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +func (c *Client) DescribeClusterLevelAttributeWithContext(ctx context.Context, request *DescribeClusterLevelAttributeRequest) (response *DescribeClusterLevelAttributeResponse, err error) { + if request == nil { + request = NewDescribeClusterLevelAttributeRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeClusterLevelAttribute require credential") + } + + request.SetContext(ctx) + + response = NewDescribeClusterLevelAttributeResponse() + err = c.Send(request, response) + return +} + +func NewDescribeClusterLevelChangeRecordsRequest() (request *DescribeClusterLevelChangeRecordsRequest) { + request = &DescribeClusterLevelChangeRecordsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tke", APIVersion, "DescribeClusterLevelChangeRecords") + + + return +} + +func NewDescribeClusterLevelChangeRecordsResponse() (response *DescribeClusterLevelChangeRecordsResponse) { + response = &DescribeClusterLevelChangeRecordsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeClusterLevelChangeRecords +// 查询集群变配记录 +// +// 可能返回的错误码: +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +func (c *Client) DescribeClusterLevelChangeRecords(request *DescribeClusterLevelChangeRecordsRequest) (response *DescribeClusterLevelChangeRecordsResponse, err error) { + return c.DescribeClusterLevelChangeRecordsWithContext(context.Background(), request) +} + +// DescribeClusterLevelChangeRecords +// 查询集群变配记录 +// +// 可能返回的错误码: +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +func (c *Client) DescribeClusterLevelChangeRecordsWithContext(ctx context.Context, request *DescribeClusterLevelChangeRecordsRequest) (response *DescribeClusterLevelChangeRecordsResponse, err error) { + if request == nil { + request = NewDescribeClusterLevelChangeRecordsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeClusterLevelChangeRecords require credential") + } + + request.SetContext(ctx) + + response = NewDescribeClusterLevelChangeRecordsResponse() + err = c.Send(request, response) + return +} + func NewDescribeClusterNodePoolDetailRequest() (request *DescribeClusterNodePoolDetailRequest) { request = &DescribeClusterNodePoolDetailRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -4201,6 +4309,7 @@ func NewDescribeImagesResponse() (response *DescribeImagesResponse) { // FAILEDOPERATION = "FailedOperation" // INTERNALERROR = "InternalError" // INTERNALERROR_CAMNOAUTH = "InternalError.CamNoAuth" +// INTERNALERROR_COMPONENTCLINETHTTP = "InternalError.ComponentClinetHttp" // INTERNALERROR_DB = "InternalError.Db" // INTERNALERROR_DBAFFECTIVEDROWS = "InternalError.DbAffectivedRows" // INTERNALERROR_DBRECORDNOTFOUND = "InternalError.DbRecordNotFound" @@ -4227,6 +4336,7 @@ func (c *Client) DescribeImages(request *DescribeImagesRequest) (response *Descr // FAILEDOPERATION = "FailedOperation" // INTERNALERROR = "InternalError" // INTERNALERROR_CAMNOAUTH = "InternalError.CamNoAuth" +// INTERNALERROR_COMPONENTCLINETHTTP = "InternalError.ComponentClinetHttp" // INTERNALERROR_DB = "InternalError.Db" // INTERNALERROR_DBAFFECTIVEDROWS = "InternalError.DbAffectivedRows" // INTERNALERROR_DBRECORDNOTFOUND = "InternalError.DbRecordNotFound" @@ -4842,6 +4952,63 @@ func (c *Client) DescribeRegionsWithContext(ctx context.Context, request *Descri return } +func NewDescribeResourceUsageRequest() (request *DescribeResourceUsageRequest) { + request = &DescribeResourceUsageRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tke", APIVersion, "DescribeResourceUsage") + + + return +} + +func NewDescribeResourceUsageResponse() (response *DescribeResourceUsageResponse) { + response = &DescribeResourceUsageResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeResourceUsage +// 获取集群资源使用量 +// +// 可能返回的错误码: +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_CLUSTERNOTFOUND = "InvalidParameter.ClusterNotFound" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" +func (c *Client) DescribeResourceUsage(request *DescribeResourceUsageRequest) (response *DescribeResourceUsageResponse, err error) { + return c.DescribeResourceUsageWithContext(context.Background(), request) +} + +// DescribeResourceUsage +// 获取集群资源使用量 +// +// 可能返回的错误码: +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_CLUSTERNOTFOUND = "InvalidParameter.ClusterNotFound" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" +func (c *Client) DescribeResourceUsageWithContext(ctx context.Context, request *DescribeResourceUsageRequest) (response *DescribeResourceUsageResponse, err error) { + if request == nil { + request = NewDescribeResourceUsageRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeResourceUsage require credential") + } + + request.SetContext(ctx) + + response = NewDescribeResourceUsageResponse() + err = c.Send(request, response) + return +} + func NewDescribeRouteTableConflictsRequest() (request *DescribeRouteTableConflictsRequest) { request = &DescribeRouteTableConflictsRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -5247,6 +5414,7 @@ func NewEnableClusterDeletionProtectionResponse() (response *EnableClusterDeleti // 可能返回的错误码: // INTERNALERROR_UNEXCEPTEDINTERNAL = "InternalError.UnexceptedInternal" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" func (c *Client) EnableClusterDeletionProtection(request *EnableClusterDeletionProtectionRequest) (response *EnableClusterDeletionProtectionResponse, err error) { return c.EnableClusterDeletionProtectionWithContext(context.Background(), request) } @@ -5257,6 +5425,7 @@ func (c *Client) EnableClusterDeletionProtection(request *EnableClusterDeletionP // 可能返回的错误码: // INTERNALERROR_UNEXCEPTEDINTERNAL = "InternalError.UnexceptedInternal" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" func (c *Client) EnableClusterDeletionProtectionWithContext(ctx context.Context, request *EnableClusterDeletionProtectionRequest) (response *EnableClusterDeletionProtectionResponse, err error) { if request == nil { request = NewEnableClusterDeletionProtectionRequest() @@ -5356,6 +5525,7 @@ func NewForwardApplicationRequestV3Response() (response *ForwardApplicationReque // RESOURCENOTFOUND = "ResourceNotFound" // RESOURCEUNAVAILABLE = "ResourceUnavailable" // UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" // UNKNOWNPARAMETER = "UnknownParameter" // UNSUPPORTEDOPERATION = "UnsupportedOperation" // UNSUPPORTEDOPERATION_NOTINWHITELIST = "UnsupportedOperation.NotInWhitelist" @@ -5378,6 +5548,7 @@ func (c *Client) ForwardApplicationRequestV3(request *ForwardApplicationRequestV // RESOURCENOTFOUND = "ResourceNotFound" // RESOURCEUNAVAILABLE = "ResourceUnavailable" // UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// UNAUTHORIZEDOPERATION_CAMNOAUTH = "UnauthorizedOperation.CamNoAuth" // UNKNOWNPARAMETER = "UnknownParameter" // UNSUPPORTEDOPERATION = "UnsupportedOperation" // UNSUPPORTEDOPERATION_NOTINWHITELIST = "UnsupportedOperation.NotInWhitelist" @@ -5397,6 +5568,53 @@ func (c *Client) ForwardApplicationRequestV3WithContext(ctx context.Context, req return } +func NewGetClusterLevelPriceRequest() (request *GetClusterLevelPriceRequest) { + request = &GetClusterLevelPriceRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("tke", APIVersion, "GetClusterLevelPrice") + + + return +} + +func NewGetClusterLevelPriceResponse() (response *GetClusterLevelPriceResponse) { + response = &GetClusterLevelPriceResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// GetClusterLevelPrice +// 获取集群规模价格 +// +// 可能返回的错误码: +// INTERNALERROR_TRADECOMMON = "InternalError.TradeCommon" +func (c *Client) GetClusterLevelPrice(request *GetClusterLevelPriceRequest) (response *GetClusterLevelPriceResponse, err error) { + return c.GetClusterLevelPriceWithContext(context.Background(), request) +} + +// GetClusterLevelPrice +// 获取集群规模价格 +// +// 可能返回的错误码: +// INTERNALERROR_TRADECOMMON = "InternalError.TradeCommon" +func (c *Client) GetClusterLevelPriceWithContext(ctx context.Context, request *GetClusterLevelPriceRequest) (response *GetClusterLevelPriceResponse, err error) { + if request == nil { + request = NewGetClusterLevelPriceRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("GetClusterLevelPrice require credential") + } + + request.SetContext(ctx) + + response = NewGetClusterLevelPriceResponse() + err = c.Send(request, response) + return +} + func NewGetMostSuitableImageCacheRequest() (request *GetMostSuitableImageCacheRequest) { request = &GetMostSuitableImageCacheRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -5741,11 +5959,13 @@ func NewModifyClusterAttributeResponse() (response *ModifyClusterAttributeRespon // INTERNALERROR_PARAM = "InternalError.Param" // INTERNALERROR_TRADECOMMON = "InternalError.TradeCommon" // INTERNALERROR_TRADEINSUFFICIENTBALANCE = "InternalError.TradeInsufficientBalance" +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" // MISSINGPARAMETER = "MissingParameter" // RESOURCEINUSE = "ResourceInUse" // RESOURCENOTFOUND = "ResourceNotFound" // RESOURCEUNAVAILABLE = "ResourceUnavailable" +// RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" func (c *Client) ModifyClusterAttribute(request *ModifyClusterAttributeRequest) (response *ModifyClusterAttributeResponse, err error) { return c.ModifyClusterAttributeWithContext(context.Background(), request) } @@ -5762,11 +5982,13 @@ func (c *Client) ModifyClusterAttribute(request *ModifyClusterAttributeRequest) // INTERNALERROR_PARAM = "InternalError.Param" // INTERNALERROR_TRADECOMMON = "InternalError.TradeCommon" // INTERNALERROR_TRADEINSUFFICIENTBALANCE = "InternalError.TradeInsufficientBalance" +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" // MISSINGPARAMETER = "MissingParameter" // RESOURCEINUSE = "ResourceInUse" // RESOURCENOTFOUND = "ResourceNotFound" // RESOURCEUNAVAILABLE = "ResourceUnavailable" +// RESOURCEUNAVAILABLE_CLUSTERSTATE = "ResourceUnavailable.ClusterState" func (c *Client) ModifyClusterAttributeWithContext(ctx context.Context, request *ModifyClusterAttributeRequest) (response *ModifyClusterAttributeResponse, err error) { if request == nil { request = NewModifyClusterAttributeRequest() @@ -5944,6 +6166,7 @@ func NewModifyClusterNodePoolResponse() (response *ModifyClusterNodePoolResponse // INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" // OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" // UNSUPPORTEDOPERATION_CAENABLEFAILED = "UnsupportedOperation.CaEnableFailed" func (c *Client) ModifyClusterNodePool(request *ModifyClusterNodePoolRequest) (response *ModifyClusterNodePoolResponse, err error) { return c.ModifyClusterNodePoolWithContext(context.Background(), request) @@ -5957,6 +6180,7 @@ func (c *Client) ModifyClusterNodePool(request *ModifyClusterNodePoolRequest) (r // INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" // INVALIDPARAMETER_PARAM = "InvalidParameter.Param" // OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" // UNSUPPORTEDOPERATION_CAENABLEFAILED = "UnsupportedOperation.CaEnableFailed" func (c *Client) ModifyClusterNodePoolWithContext(ctx context.Context, request *ModifyClusterNodePoolRequest) (response *ModifyClusterNodePoolResponse, err error) { if request == nil { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go index 3e6e803623..3fbe5ce686 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go @@ -786,6 +786,64 @@ type ClusterInternalLB struct { SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"` } +type ClusterLevelAttribute struct { + + // 集群等级 + Name *string `json:"Name,omitempty" name:"Name"` + + // 等级名称 + Alias *string `json:"Alias,omitempty" name:"Alias"` + + // 节点数量 + NodeCount *uint64 `json:"NodeCount,omitempty" name:"NodeCount"` + + // Pod数量 + PodCount *uint64 `json:"PodCount,omitempty" name:"PodCount"` + + // Configmap数量 + ConfigMapCount *uint64 `json:"ConfigMapCount,omitempty" name:"ConfigMapCount"` + + // CRD数量 + CRDCount *uint64 `json:"CRDCount,omitempty" name:"CRDCount"` + + // 是否启用 + Enable *bool `json:"Enable,omitempty" name:"Enable"` + + // 其他资源数量 + // 注意:此字段可能返回 null,表示取不到有效值。 + OtherCount *uint64 `json:"OtherCount,omitempty" name:"OtherCount"` +} + +type ClusterLevelChangeRecord struct { + + // 记录ID + ID *string `json:"ID,omitempty" name:"ID"` + + // 集群ID + ClusterID *string `json:"ClusterID,omitempty" name:"ClusterID"` + + // 变配状态:trading 发货中,upgrading 变配中,success 变配成功,failed 变配失败。 + Status *string `json:"Status,omitempty" name:"Status"` + + // 状态描述 + Message *string `json:"Message,omitempty" name:"Message"` + + // 变配前规模 + OldLevel *string `json:"OldLevel,omitempty" name:"OldLevel"` + + // 变配后规模 + NewLevel *string `json:"NewLevel,omitempty" name:"NewLevel"` + + // 变配触发类型:manual 手动,auto 自动 + TriggerType *string `json:"TriggerType,omitempty" name:"TriggerType"` + + // 开始时间 + StartedAt *string `json:"StartedAt,omitempty" name:"StartedAt"` + + // 结束时间 + EndedAt *string `json:"EndedAt,omitempty" name:"EndedAt"` +} + type ClusterNetworkSettings struct { // 用于分配集群容器和服务 IP 的 CIDR,不得与 VPC CIDR 冲突,也不得与同 VPC 内其他集群 CIDR 冲突 @@ -2080,7 +2138,7 @@ type DataDisk struct { // 注意:此字段可能返回 null,表示取不到有效值。 MountTarget *string `json:"MountTarget,omitempty" name:"MountTarget"` - // 挂载设备名或分区名 + // 挂载设备名或分区名,当且仅当添加已有节点时需要 // 注意:此字段可能返回 null,表示取不到有效值。 DiskPartition *string `json:"DiskPartition,omitempty" name:"DiskPartition"` } @@ -3369,6 +3427,126 @@ func (r *DescribeClusterKubeconfigResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeClusterLevelAttributeRequest struct { + *tchttp.BaseRequest + + // 集群ID,变配时使用 + ClusterID *string `json:"ClusterID,omitempty" name:"ClusterID"` +} + +func (r *DescribeClusterLevelAttributeRequest) 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 *DescribeClusterLevelAttributeRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterID") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeClusterLevelAttributeRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DescribeClusterLevelAttributeResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 集群规模 + Items []*ClusterLevelAttribute `json:"Items,omitempty" name:"Items"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeClusterLevelAttributeResponse) 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 *DescribeClusterLevelAttributeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeClusterLevelChangeRecordsRequest struct { + *tchttp.BaseRequest + + // 集群ID + ClusterID *string `json:"ClusterID,omitempty" name:"ClusterID"` + + // 开始时间 + StartAt *string `json:"StartAt,omitempty" name:"StartAt"` + + // 结束时间 + EndAt *string `json:"EndAt,omitempty" name:"EndAt"` + + // 偏移量,默认0 + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 最大输出条数,默认20 + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeClusterLevelChangeRecordsRequest) 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 *DescribeClusterLevelChangeRecordsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterID") + delete(f, "StartAt") + delete(f, "EndAt") + delete(f, "Offset") + delete(f, "Limit") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeClusterLevelChangeRecordsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DescribeClusterLevelChangeRecordsResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 集群规模 + Items []*ClusterLevelChangeRecord `json:"Items,omitempty" name:"Items"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeClusterLevelChangeRecordsResponse) 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 *DescribeClusterLevelChangeRecordsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeClusterNodePoolDetailRequest struct { *tchttp.BaseRequest @@ -5158,6 +5336,64 @@ func (r *DescribeRegionsResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeResourceUsageRequest struct { + *tchttp.BaseRequest + + // 集群ID + ClusterId *string `json:"ClusterId,omitempty" name:"ClusterId"` +} + +func (r *DescribeResourceUsageRequest) 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 *DescribeResourceUsageRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeResourceUsageRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DescribeResourceUsageResponse struct { + *tchttp.BaseResponse + Response *struct { + + // CRD使用量 + CRDUsage *ResourceUsage `json:"CRDUsage,omitempty" name:"CRDUsage"` + + // Pod使用量 + PodUsage *uint64 `json:"PodUsage,omitempty" name:"PodUsage"` + + // ConfigMap使用量 + ConfigMapUsage *uint64 `json:"ConfigMapUsage,omitempty" name:"ConfigMapUsage"` + + // 其他资源使用量 + OtherUsage *ResourceUsage `json:"OtherUsage,omitempty" name:"OtherUsage"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeResourceUsageResponse) 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 *DescribeResourceUsageResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeRouteTableConflictsRequest struct { *tchttp.BaseRequest @@ -6012,6 +6248,58 @@ func (r *ForwardApplicationRequestV3Response) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type GetClusterLevelPriceRequest struct { + *tchttp.BaseRequest + + // 集群规格,托管集群询价 + ClusterLevel *string `json:"ClusterLevel,omitempty" name:"ClusterLevel"` +} + +func (r *GetClusterLevelPriceRequest) 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 *GetClusterLevelPriceRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterLevel") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "GetClusterLevelPriceRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type GetClusterLevelPriceResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 询价结果,单位:分,打折后 + Cost *uint64 `json:"Cost,omitempty" name:"Cost"` + + // 询价结果,单位:分,折扣前 + TotalCost *uint64 `json:"TotalCost,omitempty" name:"TotalCost"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *GetClusterLevelPriceResponse) 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 *GetClusterLevelPriceResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type GetMostSuitableImageCacheRequest struct { *tchttp.BaseRequest @@ -7795,6 +8083,27 @@ type ResourceDeleteOption struct { DeleteMode *string `json:"DeleteMode,omitempty" name:"DeleteMode"` } +type ResourceUsage struct { + + // 资源类型 + Name *string `json:"Name,omitempty" name:"Name"` + + // 资源使用量 + Usage *uint64 `json:"Usage,omitempty" name:"Usage"` + + // 资源使用详情 + Details []*ResourceUsageDetail `json:"Details,omitempty" name:"Details"` +} + +type ResourceUsageDetail struct { + + // 资源名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 资源使用量 + Usage *uint64 `json:"Usage,omitempty" name:"Usage"` +} + type RestartEKSContainerInstancesRequest struct { *tchttp.BaseRequest diff --git a/vendor/modules.txt b/vendor/modules.txt index ef71f92fe8..9b72225999 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -555,7 +555,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.291 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.376 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.378 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http @@ -607,7 +607,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb/v20190823 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.268 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq/v20200217 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.370 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.378 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod/v20180717 diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index aa5862496b..f8ffc120de 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -412,9 +412,10 @@ The following arguments are supported: * `vpc_id` - (Required, ForceNew) Vpc Id of the cluster. * `auth_options` - (Optional) Specify cluster authentication configuration. Only available for managed cluster and `cluster_version` >= 1.20. +* `auto_upgrade_cluster_level` - (Optional) Whether the cluster level auto upgraded, valid for managed cluster. * `base_pod_num` - (Optional, ForceNew) The number of basic pods. valid when enable_customized_pod_cidr=true. * `claim_expired_seconds` - (Optional) Claim expired seconds to recycle ENI. This field can only set when field `network_type` is 'VPC-CNI'. `claim_expired_seconds` must greater or equal than 300 and less than 15768000. -* `cluster_as_enabled` - (Optional, ForceNew) Indicates whether to enable cluster node auto scaler. Default is false. +* `cluster_as_enabled` - (Optional, ForceNew) Indicates whether to enable cluster node auto scaling. Default is false. * `cluster_cidr` - (Optional, ForceNew) A network address block of the cluster. Different from vpc cidr and cidr of other clusters within this vpc. Must be in 10./192.168/172.[16-31] segments. * `cluster_deploy_type` - (Optional, ForceNew) Deployment type of the cluster, the available values include: 'MANAGED_CLUSTER' and 'INDEPENDENT_CLUSTER'. Default is 'MANAGED_CLUSTER'. * `cluster_desc` - (Optional) Description of the cluster. @@ -423,6 +424,7 @@ The following arguments are supported: * `cluster_intranet_subnet_id` - (Optional) Subnet id who can access this independent cluster, this field must and can only set when `cluster_intranet` is true. `cluster_intranet_subnet_id` can not modify once be set. * `cluster_intranet` - (Optional) Open intranet access or not. * `cluster_ipvs` - (Optional, ForceNew) Indicates whether `ipvs` is enabled. Default is true. False means `iptables` is enabled. +* `cluster_level` - (Optional) Specify cluster level, valid for managed cluster. * `cluster_max_pod_num` - (Optional, ForceNew) The maximum number of Pods per node in the cluster. Default is 256. The minimum value is 4. When its power unequal to 2, it will round upward to the closest power of 2. * `cluster_max_service_num` - (Optional, ForceNew) The maximum number of services in the cluster. Default is 256. The range is from 32 to 32768. When its power unequal to 2, it will round upward to the closest power of 2. * `cluster_name` - (Optional) Name of the cluster.