From 04dcb396ff2a58c6db7360e91f911daef43a82da Mon Sep 17 00:00:00 2001 From: Renzheng Wang Date: Thu, 25 Apr 2024 07:17:16 +0800 Subject: [PATCH] add label related resourcs and datasources (#166) --- CHANGELOG.md | 9 + go.mod | 2 +- go.sum | 6 +- ucloud/client.go | 2 + ucloud/config.go | 3 + ucloud/data_source_ucloud_label_resources.go | 119 + ...data_source_ucloud_label_resources_test.go | 69 + ucloud/data_source_ucloud_labels.go | 146 ++ ucloud/data_source_ucloud_labels_test.go | 62 + ucloud/provider.go | 4 + ucloud/resource_ucloud_baremetal_instance.go | 17 +- ucloud/resource_ucloud_label.go | 111 + ucloud/resource_ucloud_label_attachment.go | 120 + .../resource_ucloud_label_attachment_test.go | 64 + ucloud/resource_ucloud_label_test.go | 68 + ucloud/service_ucloud_label.go | 82 + .../ucloud-sdk-go/services/label/apis.go | 532 +++++ .../ucloud-sdk-go/services/label/client.go | 22 + .../ucloud-sdk-go/services/label/doc.go | 13 + .../ucloud-sdk-go/services/label/models.go | 93 + .../ucloud-sdk-go/services/uaccount/apis.go | 94 - .../ucloud/ucloud-sdk-go/services/udb/apis.go | 366 ++- .../ucloud-sdk-go/services/udb/models.go | 99 +- .../ucloud-sdk-go/services/ufile/apis.go | 6 + .../ucloud-sdk-go/services/ufile/models.go | 42 +- .../ucloud-sdk-go/services/uhost/apis.go | 104 +- .../ucloud-sdk-go/services/uhost/models.go | 196 +- .../ucloud-sdk-go/services/uk8s/apis.go | 18 +- .../ucloud-sdk-go/services/uk8s/models.go | 42 +- .../ucloud/ucloud-sdk-go/services/ulb/apis.go | 1978 ++++++++++++++--- .../ucloud-sdk-go/services/ulb/models.go | 624 +++++- .../ucloud-sdk-go/services/umem/apis.go | 23 +- .../ucloud-sdk-go/services/unet/models.go | 30 +- .../ucloud-sdk-go/services/uphost/apis.go | 21 +- .../ucloud-sdk-go/services/uphost/models.go | 207 +- .../ucloud-sdk-go/services/vpc/models.go | 54 +- .../ucloud-sdk-go/ucloud/version/version.go | 2 +- vendor/modules.txt | 3 +- website/allowed-subcategories.txt | 1 + website/docs/d/label_resources.markdown | 40 + website/docs/d/labels.markdown | 38 + website/docs/r/label.html.markdown | 27 + website/docs/r/label_attachment.html.markdown | 51 + 43 files changed, 4824 insertions(+), 786 deletions(-) create mode 100644 ucloud/data_source_ucloud_label_resources.go create mode 100644 ucloud/data_source_ucloud_label_resources_test.go create mode 100644 ucloud/data_source_ucloud_labels.go create mode 100644 ucloud/data_source_ucloud_labels_test.go create mode 100644 ucloud/resource_ucloud_label.go create mode 100644 ucloud/resource_ucloud_label_attachment.go create mode 100644 ucloud/resource_ucloud_label_attachment_test.go create mode 100644 ucloud/resource_ucloud_label_test.go create mode 100644 ucloud/service_ucloud_label.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/label/apis.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/label/client.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/label/doc.go create mode 100644 vendor/github.com/ucloud/ucloud-sdk-go/services/label/models.go create mode 100644 website/docs/d/label_resources.markdown create mode 100644 website/docs/d/labels.markdown create mode 100644 website/docs/r/label.html.markdown create mode 100644 website/docs/r/label_attachment.html.markdown diff --git a/CHANGELOG.md b/CHANGELOG.md index 78ba7667..19701300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## v1.39.0 (2024-04-24) + +FEATURES: + +* **New Resource:** `ucloud_label`. +* **New Resource:** `ucloud_label_attachment`. +* **New Datasource:** `ucloud_labels`. +* **New Datasource:** `ucloud_label_resources`. + ## v1.38.8 (2024-03-16) FEATURES: diff --git a/go.mod b/go.mod index 82b1af13..d00a894d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/mitchellh/mapstructure v1.1.2 github.com/pkg/errors v0.8.0 github.com/tidwall/gjson v1.16.0 - github.com/ucloud/ucloud-sdk-go v0.22.5 + github.com/ucloud/ucloud-sdk-go v0.22.17 ) require ( diff --git a/go.sum b/go.sum index 314a6ca2..7fbd9cc0 100644 --- a/go.sum +++ b/go.sum @@ -181,8 +181,10 @@ github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/ucloud/ucloud-sdk-go v0.22.5 h1:GIltVwMDUqQj4iPL/emsZAMhEYWjLTwZqpOxdkdDrM8= -github.com/ucloud/ucloud-sdk-go v0.22.5/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= +github.com/ucloud/ucloud-sdk-go v0.22.15 h1:JzD4GhwwtdN+QfA6p+JQoOLDywW7dHkqrUgTSnAbNGA= +github.com/ucloud/ucloud-sdk-go v0.22.15/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= +github.com/ucloud/ucloud-sdk-go v0.22.17 h1:EFn+GxVKS5Tj8hIPie3qL6Zgk25fmWcHqJ06K8wl+Qo= +github.com/ucloud/ucloud-sdk-go v0.22.17/go.mod h1:dyLmFHmUfgb4RZKYQP9IArlvQ2pxzFthfhwxRzOEPIw= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= diff --git a/ucloud/client.go b/ucloud/client.go index 55b774f9..ca3dde78 100644 --- a/ucloud/client.go +++ b/ucloud/client.go @@ -8,6 +8,7 @@ import ( "github.com/ucloud/ucloud-sdk-go/services/uads" "github.com/ucloud/ucloud-sdk-go/services/iam" + "github.com/ucloud/ucloud-sdk-go/services/label" "github.com/ucloud/ucloud-sdk-go/services/udb" "github.com/ucloud/ucloud-sdk-go/services/udisk" "github.com/ucloud/ucloud-sdk-go/services/udpn" @@ -48,6 +49,7 @@ type UCloudClient struct { uk8sconn *uk8s.UK8SClient uadsconn *uads.UADSClient iamconn *iam.IAMClient + labelconn *label.LabelClient uphostconn *uphost.UPHostClient // private services pumemconn *pumem.UMemClient diff --git a/ucloud/config.go b/ucloud/config.go index 272948a9..4cde467d 100644 --- a/ucloud/config.go +++ b/ucloud/config.go @@ -10,6 +10,7 @@ import ( "time" "github.com/ucloud/ucloud-sdk-go/services/iam" + "github.com/ucloud/ucloud-sdk-go/services/label" "github.com/ucloud/ucloud-sdk-go/services/uads" "github.com/ucloud/ucloud-sdk-go/services/uphost" @@ -155,6 +156,7 @@ func (c *Config) Client() (*UCloudClient, error) { client.cubeconn = cube.NewClient(&cfg, &cred) client.uadsconn = uads.NewClient(&cfg, &cred) client.iamconn = iam.NewClient(&cfg, &cred) + client.labelconn = label.NewClient(&cfg, &cred) // initialize client connections for private usage client.pumemconn = pumem.NewClient(&cfg, &cred) @@ -185,6 +187,7 @@ func (c *Config) Client() (*UCloudClient, error) { client.uk8sconn.AddHttpRequestHandler(cloudShellCredHandler) client.uadsconn.AddHttpRequestHandler(cloudShellCredHandler) client.iamconn.AddHttpRequestHandler(cloudShellCredHandler) + client.labelconn.AddHttpRequestHandler(cloudShellCredHandler) client.uphostconn.AddHttpRequestHandler(cloudShellCredHandler) client.genericClient.AddHttpRequestHandler(cloudShellCredHandler) } diff --git a/ucloud/data_source_ucloud_label_resources.go b/ucloud/data_source_ucloud_label_resources.go new file mode 100644 index 00000000..9677374a --- /dev/null +++ b/ucloud/data_source_ucloud_label_resources.go @@ -0,0 +1,119 @@ +package ucloud + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/ucloud/ucloud-sdk-go/services/label" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +func dataSourceUCloudLabelResources() *schema.Resource { + return &schema.Resource{ + Read: dataSourceUCloudLabelResourcesRead, + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + }, + "resource_types": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "project_ids": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, + "resources": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "type": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceUCloudLabelResourcesRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*UCloudClient) + conn := client.labelconn + limit := 100 + offset := 0 + resourcesData := make([]map[string]interface{}, 0) + ids := make([]string, 0) + for { + listResourcesReq := conn.NewListResourcesByLabelsRequest() + listResourcesReq.ResourceTypes = interfaceSliceToStringSlice(d.Get("resource_types").([]interface{})) + listResourcesReq.ProjectIds = interfaceSliceToStringSlice(d.Get("project_ids").([]interface{})) + listResourcesReq.Limit = ucloud.Int(limit) + listResourcesReq.Offset = ucloud.Int(offset) + listResourcesReq.Labels = []label.ListResourcesByLabelsParamLabels{ + { + Key: ucloud.String(d.Get("key").(string)), + Value: ucloud.String(d.Get("value").(string)), + }, + } + listResourcesResp, err := conn.ListResourcesByLabels(listResourcesReq) + if err != nil { + return fmt.Errorf("error on reading resources list, %s", err) + } + + if len(listResourcesResp.Resources) < 1 { + break + } + for _, resource := range listResourcesResp.Resources { + ids = append(ids, resource.ResourceId) + resourcesData = append(resourcesData, map[string]interface{}{ + "id": resource.ResourceId, + "name": resource.ResourceName, + "type": resource.ResourceType, + }) + } + if len(listResourcesResp.Resources) < limit { + break + } + offset = offset + limit + } + d.SetId(hashStringArray(ids)) + d.Set("total_count", len(resourcesData)) + if err := d.Set("resources", resourcesData); err != nil { + return err + } + + if outputFile, ok := d.GetOk("output_file"); ok && outputFile.(string) != "" { + writeToFile(outputFile.(string), resourcesData) + } + return nil +} diff --git a/ucloud/data_source_ucloud_label_resources_test.go b/ucloud/data_source_ucloud_label_resources_test.go new file mode 100644 index 00000000..00473ea5 --- /dev/null +++ b/ucloud/data_source_ucloud_label_resources_test.go @@ -0,0 +1,69 @@ +package ucloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccUCloudLabelResourcesDataSource_basic(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataLabelResourcesConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckIDExists("data.ucloud_labels.foo"), + resource.TestCheckResourceAttr("data.ucloud_label_resources.foo", "resources.#", "1"), + resource.TestCheckResourceAttr("data.ucloud_label_resources.foo", "resources.0.name", "tf-acc-vip-basic"), + resource.TestCheckResourceAttr("data.ucloud_label_resources.foo", "resources.0.type", "vip"), + ), + }, + }, + }) +} + +const testAccDataLabelResourcesConfig = ` + +resource "ucloud_vpc" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_blocks = ["192.168.0.0/16"] +} +resource "ucloud_subnet" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_block = "192.168.1.0/24" + vpc_id = "${ucloud_vpc.foo.id}" +} +resource "ucloud_vip" "foo" { + vpc_id = "${ucloud_vpc.foo.id}" + subnet_id = "${ucloud_subnet.foo.id}" + name = "tf-acc-vip-basic" + remark = "test" + tag = "tf-acc" +} +resource "ucloud_label" "foo" { + key = "tf-acc-label-key" + value = "tf-acc-label-value" +} +resource "ucloud_label_attachment" "foo" { + key = "${ucloud_label.foo.key}" + value = "${ucloud_label.foo.value}" + resource = "${ucloud_vip.foo.id}" +} + +data "ucloud_labels" "foo" { + key_regex = "^${ucloud_label_attachment.foo.key}$" +} + +data "ucloud_label_resources" "foo" { + key = "${ucloud_label_attachment.foo.key}" + value = "${ucloud_label_attachment.foo.value}" + resource_types = ["vip"] + project_ids = ["${data.ucloud_labels.foo.labels.0.projects.0.id}"] +} +` diff --git a/ucloud/data_source_ucloud_labels.go b/ucloud/data_source_ucloud_labels.go new file mode 100644 index 00000000..b752c65c --- /dev/null +++ b/ucloud/data_source_ucloud_labels.go @@ -0,0 +1,146 @@ +package ucloud + +import ( + "fmt" + "regexp" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/ucloud/ucloud-sdk-go/services/label" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +func dataSourceUCloudLabels() *schema.Resource { + return &schema.Resource{ + Read: dataSourceUCloudLabelsRead, + Schema: map[string]*schema.Schema{ + "key_regex": { + Type: schema.TypeString, + Optional: true, + }, + "total_count": { + Type: schema.TypeInt, + Computed: true, + }, + "output_file": { + Type: schema.TypeString, + Optional: true, + }, + "labels": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Computed: true, + }, + "value": { + Type: schema.TypeString, + Computed: true, + }, + "projects": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "name": { + Type: schema.TypeString, + Computed: true, + }, + "resource_types": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "disabled_resource_types": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }}, + }, + }, + }, + }, + }, + } +} + +func dataSourceUCloudLabelsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*UCloudClient) + conn := client.labelconn + limit := 100 + offset := 0 + var labels []label.ListLabelsLabel + for { + listLabelsReq := conn.NewListLabelsRequest() + listLabelsReq.Category = ucloud.String(CustomLabelCategory) + listLabelsReq.Limit = ucloud.Int(limit) + listLabelsReq.Offset = ucloud.Int(offset) + listLabelsResp, err := conn.ListLabels(listLabelsReq) + if err != nil { + return fmt.Errorf("error on reading label list, %s", err) + } + + for _, item := range listLabelsResp.Labels { + if keyRegex, ok := d.GetOk("key_regex"); ok { + if matched, err := regexp.Match(keyRegex.(string), []byte(item.Key)); err != nil { + return fmt.Errorf("error on matching key regex, %s", err) + } else if !matched { + continue + } else { + labels = append(labels, item) + } + } else { + labels = append(labels, item) + } + } + if len(listLabelsResp.Labels) < limit { + break + } + offset += limit + } + labelsData := make([]map[string]interface{}, 0) + ids := make([]string, 0) + for _, item := range labels { + ids = append(ids, buildUCloudLabelID(item.Key, item.Value)) + listProjectsByLabels := conn.NewListProjectsByLabelsRequest() + listProjectsByLabels.Labels = []label.ListProjectsByLabelsParamLabels{{Key: &item.Key, Value: &item.Value}} + resp, err := conn.ListProjectsByLabels(listProjectsByLabels) + if err != nil { + return fmt.Errorf("error on listing projects by labels, %s", err) + } + projectsData := make([]map[string]interface{}, 0) + for _, project := range resp.Projects { + projectsData = append(projectsData, map[string]interface{}{ + "id": project.ProjectId, + "name": project.ProjectName, + "resource_types": project.ResourceTypes, + "disabled_resource_types": project.DisabledResourceTypes, + }) + } + + labelsData = append(labelsData, map[string]interface{}{ + "key": item.Key, + "value": item.Value, + "projects": projectsData, + }) + } + d.SetId(hashStringArray(ids)) + d.Set("total_count", len(labelsData)) + if err := d.Set("labels", labelsData); err != nil { + return err + } + + if outputFile, ok := d.GetOk("output_file"); ok && outputFile.(string) != "" { + writeToFile(outputFile.(string), labelsData) + } + return nil +} diff --git a/ucloud/data_source_ucloud_labels_test.go b/ucloud/data_source_ucloud_labels_test.go new file mode 100644 index 00000000..c387bb5f --- /dev/null +++ b/ucloud/data_source_ucloud_labels_test.go @@ -0,0 +1,62 @@ +package ucloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccUCloudLabelsDataSource_basic(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataLabelsConfig, + Check: resource.ComposeTestCheckFunc( + testAccCheckIDExists("data.ucloud_labels.foo"), + resource.TestCheckResourceAttr("data.ucloud_labels.foo", "labels.#", "1"), + resource.TestCheckResourceAttr("data.ucloud_labels.foo", "labels.0.key", "tf-acc-label-key"), + resource.TestCheckResourceAttr("data.ucloud_labels.foo", "labels.0.value", "tf-acc-label-value"), + resource.TestCheckResourceAttr("data.ucloud_labels.foo", "labels.0.projects.#", "1"), + ), + }, + }, + }) +} + +const testAccDataLabelsConfig = ` + +resource "ucloud_vpc" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_blocks = ["192.168.0.0/16"] +} +resource "ucloud_subnet" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_block = "192.168.1.0/24" + vpc_id = "${ucloud_vpc.foo.id}" +} +resource "ucloud_vip" "foo" { + vpc_id = "${ucloud_vpc.foo.id}" + subnet_id = "${ucloud_subnet.foo.id}" + name = "tf-acc-vip-basic" + remark = "test" + tag = "tf-acc" +} +resource "ucloud_label" "foo" { + key = "tf-acc-label-key" + value = "tf-acc-label-value" +} +resource "ucloud_label_attachment" "foo" { + key = "${ucloud_label.foo.key}" + value = "${ucloud_label.foo.value}" + resource = "${ucloud_vip.foo.id}" +} +data "ucloud_labels" "foo" { + key_regex = "${ucloud_label_attachment.foo.key}" +} +` diff --git a/ucloud/provider.go b/ucloud/provider.go index 6f3b09da..555f3665 100644 --- a/ucloud/provider.go +++ b/ucloud/provider.go @@ -112,6 +112,8 @@ func Provider() terraform.ResourceProvider { "ucloud_iam_policy": dataSourceUCloudIAMPolicy(), "ucloud_iam_policy_document": dataSourceUCloudIAMPolicyDocument(), "ucloud_baremetal_images": dataSourceUCloudBareMetalImages(), + "ucloud_labels": dataSourceUCloudLabels(), + "ucloud_label_resources": dataSourceUCloudLabelResources(), }, ResourcesMap: map[string]*schema.Resource{ @@ -160,6 +162,8 @@ func Provider() terraform.ResourceProvider { "ucloud_iam_group_policy_attachment": resourceUCloudIAMGroupPolicyAttachment(), "ucloud_instance_state": resourceUCloudInstanceState(), "ucloud_baremetal_instance": resourceUCloudBareMetalInstance(), + "ucloud_label": resourceUCloudLabel(), + "ucloud_label_attachment": resourceUCloudLabelAttachment(), }, ConfigureFunc: providerConfigure, } diff --git a/ucloud/resource_ucloud_baremetal_instance.go b/ucloud/resource_ucloud_baremetal_instance.go index 4d6977b7..f75d637d 100644 --- a/ucloud/resource_ucloud_baremetal_instance.go +++ b/ucloud/resource_ucloud_baremetal_instance.go @@ -4,11 +4,12 @@ import ( "encoding/base64" "errors" "fmt" - "github.com/ucloud/ucloud-sdk-go/ucloud/request" "regexp" "strconv" "time" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" @@ -262,11 +263,8 @@ func resourceUCloudBareMetalInstanceCreate(d *schema.ResourceData, meta interfac } for _, machineType := range localDiskTypesResp.MachineTypes { if machineType.Type == instanceType { - for _, cluster := range machineType.Clusters { - if cluster.StockStatus != "SoldOut" { - req.Cluster = ucloud.String(cluster.Name) - break - } + if machineType.StockStatus != "SoldOut" { + req.Cluster = ucloud.String(machineType.Cluster) } isLocalDiskInstance = true } @@ -282,11 +280,8 @@ func resourceUCloudBareMetalInstanceCreate(d *schema.ResourceData, meta interfac } for _, machineType := range cloudDiskTypesResp.MachineTypes { if machineType.Type == instanceType { - for _, cluster := range machineType.Clusters { - if cluster.StockStatus != "SoldOut" { - req.Cluster = ucloud.String(cluster.Name) - break - } + if machineType.StockStatus != "SoldOut" { + req.Cluster = ucloud.String(machineType.Cluster) } isCloudDiskInstance = true } diff --git a/ucloud/resource_ucloud_label.go b/ucloud/resource_ucloud_label.go new file mode 100644 index 00000000..8e540f33 --- /dev/null +++ b/ucloud/resource_ucloud_label.go @@ -0,0 +1,111 @@ +package ucloud + +import ( + "fmt" + "strings" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/ucloud/ucloud-sdk-go/services/label" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +func resourceUCloudLabel() *schema.Resource { + return &schema.Resource{ + Create: resourceUCloudLabelCreate, + Update: nil, + Read: resourceUCloudLabelRead, + Delete: resourceUCloudLabelDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceUCloudLabelCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*UCloudClient) + conn := client.labelconn + req := conn.NewCreateLabelsRequest() + key := d.Get("key").(string) + value := d.Get("value").(string) + label := label.CreateLabelsParamLabels{ + Key: &key, + Value: &value, + } + req.Labels = append(req.Labels, label) + _, err := conn.CreateLabels(req) + if err != nil { + return fmt.Errorf("error on creating label, %s", err) + } + d.SetId(buildUCloudLabelID(key, value)) + return resourceUCloudLabelRead(d, meta) +} +func resourceUCloudLabelRead(d *schema.ResourceData, meta interface{}) error { + key, value, err := parseUCloudLabelID(d.Id()) + if err != nil { + return fmt.Errorf("error on parsing label id, %s", err) + } + client := meta.(*UCloudClient) + label, err := client.describeLabel(key, value) + if err != nil { + return fmt.Errorf("error on describing label, %s", err) + } + d.Set("key", label.Key) + d.Set("value", label.Value) + return nil +} + +func resourceUCloudLabelDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*UCloudClient) + conn := client.labelconn + req := conn.NewDeleteLabelsRequest() + key := d.Get("key").(string) + value := d.Get("value").(string) + req.Labels = append(req.Labels, label.DeleteLabelsParamLabels{ + Key: ucloud.String(key), + Value: ucloud.String(value), + }) + + return resource.Retry(5*time.Minute, func() *resource.RetryError { + if _, err := conn.DeleteLabels(req); err != nil { + return resource.NonRetryableError(fmt.Errorf("error on deleting label %q, %s", d.Id(), err)) + } + + _, err := client.describeLabel(key, value) + if err != nil { + if isNotFoundError(err) { + return nil + } + return resource.NonRetryableError(fmt.Errorf("error on reading label when deleting %q, %s", d.Id(), err)) + } + + return resource.RetryableError(fmt.Errorf("the specified label %q has not been deleted due to unknown error", d.Id())) + }) +} + +const UCloudLabelIDSeperator = "#" + +func buildUCloudLabelID(key, value string) string { + return key + UCloudLabelIDSeperator + value +} + +func parseUCloudLabelID(id string) (string, string, error) { + items := strings.Split(id, UCloudLabelIDSeperator) + if len(items) != 2 { + return "", "", fmt.Errorf("invalid label id: %s", id) + } + return items[0], items[1], nil +} diff --git a/ucloud/resource_ucloud_label_attachment.go b/ucloud/resource_ucloud_label_attachment.go new file mode 100644 index 00000000..1f0fc187 --- /dev/null +++ b/ucloud/resource_ucloud_label_attachment.go @@ -0,0 +1,120 @@ +package ucloud + +import ( + "fmt" + "strings" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/ucloud/ucloud-sdk-go/services/label" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +func resourceUCloudLabelAttachment() *schema.Resource { + return &schema.Resource{ + Create: resourceUCloudLabelAttachmentCreate, + Update: nil, + Read: resourceUCloudLabelAttachmentRead, + Delete: resourceUCloudLabelAttachmentDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "resource": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceUCloudLabelAttachmentCreate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*UCloudClient) + conn := client.labelconn + req := conn.NewBindLabelsRequest() + key := d.Get("key").(string) + value := d.Get("value").(string) + resource := d.Get("resource").(string) + label := label.BindLabelsParamLabels{ + Key: &key, + Value: &value, + } + req.Labels = append(req.Labels, label) + req.ResourceIds = []string{resource} + _, err := conn.BindLabels(req) + if err != nil { + return fmt.Errorf("error on binding label, %s", err) + } + d.SetId(buildUCloudLabelAttachmentID(key, value, resource)) + return resourceUCloudLabelAttachmentRead(d, meta) +} +func resourceUCloudLabelAttachmentRead(d *schema.ResourceData, meta interface{}) error { + key, value, resource, err := parseUCloudLabelAttachmentID(d.Id()) + if err != nil { + return fmt.Errorf("error on parsing label id, %s", err) + } + client := meta.(*UCloudClient) + _, err = client.describeLabelAttachment(key, value, resource) + if err != nil { + return fmt.Errorf("error on describing label, %s", err) + } + d.Set("key", key) + d.Set("value", value) + d.Set("resource", resource) + return nil +} + +func resourceUCloudLabelAttachmentDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*UCloudClient) + conn := client.labelconn + req := conn.NewUnbindLabelsRequest() + key := d.Get("key").(string) + value := d.Get("value").(string) + req.Labels = append(req.Labels, label.UnbindLabelsParamLabels{ + Key: ucloud.String(key), + Value: ucloud.String(value), + }) + req.ResourceIds = []string{d.Get("resource").(string)} + + return resource.Retry(5*time.Minute, func() *resource.RetryError { + if _, err := conn.UnbindLabels(req); err != nil { + return resource.NonRetryableError(fmt.Errorf("error on unbind label %q, %s", d.Id(), err)) + } + + _, err := client.describeLabelAttachment(key, value, d.Get("resource").(string)) + if err != nil { + if isNotFoundError(err) { + return nil + } + return resource.NonRetryableError(fmt.Errorf("error on reading label when deleting %q, %s", d.Id(), err)) + } + + return resource.RetryableError(fmt.Errorf("the specified label attachment %q has not been deleted due to unknown error", d.Id())) + }) +} + +const UCloudLabelAttachmentIDSeperator = "#" + +func buildUCloudLabelAttachmentID(key, value, resourceId string) string { + return strings.Join([]string{key, value, resourceId}, UCloudLabelAttachmentIDSeperator) +} + +func parseUCloudLabelAttachmentID(id string) (key string, value string, resourceId string, err error) { + items := strings.Split(id, UCloudLabelAttachmentIDSeperator) + if len(items) != 3 { + return "", "", "", fmt.Errorf("invalid label attachment id: %s", id) + } + return items[0], items[1], items[2], nil +} diff --git a/ucloud/resource_ucloud_label_attachment_test.go b/ucloud/resource_ucloud_label_attachment_test.go new file mode 100644 index 00000000..13297c77 --- /dev/null +++ b/ucloud/resource_ucloud_label_attachment_test.go @@ -0,0 +1,64 @@ +package ucloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccUCloudLabelAttachment_basic(t *testing.T) { + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + + IDRefreshName: "ucloud_label_attachment.foo", + Providers: testAccProviders, + CheckDestroy: testAccCheckLabelDestroy, + + Steps: []resource.TestStep{ + { + Config: testAccLabelAttachmentConfig, + + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("ucloud_label.foo", "key", "tf-acc-label-key"), + resource.TestCheckResourceAttr("ucloud_label.foo", "value", "tf-acc-label-value"), + resource.TestCheckResourceAttr("ucloud_label_attachment.foo", "key", "tf-acc-label-key"), + resource.TestCheckResourceAttr("ucloud_label_attachment.foo", "value", "tf-acc-label-value"), + ), + }, + }, + }) +} + +const testAccLabelAttachmentConfig = ` +resource "ucloud_vpc" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_blocks = ["192.168.0.0/16"] +} +resource "ucloud_subnet" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_block = "192.168.1.0/24" + vpc_id = "${ucloud_vpc.foo.id}" +} +resource "ucloud_vip" "foo" { + vpc_id = "${ucloud_vpc.foo.id}" + subnet_id = "${ucloud_subnet.foo.id}" + name = "tf-acc-vip-basic-update" + remark = "test-update" + tag = "tf-acc" +} +resource "ucloud_label" "foo" { + key = "tf-acc-label-key" + value = "tf-acc-label-value" +} +resource "ucloud_label_attachment" "foo" { + key = "${ucloud_label.foo.key}" + value = "${ucloud_label.foo.value}" + resource = "${ucloud_vip.foo.id}" +} + +` diff --git a/ucloud/resource_ucloud_label_test.go b/ucloud/resource_ucloud_label_test.go new file mode 100644 index 00000000..dec29f9b --- /dev/null +++ b/ucloud/resource_ucloud_label_test.go @@ -0,0 +1,68 @@ +package ucloud + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" +) + +func TestAccUCloudLabel_basic(t *testing.T) { + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + + IDRefreshName: "ucloud_label.foo", + Providers: testAccProviders, + CheckDestroy: testAccCheckLabelDestroy, + + Steps: []resource.TestStep{ + { + Config: testAccLabelConfig, + + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("ucloud_label.foo", "key", "tf-acc-label-key"), + resource.TestCheckResourceAttr("ucloud_label.foo", "value", "tf-acc-label-value"), + ), + }, + }, + }) +} + +func testAccCheckLabelDestroy(s *terraform.State) error { + + for _, rs := range s.RootModule().Resources { + if rs.Type != "ucloud_label" { + continue + } + + client := testAccProvider.Meta().(*UCloudClient) + key, value, err := parseUCloudLabelID(rs.Primary.ID) + if err != nil { + return fmt.Errorf("fail to parse id: %v", rs.Primary.ID) + } + _, err = client.describeLabel(key, value) + + // Verify the error is what we want + if err != nil { + if isNotFoundError(err) { + continue + } + return err + } + + return fmt.Errorf("label still exist") + } + + return nil +} + +const testAccLabelConfig = ` +resource "ucloud_label" "foo" { + key = "tf-acc-label-key" + value = "tf-acc-label-value" +} +` diff --git a/ucloud/service_ucloud_label.go b/ucloud/service_ucloud_label.go new file mode 100644 index 00000000..11e54acc --- /dev/null +++ b/ucloud/service_ucloud_label.go @@ -0,0 +1,82 @@ +package ucloud + +import ( + "fmt" + + "github.com/ucloud/ucloud-sdk-go/services/label" + "github.com/ucloud/ucloud-sdk-go/ucloud" +) + +const CustomLabelCategory = "custom" + +func (client *UCloudClient) describeLabel(key, value string) (*label.ListLabelsLabel, error) { + conn := client.labelconn + + limit := 100 + offset := 0 + for { + req := conn.NewListLabelsRequest() + req.Category = ucloud.String(CustomLabelCategory) + resp, err := client.labelconn.ListLabels(req) + if err != nil { + return nil, err + } + if len(resp.Labels) < 1 { + break + } + for _, label := range resp.Labels { + if label.Key == key && label.Value == value { + return &label, nil + } + } + if len(resp.Labels) < limit { + break + } + offset = offset + limit + } + return nil, newNotFoundError(getNotFoundMessage("label", buildUCloudLabelID(key, value))) + +} + +func (client *UCloudClient) describeLabelAttachment(key, value, resource string) (*label.ListResourcesByLabelsResource, error) { + conn := client.labelconn + limit := 100 + offset := 0 + listProjectsReq := conn.NewListProjectsByLabelsRequest() + listProjectsReq.Labels = []label.ListProjectsByLabelsParamLabels{{Key: ucloud.String(key), Value: ucloud.String(value)}} + listProjectsResp, err := conn.ListProjectsByLabels(listProjectsReq) + if err != nil { + return nil, fmt.Errorf("error on listing projects by labels, %s", err) + } + projectIds := make([]string, 0) + resourceTypes := make([]string, 0) + for _, project := range listProjectsResp.Projects { + projectIds = append(projectIds, project.ProjectId) + resourceTypes = append(resourceTypes, project.ResourceTypes...) + } + if len(projectIds) > 0 && len(resourceTypes) > 0 { + for { + req := conn.NewListResourcesByLabelsRequest() + req.Limit = ucloud.Int(limit) + req.Offset = ucloud.Int(offset) + req.Labels = []label.ListResourcesByLabelsParamLabels{{Key: ucloud.String(key), Value: ucloud.String(value)}} + + req.ProjectIds = projectIds + req.ResourceTypes = resourceTypes + resp, err := conn.ListResourcesByLabels(req) + if err != nil { + return nil, fmt.Errorf("error on listing resources by labels, %s", err) + } + for _, resourceInfo := range resp.Resources { + if resourceInfo.ResourceId == resource { + return &resourceInfo, nil + } + } + if len(resp.Resources) < limit { + break + } + offset = offset + limit + } + } + return nil, newNotFoundError(getNotFoundMessage("label attachment", buildUCloudLabelAttachmentID(key, value, resource))) +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/label/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/apis.go new file mode 100644 index 00000000..b8718d3f --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/apis.go @@ -0,0 +1,532 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package label + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// Label API Schema + +/* +BindLabelsParamLabels is request schema for complex param +*/ +type BindLabelsParamLabels struct { + + // 标签键 + Key *string `required:"true"` + + // 标签值 + Value *string `required:"true"` +} + +// BindLabelsRequest is request schema for BindLabels action +type BindLabelsRequest struct { + request.CommonBase + + // + Labels []BindLabelsParamLabels `required:"false"` + + // 资源id数组 + ResourceIds []string `required:"true"` +} + +// BindLabelsResponse is response schema for BindLabels action +type BindLabelsResponse struct { + response.CommonBase +} + +// NewBindLabelsRequest will create request of BindLabels action. +func (c *LabelClient) NewBindLabelsRequest() *BindLabelsRequest { + req := &BindLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: BindLabels + +绑定标签 +*/ +func (c *LabelClient) BindLabels(req *BindLabelsRequest) (*BindLabelsResponse, error) { + var err error + var res BindLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("BindLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +/* +CreateLabelsParamLabels is request schema for complex param +*/ +type CreateLabelsParamLabels struct { + + // 标签键 + Key *string `required:"true"` + + // 标签值 + Value *string `required:"true"` +} + +// CreateLabelsRequest is request schema for CreateLabels action +type CreateLabelsRequest struct { + request.CommonBase + + // + Labels []CreateLabelsParamLabels `required:"false"` +} + +// CreateLabelsResponse is response schema for CreateLabels action +type CreateLabelsResponse struct { + response.CommonBase +} + +// NewCreateLabelsRequest will create request of CreateLabels action. +func (c *LabelClient) NewCreateLabelsRequest() *CreateLabelsRequest { + req := &CreateLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: CreateLabels + +创建标签 +*/ +func (c *LabelClient) CreateLabels(req *CreateLabelsRequest) (*CreateLabelsResponse, error) { + var err error + var res CreateLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +/* +DeleteLabelsParamLabels is request schema for complex param +*/ +type DeleteLabelsParamLabels struct { + + // 标签键 + Key *string `required:"true"` + + // 标签值 + Value *string `required:"true"` +} + +// DeleteLabelsRequest is request schema for DeleteLabels action +type DeleteLabelsRequest struct { + request.CommonBase + + // + Labels []DeleteLabelsParamLabels `required:"false"` +} + +// DeleteLabelsResponse is response schema for DeleteLabels action +type DeleteLabelsResponse struct { + response.CommonBase +} + +// NewDeleteLabelsRequest will create request of DeleteLabels action. +func (c *LabelClient) NewDeleteLabelsRequest() *DeleteLabelsRequest { + req := &DeleteLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DeleteLabels + +删除标签 +*/ +func (c *LabelClient) DeleteLabels(req *DeleteLabelsRequest) (*DeleteLabelsResponse, error) { + var err error + var res DeleteLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ListLabelsRequest is request schema for ListLabels action +type ListLabelsRequest struct { + request.CommonBase + + // 标签类型,system:系统标签;custom:自定义标签 + Category *string `required:"true"` + + // 返回数据长度,默认为10,最大100 + Limit *int `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` +} + +// ListLabelsResponse is response schema for ListLabels action +type ListLabelsResponse struct { + response.CommonBase + + // 标签数组 + Labels []ListLabelsLabel + + // 标签总数 + TotalCount int +} + +// NewListLabelsRequest will create request of ListLabels action. +func (c *LabelClient) NewListLabelsRequest() *ListLabelsRequest { + req := &ListLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListLabels + +标签列表 +*/ +func (c *LabelClient) ListLabels(req *ListLabelsRequest) (*ListLabelsResponse, error) { + var err error + var res ListLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ListLabelsByResourceIdsRequest is request schema for ListLabelsByResourceIds action +type ListLabelsByResourceIdsRequest struct { + request.CommonBase + + // 返回数据长度,默认为10,最大100 + Limit *int `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 资源id数组 + ResourceIds []string `required:"true"` +} + +// ListLabelsByResourceIdsResponse is response schema for ListLabelsByResourceIds action +type ListLabelsByResourceIdsResponse struct { + response.CommonBase + + // 资源标签数组 + Labels []ListLabelsByResourceIdsLabel + + // 资源标签总数 + TotalCount int +} + +// NewListLabelsByResourceIdsRequest will create request of ListLabelsByResourceIds action. +func (c *LabelClient) NewListLabelsByResourceIdsRequest() *ListLabelsByResourceIdsRequest { + req := &ListLabelsByResourceIdsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListLabelsByResourceIds + +根据资源ID获取标签列表 +*/ +func (c *LabelClient) ListLabelsByResourceIds(req *ListLabelsByResourceIdsRequest) (*ListLabelsByResourceIdsResponse, error) { + var err error + var res ListLabelsByResourceIdsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListLabelsByResourceIds", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +/* +ListProjectsByLabelsParamLabels is request schema for complex param +*/ +type ListProjectsByLabelsParamLabels struct { + + // 标签键 + Key *string `required:"true"` + + // 标签值 + Value *string `required:"true"` +} + +// ListProjectsByLabelsRequest is request schema for ListProjectsByLabels action +type ListProjectsByLabelsRequest struct { + request.CommonBase + + // + Labels []ListProjectsByLabelsParamLabels `required:"false"` +} + +// ListProjectsByLabelsResponse is response schema for ListProjectsByLabels action +type ListProjectsByLabelsResponse struct { + response.CommonBase + + // 项目列表 + Projects []ListProjectsByLabelsProject +} + +// NewListProjectsByLabelsRequest will create request of ListProjectsByLabels action. +func (c *LabelClient) NewListProjectsByLabelsRequest() *ListProjectsByLabelsRequest { + req := &ListProjectsByLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListProjectsByLabels + +根据标签获取项目列表 +*/ +func (c *LabelClient) ListProjectsByLabels(req *ListProjectsByLabelsRequest) (*ListProjectsByLabelsResponse, error) { + var err error + var res ListProjectsByLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListProjectsByLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +/* +ListResourcesByLabelsParamLabels is request schema for complex param +*/ +type ListResourcesByLabelsParamLabels struct { + + // 标签键 + Key *string `required:"false"` + + // 标签值 + Value *string `required:"false"` +} + +// ListResourcesByLabelsRequest is request schema for ListResourcesByLabels action +type ListResourcesByLabelsRequest struct { + request.CommonBase + + // + Labels []ListResourcesByLabelsParamLabels `required:"false"` + + // 返回数据长度,默认为10,最大100 + Limit *int `required:"false"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` + + // 项目id数组 + ProjectIds []string `required:"false"` + + // 资源类型数组 + ResourceTypes []string `required:"false"` +} + +// ListResourcesByLabelsResponse is response schema for ListResourcesByLabels action +type ListResourcesByLabelsResponse struct { + response.CommonBase + + // 资源列表 + Resources []ListResourcesByLabelsResource + + // 资源总数 + TotalCount int +} + +// NewListResourcesByLabelsRequest will create request of ListResourcesByLabels action. +func (c *LabelClient) NewListResourcesByLabelsRequest() *ListResourcesByLabelsRequest { + req := &ListResourcesByLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListResourcesByLabels + +根据标签获取资源列表 +*/ +func (c *LabelClient) ListResourcesByLabels(req *ListResourcesByLabelsRequest) (*ListResourcesByLabelsResponse, error) { + var err error + var res ListResourcesByLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListResourcesByLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ListResourcesTypesForLabelRequest is request schema for ListResourcesTypesForLabel action +type ListResourcesTypesForLabelRequest struct { + request.CommonBase +} + +// ListResourcesTypesForLabelResponse is response schema for ListResourcesTypesForLabel action +type ListResourcesTypesForLabelResponse struct { + response.CommonBase + + // 资源类型列表 + ResourceTypes []string + + // 总数 + TotalCount int +} + +// NewListResourcesTypesForLabelRequest will create request of ListResourcesTypesForLabel action. +func (c *LabelClient) NewListResourcesTypesForLabelRequest() *ListResourcesTypesForLabelRequest { + req := &ListResourcesTypesForLabelRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListResourcesTypesForLabel + +获取支持标签的资源类型 +*/ +func (c *LabelClient) ListResourcesTypesForLabel(req *ListResourcesTypesForLabelRequest) (*ListResourcesTypesForLabelResponse, error) { + var err error + var res ListResourcesTypesForLabelResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListResourcesTypesForLabel", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +/* +UnbindLabelsParamLabels is request schema for complex param +*/ +type UnbindLabelsParamLabels struct { + + // 标签键 + Key *string `required:"true"` + + // 标签值 + Value *string `required:"true"` +} + +// UnbindLabelsRequest is request schema for UnbindLabels action +type UnbindLabelsRequest struct { + request.CommonBase + + // + Labels []UnbindLabelsParamLabels `required:"false"` + + // 资源id数组 + ResourceIds []string `required:"true"` +} + +// UnbindLabelsResponse is response schema for UnbindLabels action +type UnbindLabelsResponse struct { + response.CommonBase +} + +// NewUnbindLabelsRequest will create request of UnbindLabels action. +func (c *LabelClient) NewUnbindLabelsRequest() *UnbindLabelsRequest { + req := &UnbindLabelsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UnbindLabels + +解绑标签 +*/ +func (c *LabelClient) UnbindLabels(req *UnbindLabelsRequest) (*UnbindLabelsResponse, error) { + var err error + var res UnbindLabelsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UnbindLabels", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/label/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/client.go new file mode 100644 index 00000000..617c1beb --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/client.go @@ -0,0 +1,22 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package label + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// LabelClient is the client of Label +type LabelClient struct { + *ucloud.Client +} + +// NewClient will return a instance of LabelClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *LabelClient { + meta := ucloud.ClientMeta{Product: "Label"} + client := ucloud.NewClientWithMeta(config, credential, meta) + return &LabelClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/label/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/doc.go new file mode 100644 index 00000000..2002bfcc --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/doc.go @@ -0,0 +1,13 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +/* +Package label include resources of ucloud label product + +See also + + - API: https://docs.ucloud.cn/api/label-api/index + - Product: https://www.ucloud.cn/site/product/label.html + +for detail. +*/ +package label diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/label/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/models.go new file mode 100644 index 00000000..f712aee9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/label/models.go @@ -0,0 +1,93 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package label + +/* +ListLabelsLabel - 标签 +*/ +type ListLabelsLabel struct { + + // 标签键 + Key string + + // 资源数量 + ResourceCount int + + // 标签值 + Value string +} + +/* +ListLabelsByResourceIdsLabel - 标签 +*/ +type ListLabelsByResourceIdsLabel struct { + + // 标签类型,system:系统标签;custom:自定义标签 + Category string + + // 标签键 + Key string + + // 资源id + ResourceId string + + // 标签值 + Value string +} + +/* +ListProjectsByLabelsProject - 项目 +*/ +type ListProjectsByLabelsProject struct { + + // 禁用的资源类型列表 + DisabledResourceTypes []string + + // 项目id + ProjectId string + + // 项目名称 + ProjectName string + + // 资源类型列表 + ResourceTypes []string +} + +/* +ListResourcesByLabelsLabel - 标签 +*/ +type ListResourcesByLabelsLabel struct { + + // 标签类型,system:系统标签;custom:自定义标签 + Category string + + // 标签键 + Key string + + // 标签值 + Value string +} + +/* +ListResourcesByLabelsResource - 资源标签绑定的资源信息 +*/ +type ListResourcesByLabelsResource struct { + + // 标签数组 + Labels []ListResourcesByLabelsLabel + + // 项目id + ProjectId string + + // 项目名称 + ProjectName string + + // 资源id + ResourceId string + + // 资源名称 + ResourceName string + + // 资源类型 + ResourceType string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/apis.go index d561d19f..990dcdee 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/apis.go @@ -9,56 +9,6 @@ import ( // UAccount API Schema -// AddMemberToProjectRequest is request schema for AddMemberToProject action -type AddMemberToProjectRequest struct { - request.CommonBase - - // [公共参数] 项目ID,请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list)的描述。不填写为创建时间最早的项目。 - // ProjectId *string `required:"false"` - - // 被加入成员归属角色ID - CharacterId *string `required:"true"` - - // 被加入成员Email - MemberEmail *string `required:"true"` -} - -// AddMemberToProjectResponse is response schema for AddMemberToProject action -type AddMemberToProjectResponse struct { - response.CommonBase -} - -// NewAddMemberToProjectRequest will create request of AddMemberToProject action. -func (c *UAccountClient) NewAddMemberToProjectRequest() *AddMemberToProjectRequest { - req := &AddMemberToProjectRequest{} - - // setup request with client config - c.Client.SetupRequest(req) - - // setup retryable with default retry policy (retry for non-create action and common error) - req.SetRetryable(false) - return req -} - -/* -API: AddMemberToProject - -添加成员到项目 -*/ -func (c *UAccountClient) AddMemberToProject(req *AddMemberToProjectRequest) (*AddMemberToProjectResponse, error) { - var err error - var res AddMemberToProjectResponse - - reqCopier := *req - - err = c.Client.InvokeAction("AddMemberToProject", &reqCopier, &res) - if err != nil { - return &res, err - } - - return &res, nil -} - // CreateCharacterRequest is request schema for CreateCharacter action type CreateCharacterRequest struct { request.CommonBase @@ -278,50 +228,6 @@ func (c *UAccountClient) DescribeMemberList(req *DescribeMemberListRequest) (*De return &res, nil } -// FreezeMemberRequest is request schema for FreezeMember action -type FreezeMemberRequest struct { - request.CommonBase - - // 需要被冻结的成员Email - MemberEmail *string `required:"true"` -} - -// FreezeMemberResponse is response schema for FreezeMember action -type FreezeMemberResponse struct { - response.CommonBase -} - -// NewFreezeMemberRequest will create request of FreezeMember action. -func (c *UAccountClient) NewFreezeMemberRequest() *FreezeMemberRequest { - req := &FreezeMemberRequest{} - - // setup request with client config - c.Client.SetupRequest(req) - - // setup retryable with default retry policy (retry for non-create action and common error) - req.SetRetryable(true) - return req -} - -/* -API: FreezeMember - -冻结成员 -*/ -func (c *UAccountClient) FreezeMember(req *FreezeMemberRequest) (*FreezeMemberResponse, error) { - var err error - var res FreezeMemberResponse - - reqCopier := *req - - err = c.Client.InvokeAction("FreezeMember", &reqCopier, &res) - if err != nil { - return &res, err - } - - return &res, nil -} - // GetNetworkMaskRequest is request schema for GetNetworkMask action type GetNetworkMaskRequest struct { request.CommonBase diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go index be313307..719de416 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/apis.go @@ -643,17 +643,17 @@ type CreateUDBInstanceRequest struct { // 磁盘空间(GB), 暂时支持20G - 32T DiskSpace *int `required:"true"` - // 是否创建使用ipv6 资源, 默认为false, 或者不填, 创建ipv6为true - EnableIpV6 *bool `required:"false"` - // UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例 "HA": 高可用版UDB实例 默认是"Normal" InstanceMode *string `required:"false"` // 【该字段已废弃,请谨慎使用】 InstanceType *string `required:"false" deprecated:"true"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB),目前支持以下几档 2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M/128000M/192000M/256000M/320000M - MemoryLimit *int `required:"true"` + MemoryLimit *int `required:"false"` // 实例名称,至少6位 Name *string `required:"true"` @@ -670,6 +670,9 @@ type CreateUDBInstanceRequest struct { // SSD类型,可选值为"SATA"、“NVMe”,默认为“SATA” SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *string `required:"false"` + // 子网ID SubnetId *string `required:"false"` @@ -750,6 +753,9 @@ type CreateUDBInstanceByRecoveryRequest struct { // 是否创建使用ipv6 资源, 默认为false, 或者不填, 创建ipv6为true EnableIpV6 *bool `required:"false"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 实例名称,至少6位 Name *string `required:"true"` @@ -759,6 +765,9 @@ type CreateUDBInstanceByRecoveryRequest struct { // 恢复到某个时间点的时间戳(UTC时间格式,默认单位秒) RecoveryTime *int `required:"true"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // 源实例的Id SrcDBId *string `required:"true"` @@ -1088,6 +1097,9 @@ type CreateUDBSlaveRequest struct { // 是否锁主库,默认为true IsLock *bool `required:"false"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB),目前支持以下几档 2000M/4000M/ 6000M/8000M/12000M/16000M/ 24000M/32000M/48000M/ 64000M/96000M/128000M/192000M/256000M/320000M MemoryLimit *int `required:"false"` @@ -1106,6 +1118,9 @@ type CreateUDBSlaveRequest struct { // 仅对主为SSD型实例有效。 可选值"SATA","NVMe" SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // master实例的DBId,该值可以通过DescribeUDBInstance获取 SrcId *string `required:"true"` @@ -1570,13 +1585,13 @@ func (c *UDBClient) DescribeUDBBinlogBackupURL(req *DescribeUDBBinlogBackupURLRe type DescribeUDBInstanceRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // [公共参数] 可用区,不填时默认全部可用区。参见 [可用区列表](../summary/regionlist.html) + // [公共参数] 可用区,不填时默认全部可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` // DB种类,如果是列表操作,则需要指定,不区分大小写,其取值如下:mysql: SQL;mongo: NOSQL;postgresql: postgresql @@ -1597,8 +1612,14 @@ type DescribeUDBInstanceRequest struct { // 分页显示起始偏移位置,列表操作时必填 Offset *int `required:"false"` + // 根据 业务组 筛选DB + Tag *string `required:"false"` + // IsInUDBC为True,UDBCId为空,说明查看整个可用区的专区的db,如果UDBId不为空则只查看此专区下面的db UDBCId *string `required:"false"` + + // 根据VPCId筛选DB + VPCId *string `required:"false"` } // DescribeUDBInstanceResponse is response schema for DescribeUDBInstance action @@ -1993,6 +2014,12 @@ type DescribeUDBInstancePriceRequest struct { // 实例的部署类型。可选值为:Normal: 普通单点实例,Slave: 从库实例,HA: 高可用部署实例,默认是Normal InstanceMode *string `required:"false"` + // UDB数据库机型: "SATA_SSD": "SSD机型" , "PCIE_SSD": "SSD高性能机型" , "Normal_Volume": "标准大容量机型", "SATA_SSD_Volume": "SSD大容量机型" , "PCIE_SSD_Volume": "SSD高性能大容量机型", "NVMe_SSD": "快杰机型" + InstanceType *string `required:"false"` + + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB),单位为MB.目前支持:2000-96000 MemoryLimit *int `required:"true"` @@ -2002,6 +2029,9 @@ type DescribeUDBInstancePriceRequest struct { // SSD类型,可选值为"SATA"、“NVMe”. 默认为“SATA” SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // 【该字段已废弃,请谨慎使用】 UseSSD *bool `required:"false" deprecated:"true"` } @@ -2114,12 +2144,21 @@ type DescribeUDBInstanceUpgradePriceRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"false"` + // CPU核数 快杰SQLServer升降级必传 + CPU *int `required:"false"` + // 实例的Id DBId *string `required:"true"` // 磁盘空间(GB), 暂时支持20G - 500G DiskSpace *int `required:"true"` + // "SATA_SSD", "NVMe_SSD" + InstanceType *string `required:"false"` + + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB) MemoryLimit *int `required:"true"` @@ -2129,6 +2168,9 @@ type DescribeUDBInstanceUpgradePriceRequest struct { // "SATA", "NVMe" SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *int `required:"false"` + // 【该字段已废弃,请谨慎使用】 UseSSD *bool `required:"false" deprecated:"true"` } @@ -2466,13 +2508,13 @@ func (c *UDBClient) DescribeUDBSplittingInfo(req *DescribeUDBSplittingInfoReques type DescribeUDBTypeRequest struct { request.CommonBase - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` - // 跨可用区高可用DB的备库所在区域,仅当该可用区支持跨可用区高可用时填入。参见 [可用区列表](../summary/regionlist.html) + // 跨可用区高可用DB的备库所在区域,仅当该可用区支持跨可用区高可用时填入。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) BackupZone *string `required:"false"` // 返回从备份创建实例时,该版本号所支持的备份创建版本。如果没传,则表示不是从备份创建。 @@ -2481,6 +2523,9 @@ type DescribeUDBTypeRequest struct { // DB实例类型,如mysql,sqlserver,mongo,postgresql DBClusterType *string `required:"false"` + // 返回从备份创建实例时,该小版本号所支持的备份创建小版本。如果没传,则表示不是从备份创建。 + DBSubVersion *string `required:"false"` + // 返回支持某种磁盘类型的DB类型,如Normal、SSD、NVMe_SSD。如果没传,则表示任何磁盘类型均可。 DiskType *string `required:"false"` @@ -2860,6 +2905,118 @@ func (c *UDBClient) GetUDBClientConnNum(req *GetUDBClientConnNumRequest) (*GetUD return &res, nil } +// GetUDBInstanceSSLCertURLRequest is request schema for GetUDBInstanceSSLCertURL action +type GetUDBInstanceSSLCertURLRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"true"` + + // 实例ID + DBId *string `required:"true"` + + // URL的过期时间,该值最小默认1小时,最大7天。(单位/秒) + ExpireTime *int `required:"false"` +} + +// GetUDBInstanceSSLCertURLResponse is response schema for GetUDBInstanceSSLCertURL action +type GetUDBInstanceSSLCertURLResponse struct { + response.CommonBase + + // 内网链接 + InnerUrl string + + // 外网链接 + InternetUrl string +} + +// NewGetUDBInstanceSSLCertURLRequest will create request of GetUDBInstanceSSLCertURL action. +func (c *UDBClient) NewGetUDBInstanceSSLCertURLRequest() *GetUDBInstanceSSLCertURLRequest { + req := &GetUDBInstanceSSLCertURLRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: GetUDBInstanceSSLCertURL + +获取SSL证书下载地址 +*/ +func (c *UDBClient) GetUDBInstanceSSLCertURL(req *GetUDBInstanceSSLCertURLRequest) (*GetUDBInstanceSSLCertURLResponse, error) { + var err error + var res GetUDBInstanceSSLCertURLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("GetUDBInstanceSSLCertURL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// ListUDBUserTablesRequest is request schema for ListUDBUserTables action +type ListUDBUserTablesRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // udb实例的ID + DBId *string `required:"true"` +} + +// ListUDBUserTablesResponse is response schema for ListUDBUserTables action +type ListUDBUserTablesResponse struct { + response.CommonBase + + // 用户库表的集合 + Tables []UDBDatabaseData +} + +// NewListUDBUserTablesRequest will create request of ListUDBUserTables action. +func (c *UDBClient) NewListUDBUserTablesRequest() *ListUDBUserTablesRequest { + req := &ListUDBUserTablesRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ListUDBUserTables + +查看udb实例所有的用户表集合 (只包括引擎为innodb和myisam的表) +*/ +func (c *UDBClient) ListUDBUserTables(req *ListUDBUserTablesRequest) (*ListUDBUserTablesResponse, error) { + var err error + var res ListUDBUserTablesResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListUDBUserTables", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // ModifyUDBInstanceNameRequest is request schema for ModifyUDBInstanceName action type ModifyUDBInstanceNameRequest struct { request.CommonBase @@ -3031,6 +3188,65 @@ func (c *UDBClient) ModifyUDBInstanceRemarkName(req *ModifyUDBInstanceRemarkName return &res, nil } +// ModifyUDBInstanceSSLRequest is request schema for ModifyUDBInstanceSSL action +type ModifyUDBInstanceSSLRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"true"` + + // 实例ID + DBId *string `required:"true"` + + // 是否开启SSL 1->关闭 2->开启 + EnableSSL *int `required:"true"` + + // SSL证书有效时间,1-5年,默认为1年 + ValidTime *int `required:"false"` +} + +// ModifyUDBInstanceSSLResponse is response schema for ModifyUDBInstanceSSL action +type ModifyUDBInstanceSSLResponse struct { + response.CommonBase +} + +// NewModifyUDBInstanceSSLRequest will create request of ModifyUDBInstanceSSL action. +func (c *UDBClient) NewModifyUDBInstanceSSLRequest() *ModifyUDBInstanceSSLRequest { + req := &ModifyUDBInstanceSSLRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: ModifyUDBInstanceSSL + +调整SSL的信息 +*/ +func (c *UDBClient) ModifyUDBInstanceSSL(req *ModifyUDBInstanceSSLRequest) (*ModifyUDBInstanceSSLResponse, error) { + var err error + var res ModifyUDBInstanceSSLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ModifyUDBInstanceSSL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // PromoteUDBInstanceToHARequest is request schema for PromoteUDBInstanceToHA action type PromoteUDBInstanceToHARequest struct { request.CommonBase @@ -3168,12 +3384,18 @@ type ResizeUDBInstanceRequest struct { // UDB数据库机型: "Normal": "标准机型" , "SATA_SSD": "SSD机型" , "PCIE_SSD": "SSD高性能机型" , "Normal_Volume": "标准大容量机型", "SATA_SSD_Volume": "SSD大容量机型" , "PCIE_SSD_Volume": "SSD高性能大容量机型",“NVMe_SSD”:“快杰机型” InstanceType *string `required:"false"` + // 规格类型ID,当SpecificationType为1时有效 + MachineType *string `required:"false"` + // 内存限制(MB),目前支持以下几档 2000M/4000M/ 6000M/8000M/ 12000M/16000M/ 24000M/32000M/ 48000M/64000M/96000M/128000M/192000M/256000M/320000M。 MemoryLimit *int `required:"true"` // SSD类型,可选值为"SATA"、“NVMe” SSDType *string `required:"false"` + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType *string `required:"false"` + // DB关闭状态下升降级,升降级后是否启动DB,默认为false StartAfterUpgrade *bool `required:"false"` @@ -3323,6 +3545,62 @@ func (c *UDBClient) RestartUDBInstance(req *RestartUDBInstanceRequest) (*Restart return &res, nil } +// RollbackUDBInstanceRequest is request schema for RollbackUDBInstance action +type RollbackUDBInstanceRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 恢复到某个时间点的时间戳(UTC时间格式,默认单位秒) + RecoveryTime *string `required:"true"` + + // 源实例的Id + SrcDBId *string `required:"true"` + + // 指定需要恢复的表,格式为(库名.表名), 指定多个用逗号隔开,eg: [ udb.test, mysql_school.my_student] + Tables *string `required:"true"` +} + +// RollbackUDBInstanceResponse is response schema for RollbackUDBInstance action +type RollbackUDBInstanceResponse struct { + response.CommonBase + + // 源实例的Id + DBId string +} + +// NewRollbackUDBInstanceRequest will create request of RollbackUDBInstance action. +func (c *UDBClient) NewRollbackUDBInstanceRequest() *RollbackUDBInstanceRequest { + req := &RollbackUDBInstanceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: RollbackUDBInstance + +在原实例回档指定库表 +*/ +func (c *UDBClient) RollbackUDBInstance(req *RollbackUDBInstanceRequest) (*RollbackUDBInstanceResponse, error) { + var err error + var res RollbackUDBInstanceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("RollbackUDBInstance", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // SetUDBRWSplittingRequest is request schema for SetUDBRWSplitting action type SetUDBRWSplittingRequest struct { request.CommonBase @@ -3869,6 +4147,74 @@ func (c *UDBClient) UpgradeUDBInstanceToHA(req *UpgradeUDBInstanceToHARequest) ( return &res, nil } +// UpgradeUDBVersionRequest is request schema for UpgradeUDBVersion action +type UpgradeUDBVersionRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Zone *string `required:"true"` + + // db实例资源id + DBId *string `required:"true"` + + // db需要升级的小版本 + DBSubVersion *string `required:"true"` + + // 该值为一个unix时间戳,代表开始预期切换实例结束的时间 + SwitchEndTime *int `required:"false"` + + // 该值为一个unix时间戳,代表开始切换实例的时间 + SwitchStartTime *int `required:"false"` + + // 切换类型,可选值为"immediately"和"customize",分别代表立即切换和自定义切换时间,自定义切换时间需要填写SwitchStartTime和SwitchEndTime + SwitchType *string `required:"true"` +} + +// UpgradeUDBVersionResponse is response schema for UpgradeUDBVersion action +type UpgradeUDBVersionResponse struct { + response.CommonBase + + // 返回信息 + Message string +} + +// NewUpgradeUDBVersionRequest will create request of UpgradeUDBVersion action. +func (c *UDBClient) NewUpgradeUDBVersionRequest() *UpgradeUDBVersionRequest { + req := &UpgradeUDBVersionRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UpgradeUDBVersion + +升级db实例版本 +*/ +func (c *UDBClient) UpgradeUDBVersion(req *UpgradeUDBVersionRequest) (*UpgradeUDBVersionResponse, error) { + var err error + var res UpgradeUDBVersionResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpgradeUDBVersion", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // UploadUDBParamGroupRequest is request schema for UploadUDBParamGroup action type UploadUDBParamGroupRequest struct { request.CommonBase diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go index be82832c..edb8c587 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/models.go @@ -47,18 +47,6 @@ type UDBBackupSet struct { Zone string } -/* -UFileDataSet - 增加ufile的描述 -*/ -type UFileDataSet struct { - - // bucket名称 - Bucket string - - // Ufile的令牌tokenid - TokenID string -} - /* UDBSlaveInstanceSet - DescribeUDBSlaveInstance */ @@ -82,6 +70,9 @@ type UDBSlaveInstanceSet struct { // 备份策略,一天内备份时间间隔,单位小时,默认24小时 BackupDuration int + // 0 区分大小写, 1不区分, 只针对mysql8.0 + CaseSensitivityParam int + // Year, Month, Dynamic,Trial,默认: Dynamic ChargeType string @@ -109,9 +100,6 @@ type UDBSlaveInstanceSet struct { // DB实例过期时间,采用UTC计时时间戳 ExpiredTime int - // 获取该实例的IPv6地址 - IPv6Address string - // UDB实例模式类型, 可选值如下: "Normal": 普通版UDB实例;"HA": 高可用版UDB实例 InstanceMode string @@ -124,6 +112,9 @@ type UDBSlaveInstanceSet struct { // DB实例日志文件大小,单位GB LogFileSize float64 + // 规格类型ID,当SpecificationType为1时有效 + MachineType string + // 内存限制(MB),默认根据配置机型 MemoryLimit int @@ -139,16 +130,22 @@ type UDBSlaveInstanceSet struct { // 端口号,mysql默认3306,mongodb默认27017 Port int + // 延时从库时长 + ReplicationDelaySeconds int + // DB实例角色,mysql区分master/slave,mongodb多种角色 Role string // SSD类型,SATA/PCI-E SSDType string + // 实例计算规格类型,0或不传代表使用内存方式购买,1代表使用内存-cpu可选配比方式购买,需要填写MachineType + SpecificationType string + // 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id SrcDBId string - // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败 + // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败,Remakeing:重做中,RemakeFail:重做失败, MajorVersionUpgrading:小版本升级中,MajorVersionUpgradeWaitForSwitch:高可用等待切换,MajorVersionUpgradeFail State string // 子网ID @@ -176,6 +173,18 @@ type UDBSlaveInstanceSet struct { Zone string } +/* +UFileDataSet - 增加ufile的描述 +*/ +type UFileDataSet struct { + + // bucket名称 + Bucket string + + // Ufile的令牌tokenid + TokenID string +} + /* UDBInstanceSet - DescribeUDBInstance */ @@ -199,9 +208,18 @@ type UDBInstanceSet struct { // 备份策略,一天内备份时间间隔,单位小时,默认24小时 BackupDuration int + // 默认的备份方式,nobackup表示不备份, snapshot 表示使用快照备份,logic 表示使用逻辑备份,xtrabackup表示使用物理备份。 + BackupMethod string + // 跨可用区高可用备库所在可用区 BackupZone string + // CPU核数 + CPU int + + // 0区分大小写, 1不分区 + CaseSensitivityParam int + // Year, Month, Dynamic,Trial,默认: Dynamic ChargeType string @@ -217,6 +235,9 @@ type UDBInstanceSet struct { // DB实例id DBId string + // mysql实例提供具体小版本信息 + DBSubVersion string + // DB类型id,mysql/mongodb按版本细分各有一个id 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6 DBTypeId string @@ -232,6 +253,9 @@ type UDBInstanceSet struct { // DB实例磁盘已使用空间,单位GB DiskUsedSize float64 + // mysql是否开启了SSL;1->未开启 2->开启 + EnableSSL int + // DB实例过期时间,采用UTC计时时间戳 ExpiredTime int @@ -244,12 +268,15 @@ type UDBInstanceSet struct { // UDB数据库机型 InstanceType string - // UDB数据库机型ID + // UDB数据库机型ID (已弃用) InstanceTypeId int // DB实例日志文件大小,单位GB LogFileSize float64 + // 数据库机型规格 + MachineType string + // 内存限制(MB),默认根据配置机型 MemoryLimit int @@ -271,10 +298,16 @@ type UDBInstanceSet struct { // SSD类型,SATA/PCI-E/NVMe SSDType string + // SSL到期时间 + SSLExpirationTime int + + // 是否使用可选cpu类型规格 + SpecificationType int + // 对mysql的slave而言是master的DBId,对master则为空, 对mongodb则是副本集id SrcDBId string - // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败 + // DB状态标记 Init:初始化中,Fail:安装失败,Starting:启动中,Running:运行,Shutdown:关闭中,Shutoff:已关闭,Delete:已删除,Upgrading:升级中,Promoting:提升为独库进行中,Recovering:恢复中,Recover fail:恢复失败, Remakeing:重做中,RemakeFail:重做失败,VersionUpgrading:小版本升级中,VersionUpgradeWaitForSwitch:高可用等待切换,VersionUpgradeFail:小版本升级失败,UpdatingSSL:修改SSL中,UpdateSSLFail:修改SSL失败,MajorVersionUpgrading:小版本升级中,MajorVersionUpgradeWaitForSwitch:高可用等待切换,MajorVersionUpgradeFail State string // 子网ID @@ -457,6 +490,9 @@ UDBTypeSet - DescribeUDBType */ type UDBTypeSet struct { + // mysql子版本,如mysql-8.0.25,mysql-8.0.16 + DBSubVersion string + // DB类型id,mysql/mongodb按版本细分各有一个id, 目前id的取值范围为[1,7],数值对应的版本如下: 1:mysql-5.5,2:mysql-5.1,3:percona-5.5 4:mongodb-2.4,5:mongodb-2.6,6:mysql-5.6, 7:percona-5.6 DBTypeId string } @@ -472,3 +508,30 @@ type ConnNumMap struct { // 该Ip连接数 Num int } + +/* +TableData - 用户表详情 +*/ +type TableData struct { + + // 表所属的库名称 + DBName string + + // 表的引擎(innodb, myisam) + Engine string + + // 表名称 + TableName string +} + +/* +UDBDatabaseData - 某个库的详细信息 +*/ +type UDBDatabaseData struct { + + // 数据库名称 + DBName string + + // 该库所有的表集合 + TableDataSet []TableData +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/apis.go index 4e0be4a5..204a28e0 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/apis.go @@ -98,6 +98,9 @@ type CreateUFileLifeCycleRequest struct { // Enabled -- 启用,Disabled -- 不启用 Status *string `required:"true"` + + // Tag,参数格式"k1=v1&k2=v2",key的最大长度为128, value最大长度为256byte,单个object的tag的最大数量为10 + Tags *string `required:"false"` } // CreateUFileLifeCycleResponse is response schema for CreateUFileLifeCycle action @@ -974,6 +977,9 @@ type UpdateUFileLifeCycleRequest struct { // Enabled -- 启用,Disabled -- 不启用 Status *string `required:"true"` + + // Tag,参数格式"k1=v1&k2=v2",key的最大长度为128, value最大长度为256byte,单个object的tag的最大数量为10 + Tags *string `required:"false"` } // UpdateUFileLifeCycleResponse is response schema for UpdateUFileLifeCycle action diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/models.go index fde37b6a..5f284722 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/models.go @@ -128,27 +128,6 @@ type LifeCycleItem struct { Status string } -/* -UFileTotalReportItem - 总消费信息 -*/ -type UFileTotalReportItem struct { - - // API请求次数(万次) - ApiTimes float64 - - // 忙时流量;单位GB;海外无此字段 - BusyFlow float64 - - // cdn回源流量;单位GB - CdnFlow float64 - - // 下载流量:单位GB;国内无此字段 - Flow float64 - - // 闲时流量;单位GB;海外无此字段 - IdleFlow float64 -} - /* UFileDailyReportItem - */ @@ -188,6 +167,27 @@ type UFileDailyReportItem struct { Storage float64 } +/* +UFileTotalReportItem - 总消费信息 +*/ +type UFileTotalReportItem struct { + + // API请求次数(万次) + ApiTimes float64 + + // 忙时流量;单位GB;海外无此字段 + BusyFlow float64 + + // cdn回源流量;单位GB + CdnFlow float64 + + // 下载流量:单位GB;国内无此字段 + Flow float64 + + // 闲时流量;单位GB;海外无此字段 + IdleFlow float64 +} + /* UFileReportItem - */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go index 9bc26d34..f0c08579 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/apis.go @@ -195,6 +195,18 @@ func (c *UHostClient) CreateIsolationGroup(req *CreateIsolationGroupRequest) (*C return &res, nil } +/* +UHostDiskCustomBackup is request schema for complex param +*/ +type UHostDiskCustomBackup struct { +} + +/* +CreateUHostInstanceParamNetworkInterfaceIPv6 is request schema for complex param +*/ +type CreateUHostInstanceParamNetworkInterfaceIPv6 struct { +} + /* CreateUHostInstanceParamNetworkInterfaceEIP is request schema for complex param */ @@ -220,21 +232,33 @@ type CreateUHostInstanceParamNetworkInterfaceEIP struct { } /* -CreateUHostInstanceParamNetworkInterfaceIPv6 is request schema for complex param +UHostDisk is request schema for complex param */ -type CreateUHostInstanceParamNetworkInterfaceIPv6 struct { -} +type UHostDisk struct { -/* -UHostDiskCustomBackup is request schema for complex param -*/ -type UHostDiskCustomBackup struct { -} + // 磁盘备份方案。枚举值:\\ > NONE,无备份 \\ > DATAARK,数据方舟【已下线,不再支持】 \\ > SNAPSHOT,快照 \\当前磁盘支持的备份模式参考 [[api:uhost-api:disk_type|磁盘类型]],默认值:NONE + BackupType *string `required:"false"` -/* -CreateUHostInstanceParamSecGroupId is request schema for complex param -*/ -type CreateUHostInstanceParamSecGroupId struct { + // 云盘代金券id。不适用于系统盘/本地盘。请通过DescribeCoupon接口查询,或登录用户中心查看 + CouponId *string `required:"false"` + + // 【功能仅部分可用区开放,详询技术支持】磁盘是否加密。加密:true, 不加密: false加密必须传入对应的的KmsKeyId,默认值false + Encrypted *bool `required:"false"` + + // 是否是系统盘。枚举值:\\ > True,是系统盘 \\ > False,是数据盘(默认)。Disks数组中有且只能有一块盘是系统盘。 + IsBoot *string `required:"true"` + + // 【功能仅部分可用区开放,详询技术支持】kms key id。选择加密盘时必填。 + KmsKeyId *string `required:"false"` + + // 磁盘大小,单位GB。请参考[[api:uhost-api:disk_type|磁盘类型]]。 + Size *int `required:"true"` + + // 从快照创建盘时所用快照id,目前仅支持数据盘 + SnapshotId *string `required:"false"` + + // 磁盘类型。请参考[[api:uhost-api:disk_type|磁盘类型]]。 + Type *string `required:"true"` } /* @@ -249,6 +273,18 @@ type CreateUHostInstanceParamNetworkInterface struct { EIP *CreateUHostInstanceParamNetworkInterfaceEIP `required:"false"` } +/* +CreateUHostInstanceParamSecGroupId is request schema for complex param +*/ +type CreateUHostInstanceParamSecGroupId struct { + + // 安全组 ID。至多可以同时绑定5个安全组。 + Id *string `required:"false"` + + // 安全组优先级。取值范围[1, 5] + Priority *int `required:"false"` +} + /* CreateUHostInstanceParamFeatures is request schema for complex param */ @@ -270,36 +306,6 @@ type CreateUHostInstanceParamVolumes struct { IsBoot *string `required:"false" deprecated:"true"` } -/* -UHostDisk is request schema for complex param -*/ -type UHostDisk struct { - - // 磁盘备份方案。枚举值:\\ > NONE,无备份 \\ > DATAARK,数据方舟 \\ > SNAPSHOT,快照 \\当前磁盘支持的备份模式参考 [[api:uhost-api:disk_type|磁盘类型]],默认值:NONE - BackupType *string `required:"false"` - - // 云盘代金券id。不适用于系统盘/本地盘。请通过DescribeCoupon接口查询,或登录用户中心查看 - CouponId *string `required:"false"` - - // 【功能仅部分可用区开放,详询技术支持】磁盘是否加密。加密:true, 不加密: false加密必须传入对应的的KmsKeyId,默认值false - Encrypted *bool `required:"false"` - - // 是否是系统盘。枚举值:\\ > True,是系统盘 \\ > False,是数据盘(默认)。Disks数组中有且只能有一块盘是系统盘。 - IsBoot *string `required:"true"` - - // 【功能仅部分可用区开放,详询技术支持】kms key id。选择加密盘时必填。 - KmsKeyId *string `required:"false"` - - // 磁盘大小,单位GB。请参考[[api:uhost-api:disk_type|磁盘类型]]。 - Size *int `required:"true"` - - // 从快照创建盘时所用快照id,目前仅支持数据盘 - SnapshotId *string `required:"false"` - - // 磁盘类型。请参考[[api:uhost-api:disk_type|磁盘类型]]。 - Type *string `required:"true"` -} - // CreateUHostInstanceRequest is request schema for CreateUHostInstance action type CreateUHostInstanceRequest struct { request.CommonBase @@ -379,7 +385,7 @@ type CreateUHostInstanceRequest struct { // 云主机机型(V2.0),在本字段和字段UHostType中,仅需要其中1个字段即可。枚举值["N", "C", "G", "O", "OS", "OM", "OPRO", "OMAX", "O.BM", "O.EPC"]。参考[[api:uhost-api:uhost_type|云主机机型说明]]。 MachineType *string `required:"false"` - // 本次最大创建主机数量,取值范围是[1,100],默认值为1。 + // 本次最大创建主机数量,取值范围是[1,100],默认值为1。- 库存数量不足时,按库存数量创建。- 配额不足时,返回错误。- 使用隔离组时,以隔离组可用数量为准。 MaxCount *int `required:"false"` // 内存大小。单位:MB。范围 :[1024, 262144],取值为1024的倍数(可选范围参考控制台)。默认值:8192 @@ -418,9 +424,15 @@ type CreateUHostInstanceRequest struct { // 【该字段已废弃,请谨慎使用】 RestrictMode *string `required:"false" deprecated:"true"` + // + SecGroupId []CreateUHostInstanceParamSecGroupId `required:"false"` + // 防火墙ID,默认:Web推荐防火墙。如何查询SecurityGroupId请参见 [DescribeFirewall](api/unet-api/describe_firewall.html)。 SecurityGroupId *string `required:"false"` + // 主机安全模式。Firewall:防火墙;SecGroup:安全组;默认值:Firewall。 + SecurityMode *string `required:"false"` + // 【该字段已废弃,请谨慎使用】 StorageType *string `required:"false" deprecated:"true"` @@ -1480,6 +1492,9 @@ type GetUHostUpgradePriceRequest struct { // 【该字段已废弃,请谨慎使用】 DiskSpace *int `required:"false" deprecated:"true"` + // GPU卡核心数。仅GPU机型支持此字段(可选范围与MachineType+GpuType相关) + GPU *int `required:"false"` + // 【该字段已废弃,请谨慎使用】 HostType *string `required:"false" deprecated:"true"` @@ -2350,6 +2365,9 @@ type ResizeUHostInstanceRequest struct { // 【该字段已废弃,请谨慎使用】 DiskSpace *int `required:"false" deprecated:"true"` + // GPU卡核心数。仅GPU机型支持此字段(可选范围与MachineType+GpuType相关) + GPU *int `required:"false"` + // 内存大小。单位:MB。范围 :[1024, 1966080],取值为1024的倍数(可选范围与UHostType相关)。默认值为当前实例的内存大小。 Memory *int `required:"false"` diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go index eb35bb64..0642928c 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/models.go @@ -26,21 +26,6 @@ type KeyPair struct { ProjectId string } -/* -Collection - CPU和内存可支持的规格 -*/ -type Collection struct { - - // CPU规格 - Cpu int - - // 内存规格 - Memory []int - - // CPU和内存规格只能在列出来的CPU平台支持 - MinimalCpuPlatform []string -} - /* FeatureModes - 可以支持的模式类别 */ @@ -93,15 +78,30 @@ type BootDiskInfo struct { } /* -MachineSizes - GPU、CPU和内存信息 +Collection - CPU和内存可支持的规格 */ -type MachineSizes struct { +type Collection struct { - // CPU和内存可支持的规格 - Collection []Collection + // CPU规格 + Cpu int - // Gpu为GPU可支持的规格即GPU颗数,非GPU机型,Gpu为0 - Gpu int + // 内存规格 + Memory []int + + // CPU和内存规格只能在列出来的CPU平台支持 + MinimalCpuPlatform []string +} + +/* +GraphicsMemory - GPU的显存指标 +*/ +type GraphicsMemory struct { + + // 交互展示参数,可忽略 + Rate int + + // 值,单位是GB + Value int } /* @@ -116,6 +116,21 @@ type Features struct { Name string } +/* +Disks - 磁盘信息 +*/ +type Disks struct { + + // 系统盘信息 + BootDisk []BootDiskInfo + + // 数据盘信息 + DataDisk []DataDiskInfo + + // 磁盘介质类别信息,磁盘主要分类如下:云盘|cloudDisk、普通本地盘|normalLocalDisk和SSD本地盘|ssdLocalDisk。 + Name string +} + /* CpuPlatforms - CPU平台信息 */ @@ -144,30 +159,15 @@ type Performance struct { } /* -GraphicsMemory - GPU的显存指标 -*/ -type GraphicsMemory struct { - - // 交互展示参数,可忽略 - Rate int - - // 值,单位是GB - Value int -} - -/* -Disks - 磁盘信息 +MachineSizes - GPU、CPU和内存信息 */ -type Disks struct { - - // 系统盘信息 - BootDisk []BootDiskInfo +type MachineSizes struct { - // 数据盘信息 - DataDisk []DataDiskInfo + // CPU和内存可支持的规格 + Collection []Collection - // 磁盘介质类别信息,磁盘主要分类如下:云盘|cloudDisk、普通本地盘|normalLocalDisk和SSD本地盘|ssdLocalDisk。 - Name string + // Gpu为GPU可支持的规格即GPU颗数,非GPU机型,Gpu为0 + Gpu int } /* @@ -214,7 +214,7 @@ type UHostImageSet struct { // 创建时间,格式为Unix时间戳 CreateTime int - // 特殊状态标识, 目前包含NetEnhnced(网络增强1.0), NetEnhanced_Ultra(网络增强2.0), HotPlug(热升级), GPU(GPU镜像),CloudInit, IPv6(支持IPv6网络),RssdAttachable(支持RSSD云盘),Vgpu_AMD(支持AMD的vgpu),Vgpu_NVIDIA(支持NVIDIA的vgpu),Aarch64_Type(支持arm64架构) + // 特殊状态标识,目前包含NetEnhnced(网络增强1.0), NetEnhanced_Ultra(网络增强2.0), NetEnhanced_Extreme(网络增强3.0), HotPlug(热升级), GPU(GPU镜像),CloudInit, IPv6(支持IPv6网络),RssdAttachable(支持RSSD云盘),Vgpu_AMD(支持AMD的vgpu),Vgpu_NVIDIA(支持NVIDIA的vgpu),Aarch64_Type(支持arm64架构) Features []string // 行业镜像类型(仅行业镜像将返回这个值) @@ -300,42 +300,12 @@ type IsolationGroup struct { } /* -UHostIPSet - DescribeUHostInstance +SpotAttribute - 竞价实例属性 */ -type UHostIPSet struct { - - // IP对应的带宽, 单位: Mb (内网IP不显示带宽信息) - Bandwidth int - - // 内网 Private 类型下,表示是否为默认网卡。true: 是默认网卡;其他值:不是。 - Default string - - // IP地址 - IP string - - // 外网IP资源ID 。(内网IP无对应的资源ID) - IPId string - - // IPv4/IPv6; - IPMode string - - // 内网 Private 类型下,当前网卡的Mac。 - Mac string - - // 弹性网卡为默认网卡时,返回对应的 ID 值 - NetworkInterfaceId string - - // IP地址对应的子网 ID。(北京一不支持,字段返回为空) - SubnetId string - - // 国际: Internation,BGP: Bgp,内网: Private - Type string - - // IP地址对应的VPC ID。(北京一不支持,字段返回为空) - VPCId string +type SpotAttribute struct { - // 当前EIP的权重。权重最大的为当前的出口IP。 - Weight int + // 回收时间 + RecycleTime int } /* @@ -353,27 +323,6 @@ type UDSetUDHostAttribute struct { UDSetId string } -/* -UHostKeyPair - 主机密钥信息 -*/ -type UHostKeyPair struct { - - // 密钥对ID - KeyPairId string - - // 主机密钥对状态,Normal 正常,Deleted 删除 - KeyPairState string -} - -/* -SpotAttribute - 竞价实例属性 -*/ -type SpotAttribute struct { - - // 回收时间 - RecycleTime int -} - /* UHostDiskSet - DescribeUHostInstance */ @@ -407,6 +356,57 @@ type UHostDiskSet struct { Type string } +/* +UHostKeyPair - 主机密钥信息 +*/ +type UHostKeyPair struct { + + // 密钥对ID + KeyPairId string + + // 主机密钥对状态,Normal 正常,Deleted 删除 + KeyPairState string +} + +/* +UHostIPSet - DescribeUHostInstance +*/ +type UHostIPSet struct { + + // IP对应的带宽, 单位: Mb (内网IP不显示带宽信息) + Bandwidth int + + // 内网 Private 类型下,表示是否为默认网卡。true: 是默认网卡;其他值:不是。 + Default string + + // IP地址 + IP string + + // 外网IP资源ID 。(内网IP无对应的资源ID) + IPId string + + // IPv4/IPv6; + IPMode string + + // 内网 Private 类型下,当前网卡的Mac。 + Mac string + + // 弹性网卡为默认网卡时,返回对应的 ID 值 + NetworkInterfaceId string + + // IP地址对应的子网 ID。(北京一不支持,字段返回为空) + SubnetId string + + // 国际: Internation,BGP: Bgp,内网: Private + Type string + + // IP地址对应的VPC ID。(北京一不支持,字段返回为空) + VPCId string + + // 当前EIP的权重。权重最大的为当前的出口IP。 + Weight int +} + /* UHostInstanceSet - DescribeUHostInstance */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/apis.go index 080529d9..837cf38c 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/apis.go @@ -431,6 +431,15 @@ type CreateUK8SClusterV2ParamKubeProxy struct { Mode *string `required:"false"` } +/* +CreateUK8SClusterV2ParamMaster is request schema for complex param +*/ +type CreateUK8SClusterV2ParamMaster struct { + + // Master节点所属可用区,需要设置 Master.0.Zone、 Master.1.Zone、Master.2.Zone 三个 Master 节点的可用区。 三个节点可部署在不同可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + Zone *string `required:"true"` +} + /* CreateUK8SClusterV2ParamNodes is request schema for complex param */ @@ -488,15 +497,6 @@ type CreateUK8SClusterV2ParamNodes struct { Zone *string `required:"true"` } -/* -CreateUK8SClusterV2ParamMaster is request schema for complex param -*/ -type CreateUK8SClusterV2ParamMaster struct { - - // Master节点所属可用区,需要设置 Master.0.Zone、 Master.1.Zone、Master.2.Zone 三个 Master 节点的可用区。 三个节点可部署在不同可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) - Zone *string `required:"true"` -} - // CreateUK8SClusterV2Request is request schema for CreateUK8SClusterV2 action type CreateUK8SClusterV2Request struct { request.CommonBase diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/models.go index 38995897..cbd7e4e9 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uk8s/models.go @@ -2,27 +2,6 @@ package uk8s -/* -IPSet - 节点的IP信息 -*/ -type IPSet struct { - - // IP对应的带宽, 单位: Mb (内网IP不显示带宽信息) - Bandwidth int - - // 是否默认的弹性网卡的信息。true: 是默认弹性网卡;其他值:不是。 - Default string - - // IP地址 - IP string - - // IP资源ID (内网IP无对应的资源ID) - IPId string - - // 国际: Internation,BGP: Bgp,内网: Private - Type string -} - /* DiskSet - 节点磁盘信息 */ @@ -59,6 +38,27 @@ type DiskSet struct { Type string } +/* +IPSet - 节点的IP信息 +*/ +type IPSet struct { + + // IP对应的带宽, 单位: Mb (内网IP不显示带宽信息) + Bandwidth int + + // 是否默认的弹性网卡的信息。true: 是默认弹性网卡;其他值:不是。 + Default string + + // IP地址 + IP string + + // IP资源ID (内网IP无对应的资源ID) + IPId string + + // 国际: Internation,BGP: Bgp,内网: Private + Type string +} + /* UhostInfo - 机器信息 */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go index f30e8918..90f8bd37 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/apis.go @@ -9,6 +9,98 @@ import ( // ULB API Schema +/* +AddTargetsParamTargets is request schema for complex param +*/ +type AddTargetsParamTargets struct { + + // 服务节点是否启用。默认值true + Enabled *bool `required:"false"` + + // 服务节点是否为备节点。默认值false + IsBackup *bool `required:"false"` + + // 服务节点的端口。限定取值:[1-65535],默认值80 + Port *int `required:"false"` + + // 服务节点的IP。在IP类型时,必传 + ResourceIP *string `required:"false"` + + // 服务节点的资源ID。在非IP类型时,必传 + ResourceId *string `required:"false"` + + // 服务节点的类型。限定枚举值:"UHost" / "UNI"/"UPM"/"IP",默认值:"UHost";非IP类型,如果该资源有多个IP,将只能添加主IP;非IP类型,展示时,会显示相关资源信息,IP类型只展示IP信息。在相关资源被删除时,非IP类型会把相关资源从lb中剔除,IP类型不保证这个逻辑 + ResourceType *string `required:"false"` + + // 服务节点的子网资源ID。在IP类型时,必传 + SubnetId *string `required:"false"` + + // 服务节点的VPC资源ID。在IP类型时,必传 + VPCId *string `required:"false"` + + // 服务节点的权重。限定取值:[1-100],默认值1;仅在加权轮询算法时有效 + Weight *int `required:"false"` +} + +// AddTargetsRequest is request schema for AddTargets action +type AddTargetsRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // + Targets []AddTargetsParamTargets `required:"false"` +} + +// AddTargetsResponse is response schema for AddTargets action +type AddTargetsResponse struct { + response.CommonBase + + // 服务节点信息 + Targets []TargetSet +} + +// NewAddTargetsRequest will create request of AddTargets action. +func (c *ULBClient) NewAddTargetsRequest() *AddTargetsRequest { + req := &AddTargetsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: AddTargets + +给应用型负载均衡监听器添加后端服务节点 +*/ +func (c *ULBClient) AddTargets(req *AddTargetsRequest) (*AddTargetsResponse, error) { + var err error + var res AddTargetsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("AddTargets", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // AllocateBackendRequest is request schema for AllocateBackend action type AllocateBackendRequest struct { request.CommonBase @@ -40,7 +132,7 @@ type AllocateBackendRequest struct { // 所添加的后端服务器所在的子网,当ResourceType 为 UHybrid 或 IP 时有效,且必填 SubnetId *string `required:"false"` - // 负载均衡实例的ID + // 传统型负载均衡实例的ID ULBId *string `required:"true"` // 所添加的后端服务器所在的vpc,当ResourceType 为 UHybrid 或 IP 时有效,且必填 @@ -57,7 +149,7 @@ type AllocateBackendRequest struct { type AllocateBackendResponse struct { response.CommonBase - // 所添加的后端资源在ULB中的对象ID,(为ULB系统中使用,与资源自身ID无关),可用于 UpdateBackendAttribute/UpdateBackendAttributeBatch/ReleaseBackend + // 所添加的后端资源在CLB中的对象ID,(为CLB系统中使用,与资源自身ID无关),可用于 UpdateBackendAttribute/UpdateBackendAttributeBatch/ReleaseBackend BackendId string } @@ -76,7 +168,7 @@ func (c *ULBClient) NewAllocateBackendRequest() *AllocateBackendRequest { /* API: AllocateBackend -添加ULB后端资源实例 +添加CLB后端资源实例 */ func (c *ULBClient) AllocateBackend(req *AllocateBackendRequest) (*AllocateBackendResponse, error) { var err error @@ -150,16 +242,16 @@ func (c *ULBClient) AllocateBackendBatch(req *AllocateBackendBatchRequest) (*All type BindSSLRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"true"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` // SSL证书的Id SSLId *string `required:"true"` - // 所绑定ULB实例ID + // 所绑定CLB实例ID ULBId *string `required:"true"` // 所绑定VServer实例ID @@ -186,7 +278,7 @@ func (c *ULBClient) NewBindSSLRequest() *BindSSLRequest { /* API: BindSSL -将SSL证书绑定到VServer +将SSL证书绑定到传统型负载均衡VServer */ func (c *ULBClient) BindSSL(req *BindSSLRequest) (*BindSSLResponse, error) { var err error @@ -202,8 +294,41 @@ func (c *ULBClient) BindSSL(req *BindSSLRequest) (*BindSSLResponse, error) { return &res, nil } -// CreatePolicyRequest is request schema for CreatePolicy action -type CreatePolicyRequest struct { +/* +CreateListenerParamStickinessConfig is request schema for complex param +*/ +type CreateListenerParamStickinessConfig struct { + + // (应用型专用)自定义Cookie。当StickinessType取值"UserDefined"时有效;限定字符长度:[0-255] + CookieName *string `required:"false"` + + // 是否开启会话保持功能。应用型负载均衡实例基于Cookie实现;默认值为:false + Enabled *bool `required:"false"` + + // (应用型专用)Cookie处理方式。限定枚举值:"ServerInsert" / "UserDefined";默认值为:“ServerInsert” + Type *string `required:"false"` +} + +/* +CreateListenerParamHealthCheckConfig is request schema for complex param +*/ +type CreateListenerParamHealthCheckConfig struct { + + // (应用型专用)HTTP检查域名 + Domain *string `required:"false"` + + // 是否开启健康检查功能。暂时不支持关闭。默认值为:true + Enabled *bool `required:"false"` + + // (应用型专用)HTTP检查路径 + Path *string `required:"false"` + + // 健康检查方式。应用型限定取值:“Port”/"HTTP",默认值:“Port” + Type *string `required:"false"` +} + +// CreateListenerRequest is request schema for CreateListener action +type CreateListenerRequest struct { request.CommonBase // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) @@ -212,39 +337,63 @@ type CreatePolicyRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 内容转发策略应用的后端资源实例的ID,来源于 AllocateBackend 返回的 BackendId - BackendId []string `required:"true"` + // (应用型专用)服务器默认证书ID。仅HTTPS监听支持,且必填;暂时只支持最大长度为1 + Certificates []string `required:"false"` - // 内容转发规则中域名的匹配方式,默认与原本一致。枚举值:Regular,正则;Wildcard,泛域名 - DomainMatchMode *string `required:"false"` + // (应用型专用)是否开启数据压缩功能。目前只支持使用gzip对特定文件类型进行压缩。默认值为:false + CompressionEnabled *bool `required:"false"` - // 内容转发匹配字段 - Match *string `required:"true"` + // (应用型专用)是否开启HTTP/2特性。仅HTTPS监听支持开启;默认值为:false + HTTP2Enabled *bool `required:"false"` - // 策略优先级,1-9999;只针对路径规则生效 - PolicyPriority *int `required:"false"` + // + HealthCheckConfig *CreateListenerParamHealthCheckConfig `required:"false"` - // 内容转发匹配字段的类型 - Type *string `required:"false"` + // 连接空闲超时时间。单位:秒。应用型限定取值:[1-86400];默认值60 + IdleTimeout *int `required:"false"` - // 需要添加内容转发策略的负载均衡实例ID - ULBId *string `required:"true"` + // 监听器的监听端口。应用型限定取值:[1-65535],默认值80 + ListenerPort *int `required:"false"` - // 需要添加内容转发策略的VServer实例ID - VServerId *string `required:"true"` + // 监听协议。应用型限定取值:“HTTP”/"HTTPS",默认值“HTTP” + ListenerProtocol *string `required:"false"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 监听器的名称。限定字符长度:[1-255];限定特殊字符,仅支持:“-”,“_”,“.”;默认值:listener + Name *string `required:"false"` + + // (应用型专用)是否开启HTTP重定向到HTTPS。仅HTTP监听支持开启;默认值为:false + RedirectEnabled *bool `required:"false"` + + // (应用型专用)重定向端口。限定取值:[1-65535],默认值443 + RedirectPort *int `required:"false"` + + // 监听器的备注信息。限定字符长度:[0-255] + Remark *string `required:"false"` + + // 负载均衡算法。应用型限定取值:"Roundrobin"/"Source"/"WeightRoundrobin"/" Leastconn"/"Backup",默认值"Roundrobin" + Scheduler *string `required:"false"` + + // (应用型专用)安全策略组ID。仅HTTPS监听支持绑定;默认值“Default”,表示绑定原生策略 + SecurityPolicyId *string `required:"false"` + + // + StickinessConfig *CreateListenerParamStickinessConfig `required:"false"` } -// CreatePolicyResponse is response schema for CreatePolicy action -type CreatePolicyResponse struct { +// CreateListenerResponse is response schema for CreateListener action +type CreateListenerResponse struct { response.CommonBase - // 内容转发策略ID - PolicyId string + // 监听器的ID + ListenerId string } -// NewCreatePolicyRequest will create request of CreatePolicy action. -func (c *ULBClient) NewCreatePolicyRequest() *CreatePolicyRequest { - req := &CreatePolicyRequest{} +// NewCreateListenerRequest will create request of CreateListener action. +func (c *ULBClient) NewCreateListenerRequest() *CreateListenerRequest { + req := &CreateListenerRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -255,17 +404,17 @@ func (c *ULBClient) NewCreatePolicyRequest() *CreatePolicyRequest { } /* -API: CreatePolicy +API: CreateListener -创建VServer内容转发策略 +创建一个应用型负载均衡的监听器 */ -func (c *ULBClient) CreatePolicy(req *CreatePolicyRequest) (*CreatePolicyResponse, error) { +func (c *ULBClient) CreateListener(req *CreateListenerRequest) (*CreateListenerResponse, error) { var err error - var res CreatePolicyResponse + var res CreateListenerResponse reqCopier := *req - err = c.Client.InvokeAction("CreatePolicy", &reqCopier, &res) + err = c.Client.InvokeAction("CreateListener", &reqCopier, &res) if err != nil { return &res, err } @@ -273,28 +422,58 @@ func (c *ULBClient) CreatePolicy(req *CreatePolicyRequest) (*CreatePolicyRespons return &res, nil } -// CreatePolicyGroupRequest is request schema for CreatePolicyGroup action -type CreatePolicyGroupRequest struct { +// CreateLoadBalancerRequest is request schema for CreateLoadBalancer action +type CreateLoadBalancerRequest struct { request.CommonBase - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 内容转发策略组名称,默认为空 - GroupName *string `required:"false"` + // 付费模式。限定枚举值:"Year" / "Month"/"Day"/"Dynamic",默认值为:“Month” + ChargeType *string `required:"false"` + + // 代金券code + CouponId *string `required:"false"` + + // 负载均衡实例的IP协议。限定枚举值:"IPv4" / "IPv6"/"DualStack",默认值为:“IPv4” + IPVersion *string `required:"false"` + + // 负载均衡实例的名称。默认值:lb;特殊字符仅支持:“-”,“_”,“.”;限定字符长度:[1-255] + Name *string `required:"false"` + + // 购买的时长, 默认: 1; 0-> 购买至月末(0只在月付费有效,其余付费模式传0,实际收费按一个周期计费) + Quantity *int `required:"false"` + + // 负载均衡实例的备注信息。限定字符长度:[0-255] + Remark *string `required:"false"` + + // 负载均衡实例所属的子网资源ID。负载均衡实例的内网VIP和SNAT场景的源IP限定在该子网内;指定子网不影响添加后端服务节点时的范围,依旧是整个VPC下支持的资源 + SubnetId *string `required:"true"` + + // 负载均衡实例所属的业务组ID。默认值为“Default”; 传空则为Default业务组 + Tag *string `required:"false"` + + // 负载均衡实例的类型。限定枚举值:"Application" / "Network",默认值:"Application" + Type *string `required:"false"` + + // 负载均衡实例所属的VPC资源ID + VPCId *string `required:"true"` } -// CreatePolicyGroupResponse is response schema for CreatePolicyGroup action -type CreatePolicyGroupResponse struct { +// CreateLoadBalancerResponse is response schema for CreateLoadBalancer action +type CreateLoadBalancerResponse struct { response.CommonBase - // 内容转发策略组的Id - GroupId string + // 负载均衡实例的ID + LoadBalancerId string } -// NewCreatePolicyGroupRequest will create request of CreatePolicyGroup action. -func (c *ULBClient) NewCreatePolicyGroupRequest() *CreatePolicyGroupRequest { - req := &CreatePolicyGroupRequest{} +// NewCreateLoadBalancerRequest will create request of CreateLoadBalancer action. +func (c *ULBClient) NewCreateLoadBalancerRequest() *CreateLoadBalancerRequest { + req := &CreateLoadBalancerRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -305,17 +484,17 @@ func (c *ULBClient) NewCreatePolicyGroupRequest() *CreatePolicyGroupRequest { } /* -API: CreatePolicyGroup +API: CreateLoadBalancer -创建内容转发策略组 +创建一个应用型负载均衡实例 */ -func (c *ULBClient) CreatePolicyGroup(req *CreatePolicyGroupRequest) (*CreatePolicyGroupResponse, error) { +func (c *ULBClient) CreateLoadBalancer(req *CreateLoadBalancerRequest) (*CreateLoadBalancerResponse, error) { var err error - var res CreatePolicyGroupResponse + var res CreateLoadBalancerResponse reqCopier := *req - err = c.Client.InvokeAction("CreatePolicyGroup", &reqCopier, &res) + err = c.Client.InvokeAction("CreateLoadBalancer", &reqCopier, &res) if err != nil { return &res, err } @@ -323,8 +502,8 @@ func (c *ULBClient) CreatePolicyGroup(req *CreatePolicyGroupRequest) (*CreatePol return &res, nil } -// CreateSSLRequest is request schema for CreateSSL action -type CreateSSLRequest struct { +// CreatePolicyRequest is request schema for CreatePolicy action +type CreatePolicyRequest struct { request.CommonBase // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) @@ -333,39 +512,39 @@ type CreateSSLRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // CA证书 - CaCert *string `required:"false"` + // 内容转发策略应用的传统型负载均衡后端资源实例的ID,来源于 AllocateBackend 返回的 BackendId + BackendId []string `required:"true"` - // 加密证书的私钥 - PrivateKey *string `required:"false"` + // 内容转发规则中域名的匹配方式,默认与原本一致。枚举值:Regular,正则;Wildcard,泛域名 + DomainMatchMode *string `required:"false"` - // SSL证书的完整内容,包括用户证书、加密证书的私钥、CA证书 - SSLContent *string `required:"false"` + // 内容转发匹配字段 + Match *string `required:"true"` - // SSL证书的名字,默认值不为空 - SSLName *string `required:"true"` + // 策略优先级,1-9999;只针对路径规则生效 + PolicyPriority *int `required:"false"` - // 所添加的SSL证书类型,目前只支持Pem格式 - SSLType *string `required:"false"` + // 内容转发匹配字段的类型 + Type *string `required:"false"` - // USSL证书的ID - USSLId *string `required:"false"` + // 需要添加内容转发策略的传统型负载均衡实例ID + ULBId *string `required:"true"` - // 用户的证书 - UserCert *string `required:"false"` + // 需要添加内容转发策略的传统型负载均衡VServer实例ID + VServerId *string `required:"true"` } -// CreateSSLResponse is response schema for CreateSSL action -type CreateSSLResponse struct { +// CreatePolicyResponse is response schema for CreatePolicy action +type CreatePolicyResponse struct { response.CommonBase - // SSL证书的Id - SSLId string + // 内容转发策略ID + PolicyId string } -// NewCreateSSLRequest will create request of CreateSSL action. -func (c *ULBClient) NewCreateSSLRequest() *CreateSSLRequest { - req := &CreateSSLRequest{} +// NewCreatePolicyRequest will create request of CreatePolicy action. +func (c *ULBClient) NewCreatePolicyRequest() *CreatePolicyRequest { + req := &CreatePolicyRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -376,17 +555,17 @@ func (c *ULBClient) NewCreateSSLRequest() *CreateSSLRequest { } /* -API: CreateSSL +API: CreatePolicy -创建SSL证书,可以把整个 Pem 证书内容传过来,或者把证书、私钥、CA证书分别传过来 +传统型负载均衡创建VServer内容转发策略 */ -func (c *ULBClient) CreateSSL(req *CreateSSLRequest) (*CreateSSLResponse, error) { +func (c *ULBClient) CreatePolicy(req *CreatePolicyRequest) (*CreatePolicyResponse, error) { var err error - var res CreateSSLResponse + var res CreatePolicyResponse reqCopier := *req - err = c.Client.InvokeAction("CreateSSL", &reqCopier, &res) + err = c.Client.InvokeAction("CreatePolicy", &reqCopier, &res) if err != nil { return &res, err } @@ -394,37 +573,28 @@ func (c *ULBClient) CreateSSL(req *CreateSSLRequest) (*CreateSSLResponse, error) return &res, nil } -// CreateSecurityPolicyRequest is request schema for CreateSecurityPolicy action -type CreateSecurityPolicyRequest struct { +// CreatePolicyGroupRequest is request schema for CreatePolicyGroup action +type CreatePolicyGroupRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) - // ProjectId *string `required:"true"` - - // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) // Region *string `required:"true"` - // 加密套件 - SSLCiphers []string `required:"true"` - - // 安全策略名称 - SecurityPolicyName *string `required:"true"` - - // TLS版本 - TLSVersion *string `required:"true"` + // 内容转发策略组名称,默认为空 + GroupName *string `required:"false"` } -// CreateSecurityPolicyResponse is response schema for CreateSecurityPolicy action -type CreateSecurityPolicyResponse struct { +// CreatePolicyGroupResponse is response schema for CreatePolicyGroup action +type CreatePolicyGroupResponse struct { response.CommonBase - // 安全策略ID - SecurityPolicyId string + // 内容转发策略组的Id + GroupId string } -// NewCreateSecurityPolicyRequest will create request of CreateSecurityPolicy action. -func (c *ULBClient) NewCreateSecurityPolicyRequest() *CreateSecurityPolicyRequest { - req := &CreateSecurityPolicyRequest{} +// NewCreatePolicyGroupRequest will create request of CreatePolicyGroup action. +func (c *ULBClient) NewCreatePolicyGroupRequest() *CreatePolicyGroupRequest { + req := &CreatePolicyGroupRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -435,17 +605,17 @@ func (c *ULBClient) NewCreateSecurityPolicyRequest() *CreateSecurityPolicyReques } /* -API: CreateSecurityPolicy +API: CreatePolicyGroup -创建安全策略 +创建内容转发策略组 */ -func (c *ULBClient) CreateSecurityPolicy(req *CreateSecurityPolicyRequest) (*CreateSecurityPolicyResponse, error) { +func (c *ULBClient) CreatePolicyGroup(req *CreatePolicyGroupRequest) (*CreatePolicyGroupResponse, error) { var err error - var res CreateSecurityPolicyResponse + var res CreatePolicyGroupResponse reqCopier := *req - err = c.Client.InvokeAction("CreateSecurityPolicy", &reqCopier, &res) + err = c.Client.InvokeAction("CreatePolicyGroup", &reqCopier, &res) if err != nil { return &res, err } @@ -453,9 +623,273 @@ func (c *ULBClient) CreateSecurityPolicy(req *CreateSecurityPolicyRequest) (*Cre return &res, nil } -// CreateULBRequest is request schema for CreateULB action -type CreateULBRequest struct { - request.CommonBase +/* +CreateRuleParamRuleActionsForwardConfigTargets is request schema for complex param +*/ +type CreateRuleParamRuleActionsForwardConfigTargets struct { + + // 转发的后端服务节点的标识ID。限定在监听器的服务节点池里;数组长度可以是0;转发服务节点配置的数组长度不为0时,Id必填 + Id *string `required:"false"` + + // 转发的后端服务节点的权重。仅监听器负载均衡算法是加权轮询是有效 + Weight *int `required:"false"` +} + +/* +CreateRuleParamRuleActionsForwardConfig is request schema for complex param +*/ +type CreateRuleParamRuleActionsForwardConfig struct { + + // + Targets []CreateRuleParamRuleActionsForwardConfigTargets `required:"false"` +} + +/* +CreateRuleParamRuleConditionsPathConfig is request schema for complex param +*/ +type CreateRuleParamRuleConditionsPathConfig struct { + + // 取值。暂时只支持数组长度为1;取值需符合相关条件;路径匹配时必填 + Values []string `required:"false"` +} + +/* +CreateRuleParamRuleConditionsHostConfig is request schema for complex param +*/ +type CreateRuleParamRuleConditionsHostConfig struct { + + // 匹配方式。限定枚举值:"Regular"/"Wildcard",默认值:"Regular" + MatchMode *string `required:"false"` + + // 取值。暂时只支持数组长度为1;取值需符合相关匹配方式的条件;域名匹配时必填 + Values []string `required:"false"` +} + +/* +CreateRuleParamRuleActions is request schema for complex param +*/ +type CreateRuleParamRuleActions struct { + + // + ForwardConfig *CreateRuleParamRuleActionsForwardConfig `required:"false"` + + // 动作类型。限定枚举值:"Forward";RuleActions暂支持长度为1 + Type *string `required:"true"` +} + +/* +CreateRuleParamRuleConditions is request schema for complex param +*/ +type CreateRuleParamRuleConditions struct { + + // + HostConfig *CreateRuleParamRuleConditionsHostConfig `required:"false"` + + // + PathConfig *CreateRuleParamRuleConditionsPathConfig `required:"false"` + + // 匹配条件类型。限定枚举值:"Host"/"Path" + Type *string `required:"true"` +} + +// CreateRuleRequest is request schema for CreateRule action +type CreateRuleRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 当转发的服务节点为空时,规则是否忽略。默认值true + Pass *bool `required:"false"` + + // + RuleActions []CreateRuleParamRuleActions `required:"false"` + + // + RuleConditions []CreateRuleParamRuleConditions `required:"false"` +} + +// CreateRuleResponse is response schema for CreateRule action +type CreateRuleResponse struct { + response.CommonBase + + // 转发规则的ID + RuleId string +} + +// NewCreateRuleRequest will create request of CreateRule action. +func (c *ULBClient) NewCreateRuleRequest() *CreateRuleRequest { + req := &CreateRuleRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: CreateRule + +给应用型负载均衡监听器创建一条转发规则 +*/ +func (c *ULBClient) CreateRule(req *CreateRuleRequest) (*CreateRuleResponse, error) { + var err error + var res CreateRuleResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateRule", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// CreateSSLRequest is request schema for CreateSSL action +type CreateSSLRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // CA证书 + CaCert *string `required:"false"` + + // 加密证书的私钥 + PrivateKey *string `required:"false"` + + // SSL证书的完整内容,包括用户证书、加密证书的私钥、CA证书 + SSLContent *string `required:"false"` + + // SSL证书的名字,默认值不为空 + SSLName *string `required:"true"` + + // 所添加的SSL证书类型,目前只支持Pem格式 + SSLType *string `required:"false"` + + // USSL证书的ID + USSLId *string `required:"false"` + + // 用户的证书 + UserCert *string `required:"false"` +} + +// CreateSSLResponse is response schema for CreateSSL action +type CreateSSLResponse struct { + response.CommonBase + + // SSL证书的Id + SSLId string +} + +// NewCreateSSLRequest will create request of CreateSSL action. +func (c *ULBClient) NewCreateSSLRequest() *CreateSSLRequest { + req := &CreateSSLRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: CreateSSL + +创建SSL证书,可以把整个 Pem 证书内容传过来,或者把证书、私钥、CA证书分别传过来 +*/ +func (c *ULBClient) CreateSSL(req *CreateSSLRequest) (*CreateSSLResponse, error) { + var err error + var res CreateSSLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateSSL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// CreateSecurityPolicyRequest is request schema for CreateSecurityPolicy action +type CreateSecurityPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 加密套件 + SSLCiphers []string `required:"true"` + + // 安全策略名称 + SecurityPolicyName *string `required:"true"` + + // TLS版本 + TLSVersion *string `required:"true"` +} + +// CreateSecurityPolicyResponse is response schema for CreateSecurityPolicy action +type CreateSecurityPolicyResponse struct { + response.CommonBase + + // 安全策略ID + SecurityPolicyId string +} + +// NewCreateSecurityPolicyRequest will create request of CreateSecurityPolicy action. +func (c *ULBClient) NewCreateSecurityPolicyRequest() *CreateSecurityPolicyRequest { + req := &CreateSecurityPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +/* +API: CreateSecurityPolicy + +创建安全策略 +*/ +func (c *ULBClient) CreateSecurityPolicy(req *CreateSecurityPolicyRequest) (*CreateSecurityPolicyResponse, error) { + var err error + var res CreateSecurityPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateSecurityPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// CreateULBRequest is request schema for CreateULB action +type CreateULBRequest struct { + request.CommonBase // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` @@ -463,7 +897,7 @@ type CreateULBRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // ULB 所属的业务组ID,如果不传则使用默认的业务组 + // CLB 所属的业务组ID,如果不传则使用默认的业务组 BusinessId *string `required:"false"` // 付费方式, 枚举值为: Year, 按年付费; Month, 按月付费; Dynamic, 按时付费 @@ -472,13 +906,13 @@ type CreateULBRequest struct { // 防火墙ID,如果不传,则默认不绑定防火墙 FirewallId *string `required:"false"` - // 创建的ULB是否为内网模式 + // 创建的CLB是否为内网模式 InnerMode *string `required:"false"` - // ULB 监听器类型,外网ULB默认RequestProxy,内网ULB默认PacketsTransmit。枚举值:RequestProxy,请求代理; PacketsTransmit ,报文转发。 + // CLB 监听器类型,外网CLB默认RequestProxy,内网ULB默认PacketsTransmit。枚举值:RequestProxy,请求代理; PacketsTransmit ,报文转发。 ListenType *string `required:"false"` - // 创建的ULB是否为外网模式,默认即为外网模式 + // 创建的CLB是否为外网模式,默认即为外网模式 OuterMode *string `required:"false"` // 【该字段已废弃,请谨慎使用】 @@ -487,7 +921,7 @@ type CreateULBRequest struct { // 备注 Remark *string `required:"false"` - // ULB 所属的子网ID,如果不传则随机选择一个。 + // CLB 所属的子网ID,如果不传则随机选择一个。 SubnetId *string `required:"false"` // 业务组 @@ -496,7 +930,7 @@ type CreateULBRequest struct { // 负载均衡的名字,默认值为“ULB” ULBName *string `required:"false"` - // ULB所在的VPC的ID。 如果不传则使用默认的VPC,若不传且无默认VPC则接口报错 + // CLB所在的VPC的ID。 如果不传则使用默认的VPC,若不传且无默认VPC则接口报错 VPCId *string `required:"false"` } @@ -507,7 +941,7 @@ type CreateULBResponse struct { // IPv6地址Id IPv6AddressId string - // 负载均衡实例的Id + // 传统型负载均衡实例的Id ULBId string } @@ -526,7 +960,7 @@ func (c *ULBClient) NewCreateULBRequest() *CreateULBRequest { /* API: CreateULB -创建负载均衡实例,可以选择内网或者外网 +创建传统型负载均衡负载均衡实例,可以选择内网或者外网 */ func (c *ULBClient) CreateULB(req *CreateULBRequest) (*CreateULBResponse, error) { var err error @@ -600,7 +1034,7 @@ type CreateVServerRequest struct { // 安全策略组ID,默认值'Default' SecurityPolicyId *string `required:"false"` - // 负载均衡实例ID + // 传统型负载均衡实例ID ULBId *string `required:"true"` // VServer实例名称,默认为"VServer" @@ -630,7 +1064,7 @@ func (c *ULBClient) NewCreateVServerRequest() *CreateVServerRequest { /* API: CreateVServer -创建VServer实例,定义监听的协议和端口以及负载均衡算法 +创建CLB的VServer实例,定义监听的协议和端口以及负载均衡算法 */ func (c *ULBClient) CreateVServer(req *CreateVServerRequest) (*CreateVServerResponse, error) { var err error @@ -646,23 +1080,129 @@ func (c *ULBClient) CreateVServer(req *CreateVServerRequest) (*CreateVServerResp return &res, nil } +// DeleteListenerRequest is request schema for DeleteListener action +type DeleteListenerRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 应用型负载均衡监听器的ID + ListenerId *string `required:"true"` + + // 应用型负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 是否关闭相关监听器的重定向功能。默认为false,即有其他监听器重定向到本监听器,则删除失败。为true时,会先关闭相关监听器的重定向功能,再删除本监听器。默认值为:false + RelatedRedirectDisabled *bool `required:"true"` +} + +// DeleteListenerResponse is response schema for DeleteListener action +type DeleteListenerResponse struct { + response.CommonBase +} + +// NewDeleteListenerRequest will create request of DeleteListener action. +func (c *ULBClient) NewDeleteListenerRequest() *DeleteListenerRequest { + req := &DeleteListenerRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DeleteListener + +删除一个应用型负载均衡监听器 +*/ +func (c *ULBClient) DeleteListener(req *DeleteListenerRequest) (*DeleteListenerResponse, error) { + var err error + var res DeleteListenerResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteListener", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DeleteLoadBalancerRequest is request schema for DeleteLoadBalancer action +type DeleteLoadBalancerRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 应用型负载均衡实例的ID + LoadBalancerId *string `required:"true"` +} + +// DeleteLoadBalancerResponse is response schema for DeleteLoadBalancer action +type DeleteLoadBalancerResponse struct { + response.CommonBase +} + +// NewDeleteLoadBalancerRequest will create request of DeleteLoadBalancer action. +func (c *ULBClient) NewDeleteLoadBalancerRequest() *DeleteLoadBalancerRequest { + req := &DeleteLoadBalancerRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DeleteLoadBalancer + +删除一个应用型负载均衡实例 +*/ +func (c *ULBClient) DeleteLoadBalancer(req *DeleteLoadBalancerRequest) (*DeleteLoadBalancerResponse, error) { + var err error + var res DeleteLoadBalancerResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteLoadBalancer", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DeletePolicyRequest is request schema for DeletePolicy action type DeletePolicyRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"true"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` // 【该字段已废弃,请谨慎使用】 GroupId *string `required:"false" deprecated:"true"` - // 内容转发策略ID + // CLB的内容转发策略ID PolicyId *string `required:"true"` - // VServer 资源ID + // CLB的VServer 资源ID VServerId *string `required:"false"` } @@ -686,7 +1226,7 @@ func (c *ULBClient) NewDeletePolicyRequest() *DeletePolicyRequest { /* API: DeletePolicy -删除内容转发策略 +删除传统型负载均衡的内容转发策略 */ func (c *ULBClient) DeletePolicy(req *DeletePolicyRequest) (*DeletePolicyResponse, error) { var err error @@ -741,7 +1281,63 @@ func (c *ULBClient) DeletePolicyGroup(req *DeletePolicyGroupRequest) (*DeletePol reqCopier := *req - err = c.Client.InvokeAction("DeletePolicyGroup", &reqCopier, &res) + err = c.Client.InvokeAction("DeletePolicyGroup", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DeleteRuleRequest is request schema for DeleteRule action +type DeleteRuleRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 应用型负载均衡监听器的ID + ListenerId *string `required:"true"` + + // 应用型负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 应用型负载均衡的转发规则的ID + RuleId *string `required:"true"` +} + +// DeleteRuleResponse is response schema for DeleteRule action +type DeleteRuleResponse struct { + response.CommonBase +} + +// NewDeleteRuleRequest will create request of DeleteRule action. +func (c *ULBClient) NewDeleteRuleRequest() *DeleteRuleRequest { + req := &DeleteRuleRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DeleteRule + +删除应用型负载均衡监听器的一条转发规则 +*/ +func (c *ULBClient) DeleteRule(req *DeleteRuleRequest) (*DeleteRuleResponse, error) { + var err error + var res DeleteRuleResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteRule", &reqCopier, &res) if err != nil { return &res, err } @@ -853,16 +1449,16 @@ func (c *ULBClient) DeleteSecurityPolicy(req *DeleteSecurityPolicyRequest) (*Del type DeleteULBRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 删除ulb时是否释放绑定的EIP,false标识只解绑EIP,true表示会释放绑定的EIP,默认是false。Anycast IP 此参数无效 + // 删除clb时是否释放绑定的EIP,false标识只解绑EIP,true表示会释放绑定的EIP,默认是false。Anycast IP 此参数无效 ReleaseEip *bool `required:"false"` - // 负载均衡实例的ID + // 传统型负载均衡实例的ID ULBId *string `required:"true"` } @@ -886,7 +1482,7 @@ func (c *ULBClient) NewDeleteULBRequest() *DeleteULBRequest { /* API: DeleteULB -删除负载均衡实例 +删除传统型负载均衡实例 */ func (c *ULBClient) DeleteULB(req *DeleteULBRequest) (*DeleteULBResponse, error) { var err error @@ -906,16 +1502,16 @@ func (c *ULBClient) DeleteULB(req *DeleteULBRequest) (*DeleteULBResponse, error) type DeleteVServerRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"true"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 负载均衡实例的ID + // 传统型负载均衡实例的ID ULBId *string `required:"true"` - // VServer实例的ID + // CLB下的VServer实例的ID VServerId *string `required:"true"` } @@ -939,7 +1535,7 @@ func (c *ULBClient) NewDeleteVServerRequest() *DeleteVServerRequest { /* API: DeleteVServer -删除VServer实例 +删除CLB的VServer实例 */ func (c *ULBClient) DeleteVServer(req *DeleteVServerRequest) (*DeleteVServerResponse, error) { var err error @@ -955,6 +1551,145 @@ func (c *ULBClient) DeleteVServer(req *DeleteVServerRequest) (*DeleteVServerResp return &res, nil } +// DescribeListenersRequest is request schema for DescribeListeners action +type DescribeListenersRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 数据分页值,默认为100 + Limit *int `required:"false"` + + // 应用型负载均衡监听器的ID。若指定ListenerId,则忽略LoadBalancerId。ListenId和LoadBalancerId必选其一 + ListenerId *string `required:"false"` + + // 应用型负载均衡实例的ID。未指定ListenId,则描述指定的LoadBalancerId下的所有监听器。 + LoadBalancerId *string `required:"false"` + + // 数据偏移量,默认为0 + Offset *int `required:"false"` +} + +// DescribeListenersResponse is response schema for DescribeListeners action +type DescribeListenersResponse struct { + response.CommonBase + + // 负载均衡监听器信息 + Listeners []Listener + + // 满足条件的负载均衡监听器总数 + TotalCount int +} + +// NewDescribeListenersRequest will create request of DescribeListeners action. +func (c *ULBClient) NewDescribeListenersRequest() *DescribeListenersRequest { + req := &DescribeListenersRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DescribeListeners + +描述一个指定的监听器或者一个应用型负载均衡实例下的所有监听器 +*/ +func (c *ULBClient) DescribeListeners(req *DescribeListenersRequest) (*DescribeListenersResponse, error) { + var err error + var res DescribeListenersResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeListeners", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DescribeLoadBalancersRequest is request schema for DescribeLoadBalancers action +type DescribeLoadBalancersRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 数据分页值,默认为100 + Limit *string `required:"false"` + + // 负载均衡实例的ID。必须是同一类型的实例,若指定了实例ID,将忽略除Type外的其他过滤条件 + LoadBalancerIds []string `required:"false"` + + // 数据偏移量,默认为0 + Offset *string `required:"false"` + + // 是否获取监听器和后端服务节点的详细信息。默认值:false + ShowDetail *bool `required:"false"` + + // 限定所在的子网 + SubnetId *string `required:"false"` + + // 负载均衡实例的类型。限定枚举值:"Application" / "Network",默认值:"Application" + Type *string `required:"false"` + + // 限定所在的VPC + VPCId *string `required:"false"` +} + +// DescribeLoadBalancersResponse is response schema for DescribeLoadBalancers action +type DescribeLoadBalancersResponse struct { + response.CommonBase + + // 负载均衡实例信息 + LoadBalancers []LoadBalancer + + // 满足条件的负载均衡实例总数 + TotalCount int +} + +// NewDescribeLoadBalancersRequest will create request of DescribeLoadBalancers action. +func (c *ULBClient) NewDescribeLoadBalancersRequest() *DescribeLoadBalancersRequest { + req := &DescribeLoadBalancersRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DescribeLoadBalancers + +描述特定条件下的应用型负载均衡实例或者全部的应用型负载均衡实例 +*/ +func (c *ULBClient) DescribeLoadBalancers(req *DescribeLoadBalancersRequest) (*DescribeLoadBalancersResponse, error) { + var err error + var res DescribeLoadBalancersResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeLoadBalancers", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DescribePolicyGroupRequest is request schema for DescribePolicyGroup action type DescribePolicyGroupRequest struct { request.CommonBase @@ -1011,6 +1746,65 @@ func (c *ULBClient) DescribePolicyGroup(req *DescribePolicyGroupRequest) (*Descr return &res, nil } +// DescribeRulesRequest is request schema for DescribeRules action +type DescribeRulesRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 应用型负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 应用型负载均衡转发规则的ID。指定RuleId,则只描述该规则 + RuleId *string `required:"false"` +} + +// DescribeRulesResponse is response schema for DescribeRules action +type DescribeRulesResponse struct { + response.CommonBase + + // 转发规则信息 + Rules []Rule +} + +// NewDescribeRulesRequest will create request of DescribeRules action. +func (c *ULBClient) NewDescribeRulesRequest() *DescribeRulesRequest { + req := &DescribeRulesRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DescribeRules + +描述一条指定的转发规则或者一个应用型负载均衡监听器下的所有转发规则 +*/ +func (c *ULBClient) DescribeRules(req *DescribeRulesRequest) (*DescribeRulesResponse, error) { + var err error + var res DescribeRulesResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeRules", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // DescribeSSLRequest is request schema for DescribeSSL action type DescribeSSLRequest struct { request.CommonBase @@ -1038,13 +1832,137 @@ type DescribeSSLResponse struct { // SSL证书详细信息,具体结构见 ULBSSLSet DataSet []ULBSSLSet - // 满足条件的SSL证书总数 + // 满足条件的SSL证书总数 + TotalCount int +} + +// NewDescribeSSLRequest will create request of DescribeSSL action. +func (c *ULBClient) NewDescribeSSLRequest() *DescribeSSLRequest { + req := &DescribeSSLRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DescribeSSL + +获取SSL证书信息,仅能获取SSL证书与传统型负载均衡监听器的绑定关系 +*/ +func (c *ULBClient) DescribeSSL(req *DescribeSSLRequest) (*DescribeSSLResponse, error) { + var err error + var res DescribeSSLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeSSL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DescribeSSLV2Request is request schema for DescribeSSLV2 action +type DescribeSSLV2Request struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 数据分页值,默认为20 + Limit *int `required:"false"` + + // 数据偏移量,默认值为0 + Offset *int `required:"false"` + + // SSL证书的Id + SSLId *string `required:"false"` +} + +// DescribeSSLV2Response is response schema for DescribeSSLV2 action +type DescribeSSLV2Response struct { + response.CommonBase + + // SSL证书详细信息,具体结构见SSLInfo + DataSet []SSLInfo + + // 满足条件的SSL证书总数 + TotalCount int +} + +// NewDescribeSSLV2Request will create request of DescribeSSLV2 action. +func (c *ULBClient) NewDescribeSSLV2Request() *DescribeSSLV2Request { + req := &DescribeSSLV2Request{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: DescribeSSLV2 + +获取SSL证书信息,该接口可以同时获取SSL与传统型和应用型负载均衡监听器的绑定关系 +*/ +func (c *ULBClient) DescribeSSLV2(req *DescribeSSLV2Request) (*DescribeSSLV2Response, error) { + var err error + var res DescribeSSLV2Response + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeSSLV2", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// DescribeSecurityPoliciesRequest is request schema for DescribeSecurityPolicies action +type DescribeSecurityPoliciesRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 数据分页值 + Limit *int `required:"false"` + + // 数据偏移量 + Offset *int `required:"false"` + + // 安全策略ID + SecurityPolicyId *string `required:"false"` +} + +// DescribeSecurityPoliciesResponse is response schema for DescribeSecurityPolicies action +type DescribeSecurityPoliciesResponse struct { + response.CommonBase + + // 安全策略列表,每项参数详见SecurityPolicy + DataSet []SecurityPolicy + + // 满足条件的安全策略总数 TotalCount int } -// NewDescribeSSLRequest will create request of DescribeSSL action. -func (c *ULBClient) NewDescribeSSLRequest() *DescribeSSLRequest { - req := &DescribeSSLRequest{} +// NewDescribeSecurityPoliciesRequest will create request of DescribeSecurityPolicies action. +func (c *ULBClient) NewDescribeSecurityPoliciesRequest() *DescribeSecurityPoliciesRequest { + req := &DescribeSecurityPoliciesRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -1055,17 +1973,17 @@ func (c *ULBClient) NewDescribeSSLRequest() *DescribeSSLRequest { } /* -API: DescribeSSL +API: DescribeSecurityPolicies -获取SSL证书信息 +获取安全策略的信息,绑定关系仅能获取安全策略与传统型负载均衡监听器的绑定关系 */ -func (c *ULBClient) DescribeSSL(req *DescribeSSLRequest) (*DescribeSSLResponse, error) { +func (c *ULBClient) DescribeSecurityPolicies(req *DescribeSecurityPoliciesRequest) (*DescribeSecurityPoliciesResponse, error) { var err error - var res DescribeSSLResponse + var res DescribeSecurityPoliciesResponse reqCopier := *req - err = c.Client.InvokeAction("DescribeSSL", &reqCopier, &res) + err = c.Client.InvokeAction("DescribeSecurityPolicies", &reqCopier, &res) if err != nil { return &res, err } @@ -1073,8 +1991,8 @@ func (c *ULBClient) DescribeSSL(req *DescribeSSLRequest) (*DescribeSSLResponse, return &res, nil } -// DescribeSecurityPoliciesRequest is request schema for DescribeSecurityPolicies action -type DescribeSecurityPoliciesRequest struct { +// DescribeSecurityPoliciesV2Request is request schema for DescribeSecurityPoliciesV2 action +type DescribeSecurityPoliciesV2Request struct { request.CommonBase // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) @@ -1093,20 +2011,20 @@ type DescribeSecurityPoliciesRequest struct { SecurityPolicyId *string `required:"false"` } -// DescribeSecurityPoliciesResponse is response schema for DescribeSecurityPolicies action -type DescribeSecurityPoliciesResponse struct { +// DescribeSecurityPoliciesV2Response is response schema for DescribeSecurityPoliciesV2 action +type DescribeSecurityPoliciesV2Response struct { response.CommonBase - // 安全策略列表,每项参数详见SecurityPolicy - DataSet []SecurityPolicy + // 安全策略列表,每项参数详见SecurityPolicyInfo + DataSet []SecurityPolicyInfo // 满足条件的安全策略总数 TotalCount int } -// NewDescribeSecurityPoliciesRequest will create request of DescribeSecurityPolicies action. -func (c *ULBClient) NewDescribeSecurityPoliciesRequest() *DescribeSecurityPoliciesRequest { - req := &DescribeSecurityPoliciesRequest{} +// NewDescribeSecurityPoliciesV2Request will create request of DescribeSecurityPoliciesV2 action. +func (c *ULBClient) NewDescribeSecurityPoliciesV2Request() *DescribeSecurityPoliciesV2Request { + req := &DescribeSecurityPoliciesV2Request{} // setup request with client config c.Client.SetupRequest(req) @@ -1117,17 +2035,17 @@ func (c *ULBClient) NewDescribeSecurityPoliciesRequest() *DescribeSecurityPolici } /* -API: DescribeSecurityPolicies +API: DescribeSecurityPoliciesV2 -获取安全策略的信息 +获取安全策略的信息,可以同时获取安全策略与传统型和应用性负载均衡监听器的绑定关系 */ -func (c *ULBClient) DescribeSecurityPolicies(req *DescribeSecurityPoliciesRequest) (*DescribeSecurityPoliciesResponse, error) { +func (c *ULBClient) DescribeSecurityPoliciesV2(req *DescribeSecurityPoliciesV2Request) (*DescribeSecurityPoliciesV2Response, error) { var err error - var res DescribeSecurityPoliciesResponse + var res DescribeSecurityPoliciesV2Response reqCopier := *req - err = c.Client.InvokeAction("DescribeSecurityPolicies", &reqCopier, &res) + err = c.Client.InvokeAction("DescribeSecurityPoliciesV2", &reqCopier, &res) if err != nil { return &res, err } @@ -1196,7 +2114,7 @@ type DescribeULBRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // ULB所属的业务组ID + // CLB所属的业务组ID BusinessId *string `required:"false"` // 数据分页值,默认为20 @@ -1205,13 +2123,13 @@ type DescribeULBRequest struct { // 数据偏移量,默认为0 Offset *int `required:"false"` - // ULB所属的子网ID + // CLB所属的子网ID SubnetId *string `required:"false"` - // 负载均衡实例的Id。 若指定则返回指定的负载均衡实例的信息; 若不指定则返回当前数据中心中所有的负载均衡实例的信息 + // 传统型负载均衡实例的Id。 若指定则返回指定的传统型负载均衡实例的信息; 若不指定则返回当前数据中心中所有的传统型负载均衡实例的信息 ULBId *string `required:"false"` - // ULB所属的VPC + // CLB所属的VPC VPCId *string `required:"false"` } @@ -1219,10 +2137,10 @@ type DescribeULBRequest struct { type DescribeULBResponse struct { response.CommonBase - // ULB列表,每项参数详见 ULBSet + // CLB列表,每项参数详见 ULBSet DataSet []ULBSet - // 满足条件的ULB总数 + // 满足条件的CLB总数 TotalCount int } @@ -1241,7 +2159,7 @@ func (c *ULBClient) NewDescribeULBRequest() *DescribeULBRequest { /* API: DescribeULB -获取ULB详细信息 +获取CLB详细信息 */ func (c *ULBClient) DescribeULB(req *DescribeULBRequest) (*DescribeULBResponse, error) { var err error @@ -1267,7 +2185,7 @@ type DescribeULBSimpleRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // ULB所属的业务组ID + // CLB所属的业务组ID BusinessId *string `required:"false"` // 数据分页值,默认为10000 @@ -1276,13 +2194,13 @@ type DescribeULBSimpleRequest struct { // 数据偏移量,默认为0 Offset *int `required:"false"` - // ULB所属的子网ID + // CLB所属的子网ID SubnetId *string `required:"false"` - // 负载均衡实例的Id。 若指定则返回指定的负载均衡实例的信息; 若不指定则返回当前数据中心中所有的负载均衡实例的信息 + // 传统型负载均衡实例的Id。 若指定则返回指定的传统型负载均衡实例的信息; 若不指定则返回当前数据中心中所有的传统型负载均衡实例的信息 ULBId *string `required:"false"` - // ULB所属的VPC + // CLB所属的VPC VPCId *string `required:"false"` } @@ -1290,10 +2208,10 @@ type DescribeULBSimpleRequest struct { type DescribeULBSimpleResponse struct { response.CommonBase - // ULB列表,每项参数详见 ULBSimpleSet + // CLB列表,每项参数详见 ULBSimpleSet DataSet []ULBSimpleSet - // 满足条件的ULB总数 + // 满足条件的CLB总数 TotalCount int } @@ -1312,7 +2230,7 @@ func (c *ULBClient) NewDescribeULBSimpleRequest() *DescribeULBSimpleRequest { /* API: DescribeULBSimple -获取ULB信息 +获取CLB信息 */ func (c *ULBClient) DescribeULBSimple(req *DescribeULBSimpleRequest) (*DescribeULBSimpleResponse, error) { var err error @@ -1344,10 +2262,10 @@ type DescribeVServerRequest struct { // 数据偏移量 Offset *int `required:"false"` - // 负载均衡实例的Id + // 传统型负载均衡实例的Id ULBId *string `required:"false"` - // VServer实例的Id;若指定则返回指定的VServer实例的信息; 若不指定则返回当前负载均衡实例下所有VServer的信息 + // CLB下的VServer实例的Id;若指定则返回指定的VServer实例的信息; 若不指定则返回当前传统型负载均衡实例下所有VServer的信息 VServerId *string `required:"false"` } @@ -1377,7 +2295,7 @@ func (c *ULBClient) NewDescribeVServerRequest() *DescribeVServerRequest { /* API: DescribeVServer -获取ULB下的VServer的详细信息 +获取CLB下的VServer的详细信息 */ func (c *ULBClient) DescribeVServer(req *DescribeVServerRequest) (*DescribeVServerResponse, error) { var err error @@ -1397,16 +2315,16 @@ func (c *ULBClient) DescribeVServer(req *DescribeVServerRequest) (*DescribeVServ type ReleaseBackendRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"true"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 后端资源实例的ID(ULB后端ID,非资源自身ID) + // 后端资源实例的ID(CLB后端ID,非资源自身ID) BackendId *string `required:"true"` - // 负载均衡实例的ID + // 传统型负载均衡实例的ID ULBId *string `required:"true"` } @@ -1430,24 +2348,272 @@ func (c *ULBClient) NewReleaseBackendRequest() *ReleaseBackendRequest { /* API: ReleaseBackend -从VServer释放后端资源实例 +从CLB的VServer释放后端资源实例 */ func (c *ULBClient) ReleaseBackend(req *ReleaseBackendRequest) (*ReleaseBackendResponse, error) { var err error var res ReleaseBackendResponse - reqCopier := *req + reqCopier := *req + + err = c.Client.InvokeAction("ReleaseBackend", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// RemoveTargetsRequest is request schema for RemoveTargets action +type RemoveTargetsRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 服务节点的标识ID。不超过20个; + Ids []string `required:"true"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` +} + +// RemoveTargetsResponse is response schema for RemoveTargets action +type RemoveTargetsResponse struct { + response.CommonBase +} + +// NewRemoveTargetsRequest will create request of RemoveTargets action. +func (c *ULBClient) NewRemoveTargetsRequest() *RemoveTargetsRequest { + req := &RemoveTargetsRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: RemoveTargets + +从应用型负载均衡监听器删除后端服务节点 +*/ +func (c *ULBClient) RemoveTargets(req *RemoveTargetsRequest) (*RemoveTargetsResponse, error) { + var err error + var res RemoveTargetsResponse + + reqCopier := *req + + err = c.Client.InvokeAction("RemoveTargets", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// UnBindSecurityPolicyRequest is request schema for UnBindSecurityPolicy action +type UnBindSecurityPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 安全策略ID + SecurityPolicyId *string `required:"true"` +} + +// UnBindSecurityPolicyResponse is response schema for UnBindSecurityPolicy action +type UnBindSecurityPolicyResponse struct { + response.CommonBase +} + +// NewUnBindSecurityPolicyRequest will create request of UnBindSecurityPolicy action. +func (c *ULBClient) NewUnBindSecurityPolicyRequest() *UnBindSecurityPolicyRequest { + req := &UnBindSecurityPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UnBindSecurityPolicy + +批量解绑安全策略,会同时解绑与传统型和应用型负载均衡监听器的绑定关系 +*/ +func (c *ULBClient) UnBindSecurityPolicy(req *UnBindSecurityPolicyRequest) (*UnBindSecurityPolicyResponse, error) { + var err error + var res UnBindSecurityPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UnBindSecurityPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// UnbindSSLRequest is request schema for UnbindSSL action +type UnbindSSLRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // SSL证书的Id + SSLId *string `required:"true"` + + // 所绑定CLB实例ID + ULBId *string `required:"true"` + + // CLB所绑定VServer实例ID + VServerId *string `required:"true"` +} + +// UnbindSSLResponse is response schema for UnbindSSL action +type UnbindSSLResponse struct { + response.CommonBase +} + +// NewUnbindSSLRequest will create request of UnbindSSL action. +func (c *ULBClient) NewUnbindSSLRequest() *UnbindSSLRequest { + req := &UnbindSSLRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UnbindSSL + +从CLB下的VServer解绑SSL证书 +*/ +func (c *ULBClient) UnbindSSL(req *UnbindSSLRequest) (*UnbindSSLResponse, error) { + var err error + var res UnbindSSLResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UnbindSSL", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +// UpdateBackendAttributeRequest is request schema for UpdateBackendAttribute action +type UpdateBackendAttributeRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 后端资源实例的ID(CLB后端ID,非资源自身ID) + BackendId *string `required:"true"` + + // 后端实例状态开关 + Enabled *int `required:"false"` + + // 是否为backup0:主rs1:备rs默认为0 + IsBackup *int `required:"false"` + + // 后端资源服务端口,取值范围[1-65535] + Port *int `required:"false"` + + // 传统型负载均衡资源ID + ULBId *string `required:"true"` + + // 所添加的后端RS权重(在加权轮询算法下有效),取值范围[1-100],默认为1 + Weight *int `required:"false"` +} + +// UpdateBackendAttributeResponse is response schema for UpdateBackendAttribute action +type UpdateBackendAttributeResponse struct { + response.CommonBase +} + +// NewUpdateBackendAttributeRequest will create request of UpdateBackendAttribute action. +func (c *ULBClient) NewUpdateBackendAttributeRequest() *UpdateBackendAttributeRequest { + req := &UpdateBackendAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UpdateBackendAttribute + +更新CLB后端资源实例(服务节点)属性 +*/ +func (c *ULBClient) UpdateBackendAttribute(req *UpdateBackendAttributeRequest) (*UpdateBackendAttributeResponse, error) { + var err error + var res UpdateBackendAttributeResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateBackendAttribute", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + +/* +UpdateBackendBatchParamAttributes is request schema for complex param +*/ +type UpdateBackendBatchParamAttributes struct { + + // 后端资源实例的ID(ULB后端ID,非资源自身ID) + BackendId *string `required:"true"` + + // 后端实例状态开关 + Enabled *int `required:"false"` + + // 是否为backup 0:主rs 1:备rs 默认为0 + IsBackup *int `required:"false"` - err = c.Client.InvokeAction("ReleaseBackend", &reqCopier, &res) - if err != nil { - return &res, err - } + // 后端资源服务端口,取值范围[1-65535] + Port *int `required:"false"` - return &res, nil + // 所添加的后端RS权重(在加权轮询算法下有效),取值范围[0-100],默认为1 + Weight *int `required:"false"` } -// UnBindSecurityPolicyRequest is request schema for UnBindSecurityPolicy action -type UnBindSecurityPolicyRequest struct { +// UpdateBackendBatchRequest is request schema for UpdateBackendBatch action +type UpdateBackendBatchRequest struct { request.CommonBase // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) @@ -1456,18 +2622,24 @@ type UnBindSecurityPolicyRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 安全策略ID - SecurityPolicyId *string `required:"true"` + // + Attributes []UpdateBackendBatchParamAttributes `required:"false"` + + // 负载均衡资源ID + ULBId *string `required:"true"` } -// UnBindSecurityPolicyResponse is response schema for UnBindSecurityPolicy action -type UnBindSecurityPolicyResponse struct { +// UpdateBackendBatchResponse is response schema for UpdateBackendBatch action +type UpdateBackendBatchResponse struct { response.CommonBase + + // 返回ulb对每个rs的修改是否成功 + BackendSet []BackendMsg } -// NewUnBindSecurityPolicyRequest will create request of UnBindSecurityPolicy action. -func (c *ULBClient) NewUnBindSecurityPolicyRequest() *UnBindSecurityPolicyRequest { - req := &UnBindSecurityPolicyRequest{} +// NewUpdateBackendBatchRequest will create request of UpdateBackendBatch action. +func (c *ULBClient) NewUpdateBackendBatchRequest() *UpdateBackendBatchRequest { + req := &UpdateBackendBatchRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -1478,17 +2650,17 @@ func (c *ULBClient) NewUnBindSecurityPolicyRequest() *UnBindSecurityPolicyReques } /* -API: UnBindSecurityPolicy +API: UpdateBackendBatch -批量解绑安全策略 +批量更新ULB后端资源实例(服务节点)属性 */ -func (c *ULBClient) UnBindSecurityPolicy(req *UnBindSecurityPolicyRequest) (*UnBindSecurityPolicyResponse, error) { +func (c *ULBClient) UpdateBackendBatch(req *UpdateBackendBatchRequest) (*UpdateBackendBatchResponse, error) { var err error - var res UnBindSecurityPolicyResponse + var res UpdateBackendBatchResponse reqCopier := *req - err = c.Client.InvokeAction("UnBindSecurityPolicy", &reqCopier, &res) + err = c.Client.InvokeAction("UpdateBackendBatch", &reqCopier, &res) if err != nil { return &res, err } @@ -1496,34 +2668,100 @@ func (c *ULBClient) UnBindSecurityPolicy(req *UnBindSecurityPolicyRequest) (*UnB return &res, nil } -// UnbindSSLRequest is request schema for UnbindSSL action -type UnbindSSLRequest struct { +/* +UpdateListenerAttributeParamHealthCheckConfig is request schema for complex param +*/ +type UpdateListenerAttributeParamHealthCheckConfig struct { + + // (应用型专用)HTTP检查域名 + Domain *string `required:"false"` + + // 是否开启健康检查功能。暂时不支持关闭;默认值为:true + Enabled *bool `required:"false"` + + // (应用型专用)HTTP检查路径 + Path *string `required:"false"` + + // 健康检查方式。应用型限定取值:“Port”/"HTTP";默认值:“Port” + Type *string `required:"false"` +} + +/* +UpdateListenerAttributeParamStickinessConfig is request schema for complex param +*/ +type UpdateListenerAttributeParamStickinessConfig struct { + + // (应用型专用)自定义Cookie。当StickinessType取值"UserDefined"时有效;限定字符长度:[0-255] + CookieName *string `required:"false"` + + // 是否开启会话保持功能。应用型负载均衡实例基于Cookie实现,网络型负载均衡则基于源IP,保证在对应的空闲超时时间内,同一个源IP送到同一个服务节点。默认值为:false + Enabled *bool `required:"false"` + + // (应用型专用)Cookie处理方式。限定枚举值:"ServerInsert" / "UserDefined",默认值为:“ServerInsert” + Type *string `required:"false"` +} + +// UpdateListenerAttributeRequest is request schema for UpdateListenerAttribute action +type UpdateListenerAttributeRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"true"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // SSL证书的Id - SSLId *string `required:"true"` + // (应用型专用)服务器默认证书ID。仅HTTPS监听支持 + Certificates []string `required:"false"` - // 所绑定ULB实例ID - ULBId *string `required:"true"` + // (应用型专用)是否开启数据压缩功能。目前只支持使用gzip对特定文件类型进行压缩 + CompressionEnabled *bool `required:"false"` - // 所绑定VServer实例ID - VServerId *string `required:"true"` + // (应用型专用)是否开启HTTP/2特性。仅HTTPS监听支持开启 + HTTP2Enabled *bool `required:"false"` + + // + HealthCheckConfig *UpdateListenerAttributeParamHealthCheckConfig `required:"false"` + + // 连接空闲超时时间。单位:秒。应用型限定取值:[1-86400] + IdleTimeout *int `required:"false"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 监听器的名称。限定字符长度:[1-255];限定特殊字符,仅支持:-_. + Name *string `required:"false"` + + // (应用型专用)是否开启HTTP重定向到HTTPS。仅HTTP监听支持开启 + RedirectEnabled *bool `required:"false"` + + // (应用型专用)重定向端口。限定取值:[1-65535] + RedirectPort *int `required:"false"` + + // 监听器的备注信息。限定字符长度:[0-255] + Remark *string `required:"false"` + + // 负载均衡算法。应用型限定取值:"Roundrobin"/"Source"/"WeightRoundrobin"/" Leastconn"/"Backup" + Scheduler *string `required:"false"` + + // (应用型专用)安全策略组ID。仅HTTPS监听支持绑定。“Default”,表示绑定原生策略 + SecurityPolicyId *string `required:"false"` + + // + StickinessConfig *UpdateListenerAttributeParamStickinessConfig `required:"false"` } -// UnbindSSLResponse is response schema for UnbindSSL action -type UnbindSSLResponse struct { +// UpdateListenerAttributeResponse is response schema for UpdateListenerAttribute action +type UpdateListenerAttributeResponse struct { response.CommonBase } -// NewUnbindSSLRequest will create request of UnbindSSL action. -func (c *ULBClient) NewUnbindSSLRequest() *UnbindSSLRequest { - req := &UnbindSSLRequest{} +// NewUpdateListenerAttributeRequest will create request of UpdateListenerAttribute action. +func (c *ULBClient) NewUpdateListenerAttributeRequest() *UpdateListenerAttributeRequest { + req := &UpdateListenerAttributeRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -1534,17 +2772,17 @@ func (c *ULBClient) NewUnbindSSLRequest() *UnbindSSLRequest { } /* -API: UnbindSSL +API: UpdateListenerAttribute -从VServer解绑SSL证书 +更新一个应用型负载均衡监听器的属性 */ -func (c *ULBClient) UnbindSSL(req *UnbindSSLRequest) (*UnbindSSLResponse, error) { +func (c *ULBClient) UpdateListenerAttribute(req *UpdateListenerAttributeRequest) (*UpdateListenerAttributeResponse, error) { var err error - var res UnbindSSLResponse + var res UpdateListenerAttributeResponse reqCopier := *req - err = c.Client.InvokeAction("UnbindSSL", &reqCopier, &res) + err = c.Client.InvokeAction("UpdateListenerAttribute", &reqCopier, &res) if err != nil { return &res, err } @@ -1552,8 +2790,23 @@ func (c *ULBClient) UnbindSSL(req *UnbindSSLRequest) (*UnbindSSLResponse, error) return &res, nil } -// UpdateBackendAttributeRequest is request schema for UpdateBackendAttribute action -type UpdateBackendAttributeRequest struct { +/* +UpdateLoadBalancerAttributeParamAccessLogConfig is request schema for complex param +*/ +type UpdateLoadBalancerAttributeParamAccessLogConfig struct { + + // (应用型专用)是否开启访问日志记录功能 + Enabled *bool `required:"false"` + + // (应用型专用)用于存储访问日志的bucket + US3BucketName *string `required:"false"` + + // (应用型专用)上传访问日志到bucket所需的token + US3TokenId *string `required:"false"` +} + +// UpdateLoadBalancerAttributeRequest is request schema for UpdateLoadBalancerAttribute action +type UpdateLoadBalancerAttributeRequest struct { request.CommonBase // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) @@ -1562,33 +2815,30 @@ type UpdateBackendAttributeRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 后端资源实例的ID(ULB后端ID,非资源自身ID) - BackendId *string `required:"true"` - - // 后端实例状态开关 - Enabled *int `required:"false"` + // + AccessLogConfig *UpdateLoadBalancerAttributeParamAccessLogConfig `required:"false"` - // 是否为backup0:主rs1:备rs默认为0 - IsBackup *int `required:"false"` + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` - // 后端资源服务端口,取值范围[1-65535] - Port *int `required:"false"` + // 负载均衡实例的名称,不传则默认不修改 + Name *string `required:"false"` - // 负载均衡资源ID - ULBId *string `required:"true"` + // 负载均衡实例的备注信息,不传则默认不修改,限定字符长度:[0-255] + Remark *string `required:"false"` - // 所添加的后端RS权重(在加权轮询算法下有效),取值范围[1-100],默认为1 - Weight *int `required:"false"` + // 负载均衡实例所属的业务组ID,不传则默认不修改 + Tag *string `required:"false"` } -// UpdateBackendAttributeResponse is response schema for UpdateBackendAttribute action -type UpdateBackendAttributeResponse struct { +// UpdateLoadBalancerAttributeResponse is response schema for UpdateLoadBalancerAttribute action +type UpdateLoadBalancerAttributeResponse struct { response.CommonBase } -// NewUpdateBackendAttributeRequest will create request of UpdateBackendAttribute action. -func (c *ULBClient) NewUpdateBackendAttributeRequest() *UpdateBackendAttributeRequest { - req := &UpdateBackendAttributeRequest{} +// NewUpdateLoadBalancerAttributeRequest will create request of UpdateLoadBalancerAttribute action. +func (c *ULBClient) NewUpdateLoadBalancerAttributeRequest() *UpdateLoadBalancerAttributeRequest { + req := &UpdateLoadBalancerAttributeRequest{} // setup request with client config c.Client.SetupRequest(req) @@ -1599,17 +2849,17 @@ func (c *ULBClient) NewUpdateBackendAttributeRequest() *UpdateBackendAttributeRe } /* -API: UpdateBackendAttribute +API: UpdateLoadBalancerAttribute -更新ULB后端资源实例(服务节点)属性 +更新一个应用型负载均衡实例的属性 */ -func (c *ULBClient) UpdateBackendAttribute(req *UpdateBackendAttributeRequest) (*UpdateBackendAttributeResponse, error) { +func (c *ULBClient) UpdateLoadBalancerAttribute(req *UpdateLoadBalancerAttributeRequest) (*UpdateLoadBalancerAttributeResponse, error) { var err error - var res UpdateBackendAttributeResponse + var res UpdateLoadBalancerAttributeResponse reqCopier := *req - err = c.Client.InvokeAction("UpdateBackendAttribute", &reqCopier, &res) + err = c.Client.InvokeAction("UpdateLoadBalancerAttribute", &reqCopier, &res) if err != nil { return &res, err } @@ -1627,7 +2877,7 @@ type UpdatePolicyRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 内容转发策略应用的后端资源实例的ID,来源于 AllocateBackend 返回的 BackendId,不传表示更新转发节点为空 + // 内容转发策略应用的后端资源实例的ID(CLB的后端节点Id),来源于 AllocateBackend 返回的 BackendId,不传表示更新转发节点为空 BackendId []string `required:"false"` // 内容转发规则中域名的匹配方式,默认与原本一致。枚举值:Regular,正则;Wildcard,泛域名 @@ -1636,7 +2886,7 @@ type UpdatePolicyRequest struct { // 内容转发匹配字段 Match *string `required:"true"` - // 转发规则的ID,当Type为Default时,可以不传或为空 + // 传统型负载均衡转发规则的ID,当Type为Default时,可以不传或为空 PolicyId *string `required:"false"` // 策略优先级,1-9999;只针对路径规则生效 @@ -1645,10 +2895,10 @@ type UpdatePolicyRequest struct { // 内容转发匹配字段的类型,枚举值:Domain -> 域名转发规则;Path -> 路径转发规则;Default -> 默认转发规则,不传默认值Domain Type *string `required:"false"` - // 需要添加内容转发策略的负载均衡实例ID + // 需要添加内容转发策略的传统型负载均衡实例ID ULBId *string `required:"true"` - // 需要添加内容转发策略的VServer实例ID,只支持请求代理模式下,HTTP或HTTPS协议的VServer + // 需要添加内容转发策略的VServer实例ID,只支持请求代理模式下,HTTP或HTTPS协议的CLB下的VServer VServerId *string `required:"true"` } @@ -1675,7 +2925,7 @@ func (c *ULBClient) NewUpdatePolicyRequest() *UpdatePolicyRequest { /* API: UpdatePolicy -更新内容转发规则,包括转发规则后的服务节点 +更新传统型负载均衡内容转发规则,包括转发规则后的服务节点 */ func (c *ULBClient) UpdatePolicy(req *UpdatePolicyRequest) (*UpdatePolicyResponse, error) { var err error @@ -1741,6 +2991,140 @@ func (c *ULBClient) UpdatePolicyGroupAttribute(req *UpdatePolicyGroupAttributeRe return &res, nil } +/* +UpdateRuleAttributeParamRuleActionsForwardConfigTargets is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleActionsForwardConfigTargets struct { + + // 转发的后端服务节点的标识ID。限定在监听器的服务节点池里;数组长度可以是0;转发服务节点配置的数组长度不为0时,Id必填 + Id *string `required:"false"` + + // 转发的后端服务节点的权重。仅监听器负载均衡算法是加权轮询是有效 + Weight *int `required:"false"` +} + +/* +UpdateRuleAttributeParamRuleConditionsPathConfig is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleConditionsPathConfig struct { + + // 取值。暂时只支持数组长度为1;取值需符合相关条件;修改路径匹配时必填 + Values []string `required:"false"` +} + +/* +UpdateRuleAttributeParamRuleConditionsHostConfig is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleConditionsHostConfig struct { + + // 匹配方式。限定枚举值:"Regular"/"Wildcard",默认值:"Regular" + MatchMode *string `required:"false"` + + // 取值。暂时只支持数组长度为1;取值需符合相关匹配方式的条件;修改域名匹配时必填 + Values []string `required:"false"` +} + +/* +UpdateRuleAttributeParamRuleActionsForwardConfig is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleActionsForwardConfig struct { + + // + Targets []UpdateRuleAttributeParamRuleActionsForwardConfigTargets `required:"false"` +} + +/* +UpdateRuleAttributeParamRuleConditions is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleConditions struct { + + // + HostConfig *UpdateRuleAttributeParamRuleConditionsHostConfig `required:"false"` + + // + PathConfig *UpdateRuleAttributeParamRuleConditionsPathConfig `required:"false"` + + // 匹配条件类型。限定枚举值:"Host"/"Path";RuleConditions数组长度不为0时必填 + Type *string `required:"false"` +} + +/* +UpdateRuleAttributeParamRuleActions is request schema for complex param +*/ +type UpdateRuleAttributeParamRuleActions struct { + + // + ForwardConfig *UpdateRuleAttributeParamRuleActionsForwardConfig `required:"false"` + + // 动作类型。限定枚举值:"Forward";RuleActions数组长度不为0时必填 + Type *string `required:"false"` +} + +// UpdateRuleAttributeRequest is request schema for UpdateRuleAttribute action +type UpdateRuleAttributeRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // 当转发的服务节点为空时,规则是否忽略。默认转发规则不可更改 + Pass *bool `required:"false"` + + // + RuleActions []UpdateRuleAttributeParamRuleActions `required:"false"` + + // + RuleConditions []UpdateRuleAttributeParamRuleConditions `required:"false"` + + // 转发规则的ID + RuleId *string `required:"true"` +} + +// UpdateRuleAttributeResponse is response schema for UpdateRuleAttribute action +type UpdateRuleAttributeResponse struct { + response.CommonBase +} + +// NewUpdateRuleAttributeRequest will create request of UpdateRuleAttribute action. +func (c *ULBClient) NewUpdateRuleAttributeRequest() *UpdateRuleAttributeRequest { + req := &UpdateRuleAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UpdateRuleAttribute + +更新应用型负载均衡监听器的一条转发规则的属性 +*/ +func (c *ULBClient) UpdateRuleAttribute(req *UpdateRuleAttributeRequest) (*UpdateRuleAttributeResponse, error) { + var err error + var res UpdateRuleAttributeResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateRuleAttribute", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // UpdateSSLAttributeRequest is request schema for UpdateSSLAttribute action type UpdateSSLAttributeRequest struct { request.CommonBase @@ -1804,16 +3188,16 @@ type UpdateSSLBindingRequest struct { // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // 所操作VServer实例ID(仅ListenerId传参时,将更换该Vserver所有原证书为OldSSLId的绑定关系;LoadBalancerId和ListenerId都不传参则将更新该项目下所有原证书为OldSSLId的绑定关系;若LoadBalancerId与ListenerId皆有传参,则会强校验ULB与Vsserver的所属关系,将更换该ulb下vserver所绑定的OldSSLId为NewSSLId) + // 所操作监听器实例ID(仅ListenerId传参时,将更换该监听器所有原证书为OldSSLId的绑定关系;LoadBalancerId和ListenerId都不传参则将更新该项目下所有原证书为OldSSLId的绑定关系;若LoadBalancerId与ListenerId皆有传参,则会强校验ULB与Vsserver的所属关系,将更换该ulb下vserver所绑定的OldSSLId为NewSSLId)(监听器指VServer或Listener) ListenerId *string `required:"false"` - // 所操作ULB实例ID(仅LoadBalancerId传参时,将更换该ULB所有原证书为OldSSLId的绑定关系;LoadBalancerId和ListenerId都不传参则将更新该项目下所有原证书为OldSSLId的绑定关系) + // 所操作LB实例ID(仅LoadBalancerId传参时,将更换该LB所有原证书为OldSSLId的绑定关系;LoadBalancerId和ListenerId都不传参则将更新该项目下所有原证书为OldSSLId的绑定关系)(LB指CLB或ALB) LoadBalancerId *string `required:"false"` - // VServer实例需要绑定的新的证书 + // 监听器实例需要绑定的新的证书 NewSSLId *string `required:"true"` - // VServer实例绑定的旧的证书 + // 监听器实例绑定的旧的证书 OldSSLId *string `required:"true"` } @@ -1837,7 +3221,7 @@ func (c *ULBClient) NewUpdateSSLBindingRequest() *UpdateSSLBindingRequest { /* API: UpdateSSLBinding -将VServer绑定的证书更换为另一个证书 +将传统型或应用型负载均衡监听器绑定的证书更换为另一个证书, */ func (c *ULBClient) UpdateSSLBinding(req *UpdateSSLBindingRequest) (*UpdateSSLBindingResponse, error) { var err error @@ -1912,6 +3296,80 @@ func (c *ULBClient) UpdateSecurityPolicy(req *UpdateSecurityPolicyRequest) (*Upd return &res, nil } +/* +UpdateTargetsAttributeParamTargets is request schema for complex param +*/ +type UpdateTargetsAttributeParamTargets struct { + + // 服务节点是否启用。默认值true;要更新的Targets数组长度至少为1,不超过20个 + Enabled *bool `required:"false"` + + // 服务节点的标识ID。限定枚举值:"UHost" / "UNI"/"UPM"/"IP";要更新的Targets数组长度至少为1,不超过20个 + Id *string `required:"false"` + + // 服务节点是否为备节点。默认值false;要更新的Targets数组长度至少为1,不超过20个 + IsBackup *bool `required:"false"` + + // 服务节点的权重。限定取值:[1-100],默认值1;仅在加权轮询算法时有效;要更新的Targets数组长度至少为1,不超过20个 + Weight *int `required:"false"` +} + +// UpdateTargetsAttributeRequest is request schema for UpdateTargetsAttribute action +type UpdateTargetsAttributeRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + // Region *string `required:"true"` + + // 监听器的ID + ListenerId *string `required:"true"` + + // 负载均衡实例的ID + LoadBalancerId *string `required:"true"` + + // + Targets []UpdateTargetsAttributeParamTargets `required:"false"` +} + +// UpdateTargetsAttributeResponse is response schema for UpdateTargetsAttribute action +type UpdateTargetsAttributeResponse struct { + response.CommonBase +} + +// NewUpdateTargetsAttributeRequest will create request of UpdateTargetsAttribute action. +func (c *ULBClient) NewUpdateTargetsAttributeRequest() *UpdateTargetsAttributeRequest { + req := &UpdateTargetsAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +/* +API: UpdateTargetsAttribute + +更新应用型负载均衡监听器后端服务节点的属性 +*/ +func (c *ULBClient) UpdateTargetsAttribute(req *UpdateTargetsAttributeRequest) (*UpdateTargetsAttributeResponse, error) { + var err error + var res UpdateTargetsAttributeResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateTargetsAttribute", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} + // UpdateULBAttributeRequest is request schema for UpdateULBAttribute action type UpdateULBAttributeRequest struct { request.CommonBase @@ -1946,7 +3404,7 @@ type UpdateULBAttributeRequest struct { // 用于指定上传到bucket所需的token,与TokenId选填其一即可 TokenName *string `required:"false"` - // ULB资源ID + // CLB资源ID ULBId *string `required:"true"` } @@ -1970,7 +3428,7 @@ func (c *ULBClient) NewUpdateULBAttributeRequest() *UpdateULBAttributeRequest { /* API: UpdateULBAttribute -更新ULB名字业务组备注等属性字段 +更新CLB名字业务组备注等属性字段 */ func (c *ULBClient) UpdateULBAttribute(req *UpdateULBAttributeRequest) (*UpdateULBAttributeResponse, error) { var err error @@ -2038,10 +3496,10 @@ type UpdateVServerAttributeRequest struct { // 安全策略组ID SecurityPolicyId *string `required:"false"` - // 负载均衡实例ID + // 传统型负载均衡实例ID ULBId *string `required:"true"` - // VServer实例ID + // 传统型负载均衡VServer实例ID VServerId *string `required:"true"` // VServer实例名称,若无此字段则不做修改 @@ -2068,7 +3526,7 @@ func (c *ULBClient) NewUpdateVServerAttributeRequest() *UpdateVServerAttributeRe /* API: UpdateVServerAttribute -更新VServer实例属性 +更新传统型负载均衡VServer实例属性 */ func (c *ULBClient) UpdateVServerAttribute(req *UpdateVServerAttributeRequest) (*UpdateVServerAttributeResponse, error) { var err error diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go index 0a0cfc93..a936bea4 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/models.go @@ -2,6 +2,45 @@ package ulb +/* +TargetSet - 服务节点信息 +*/ +type TargetSet struct { + + // 服务节点是否启用。 默认值:true + Enabled bool + + // 服务节点的标识ID。 + Id string + + // 服务节点是否为备节点。 默认值:false + IsBackup bool + + // 服务节点的端口。限定取值:[1-65535]; 默认值:80 + Port int + + // 服务节点的IP。在IP类型时,必传 + ResourceIP string + + // 服务节点的资源ID。在非IP类型时,必传 + ResourceId string + + // 服务节点的类型。限定枚举值:UHost -> 云主机,UNI -> 虚拟网卡,UPM -> 物理云主机,IP -> IP类型; 默认值:"UHost"; 非IP类型,如果该资源有多个IP,将只能添加主IP; 非IP类型,展示时,会显示相关资源信息,IP类型只展示IP信息。 在相关资源被删除时,非IP类型会把相关资源从lb中剔除,IP类型不保证这个逻辑 + ResourceType string + + // 服务节点的健康检查状态。限定枚举值:Healthy -> 健康,Unhealthy -> 不健康 + State string + + // 服务节点的子网资源ID。在IP类型时,必传 + SubnetId string + + // 服务节点的VPC资源ID。在IP类型时,必传 + VPCId string + + // 服务节点的权重。限定取值:[1-100]; 仅在加权轮询算法时有效; 默认值:1 + Weight int +} + /* BackendSet - */ @@ -14,6 +53,357 @@ type BackendSet struct { ResourceId string } +/* +ForwardTargetSet - 转发的后端服务节点 +*/ +type ForwardTargetSet struct { + + // 服务节点的标识ID + Id string + + // 权重。仅监听器负载均衡算法是加权轮询是有效;取值范围[1-100],默认值为1 + Weight int +} + +/* +PathConfigSet - 路径相关配置 +*/ +type PathConfigSet struct { + + // 取值。暂时只支持数组长度为1; 取值需符合相关匹配方式的条件 + Values []string +} + +/* +HostConfigSet - 域名相关配置 +*/ +type HostConfigSet struct { + + // 匹配方式。限定枚举值:Regular-正则,Wildcard-泛域名; 默认值:Regular + MatchMode string + + // 取值。暂时只支持数组长度为1; 取值需符合相关匹配方式的条件 + Values []string +} + +/* +ForwardConfigSet - 转发服务节点相关配置 +*/ +type ForwardConfigSet struct { + + // 转发的后端服务节点。限定在监听器的服务节点池里;数组长度可以为0。具体结构详见 ForwardTargetSet + Targets []ForwardTargetSet +} + +/* +RuleCondition - 转发规则匹配条件 +*/ +type RuleCondition struct { + + // 域名相关配置。Type为Host时必填。具体结构详见 HostConfigSet + HostConfig HostConfigSet + + // 路径相关配置。Type为Path时必填。具体结构详见 PathConfigSet + PathConfig PathConfigSet + + // 匹配条件类型。限定枚举值:Host,Path + Type string +} + +/* +RuleAction - 转发动作 +*/ +type RuleAction struct { + + // 转发服务节点相关配置。 具体结构详见 ForwardConfigSet + ForwardConfig ForwardConfigSet + + // 动作类型。限定枚举值:Forward + Type string +} + +/* +StickinessConfigSet - 会话保持相关配置 +*/ +type StickinessConfigSet struct { + + // (应用型专用)自定义Cookie。当StickinessType取值"UserDefined"时有效 + CookieName string + + // 是否开启会话保持功能。应用型负载均衡实例基于Cookie实现 + Enabled bool + + // (应用型专用)Cookie处理方式。限定枚举值: ServerInsert -> 自动生成KEY;UserDefined -> 用户自定义KEY + Type string +} + +/* +HealthCheckConfigSet - 健康检查相关配置 +*/ +type HealthCheckConfigSet struct { + + // (应用型专用)HTTP检查域名。 当Type为HTTP时,此字段有意义,代表HTTP检查域名 + Domain string + + // 是否开启健康检查功能。暂时不支持关闭。 默认值为:true + Enabled bool + + // (应用型专用)HTTP检查路径。当Type为HTTP时,此字段有意义,代表HTTP检查路径 + Path string + + // 健康检查方式。应用型限定取值: Port -> 端口检查;HTTP -> HTTP检查; 默认值:Port + Type string +} + +/* +Rule - (应用型专用)转发规则信息 +*/ +type Rule struct { + + // 是否为默认转发规则 + IsDefault bool + + // 当转发的服务节点为空时,规则是否忽略 + Pass bool + + // 转发动作。具体规则详见RuleAction + RuleActions []RuleAction + + // 转发规则匹配条件。具体结构详见 RuleCondition + RuleConditions []RuleCondition + + // 转发规则的ID + RuleId string +} + +/* +Certificate - (应用型专用)服务器证书信息 +*/ +type Certificate struct { + + // 是否为默认证书 + IsDefault bool + + // 证书ID + SSLId string +} + +/* +Target - 服务节点信息 +*/ +type Target struct { + + // 服务节点是否启用 + Enabled bool + + // 服务节点的标识ID。为ALB/NLB中使用,与资源自身ID无关,可用于UpdateTargetsAttribute/RemoveTargets + Id string + + // 服务节点是否为备节点 + IsBackup bool + + // 服务节点的端口 + Port int + + // 服务节点的IP + ResourceIP string + + // 服务节点的资源ID + ResourceId string + + // 服务节点的资源名称 + ResourceName string + + // 服务节点的类型。限定枚举值:UHost -> 云主机,UNI -> 虚拟网卡,UPM -> 物理云主机,IP -> IP类型; 默认值:"UHost"; 非IP类型,如果该资源有多个IP,将只能添加主IP; 非IP类型,展示时,会显示相关资源信息,IP类型只展示IP信息。 在相关资源被删除时,非IP类型会把相关资源从lb中剔除,IP类型不保证这个逻辑 + ResourceType string + + // 服务节点的健康检查状态。限定枚举值:Healthy -> 健康,Unhealthy -> 不健康 + State string + + // 服务节点的子网资源ID + SubnetId string + + // 服务节点的VPC资源ID + VPCId string + + // 服务节点的权重。仅在加权轮询算法时有效 + Weight int +} + +/* +Listener - 负载均衡监听器信息 +*/ +type Listener struct { + + // (应用型专用)服务器默认证书ID。仅HTTPS监听支持。具体接口详见 Certificate + Certificates []Certificate + + // (应用型专用)是否开启数据压缩功能。目前只支持使用gzip对特定文件类型进行压缩 + CompressionEnabled bool + + // (应用型专用)是否开启HTTP/2特性。仅HTTPS监听支持开启 + HTTP2Enabled bool + + // 健康检查相关配置。具体结构详见 HealthCheckConfigSet + HealthCheckConfig HealthCheckConfigSet + + // 连接空闲超时时间。单位:秒 + IdleTimeout int + + // 监听器的ID + ListenerId string + + // 监听器的监听端口 + ListenerPort int + + // 监听协议。应用型限定取值: HTTP、HTTPS + ListenerProtocol string + + // 监听器的名称 + Name string + + // (应用型专用)是否开启HTTP重定向到HTTPS。仅HTTP监听支持开启 + RedirectEnabled bool + + // (应用型专用)重定向端口 + RedirectPort int + + // 监听器的备注信息 + Remark string + + // (应用型专用)转发规则信息 + Rules []Rule + + // 负载均衡算法。应用型限定取值:Roundrobin -> 轮询;Source -> 源地址; WeightRoundrobin -> 加权轮询; Leastconn -> 最小连接数;Backup ->主备模式 + Scheduler string + + // (应用型专用)安全策略组ID。仅HTTPS监听支持绑定;Default -> 原生策略 + SecurityPolicyId string + + // listener健康状态。限定枚举值:Healthy -> 健康,Unhealthy -> 不健康,PartialHealth -> 部分健康,None -> 无节点状态 + State string + + // 会话保持相关配置。具体结构详见 StickinessConfigSet + StickinessConfig StickinessConfigSet + + // 添加的服务节点信息。具体结构详见 Target + Targets []Target +} + +/* +IPInfo - 绑定的IP信息 +*/ +type IPInfo struct { + + // 网络模式。 限定枚举值:Internet -> 互联网,Intranet -> 内联网 + AddressType string + + // 带宽值。单位M + Bandwidth int + + // 带宽类型。限定枚举值:1 -> 共享带宽,0 -> 普通带宽类型 + BandwidthType int + + // IP地址 + IP string + + // IP协议版本 + IPVersion string + + // 唯一标识ID + Id string + + // 外网IP的运营商信息。枚举值为:Telecom -> 电信,Unicom -> 联通,International -> 国际IP,Bgp -> BGP,Duplet -> 双线(电信+联通双线路),BGPPro -> 精品BGP,China-mobile -> 中国移动,Anycast -> AnycastEIP + OperatorName string +} + +/* +AccessLogConfigSet - (应用型专用)访问日志相关配置 +*/ +type AccessLogConfigSet struct { + + // (应用型专用)是否开启访问日志记录功能 + Enabled bool + + // (应用型专用)用于存储访问日志的bucket + US3BucketName string + + // (应用型专用)上传访问日志到bucket所需的token + US3TokenId string +} + +/* +FirewallSet - ulb防火墙信息 +*/ +type FirewallSet struct { + + // 防火墙ID + FirewallId string + + // 防火墙名称 + FirewallName string +} + +/* +LoadBalancer - 负载均衡实例信息 +*/ +type LoadBalancer struct { + + // (应用型专用)访问日志相关配置 + AccessLogConfig AccessLogConfigSet + + // 是否开启自动续费 + AutoRenewEnabled bool + + // 付费模式 + ChargeType string + + // 负载均衡实例创建时间。格式为Unix Timestamp + CreateTime int + + // 防火墙信息 + Firewall FirewallSet + + // 绑定的IP信息。具体结构详见 IPInfo + IPInfos []IPInfo + + // 负载均衡实例支持的IP协议版本 + IPVersion string + + // 监听器信息。当ShowDetail为false时,为空 + Listeners []Listener + + // 负载均衡实例的ID + LoadBalancerId string + + // 负载均衡实例的名称 + Name string + + // 有效期(计费)。格式为Unix Timestamp + PurchaseValue int + + // 负载均衡实例的备注信息 + Remark string + + // 应用型实例的代理IP或网络型FULLNAT模式下snat所用的IP + SnatIPs []string + + // lb状态:Normal-正常;Arrears-欠费停服 + Status string + + // 负载均衡实例所属的子网资源ID。负载均衡实例的内网VIP和SNAT场景的源IP限定在该子网内;指定子网不影响添加后端服务节点时的范围,依旧是整个VPC下支持的资源 + SubnetId string + + // 负载均衡实例所属的业务组ID + Tag string + + // 负载均衡实例的类型。限定枚举值:Application -> 应用型,Network -> 网络型 + Type string + + // 负载均衡实例所属的VPC资源ID + VPCId string +} + /* UlbPolicyBackendSet - DescribePolicyGroup */ @@ -100,6 +490,75 @@ type ULBSSLSet struct { // SSL证书的HASH值 HashValue string + // 证书过期时间,只有当SSLSource为1时才出现 + NotAfter int + + // 证书颁发时间,只有当SSLSource为1时才出现 + NotBefore int + + // SSL证书的内容 + SSLContent string + + // SSL证书的Id + SSLId string + + // SSL证书的名字 + SSLName string + + // SSL证书来源,SSL证书来源,0代表证书来自于ULB平台,1代表证书来自于USSL平台 + SSLSource int + + // SSL证书类型,暂时只有 Pem 一种类型 + SSLType string + + // USSL证书平台的编号,只有当SSLSource为1时才出现 + USSLId string +} + +/* +SSLRelation - SSL证书绑定到的对象 +*/ +type SSLRelation struct { + + // 是否为监听器默认SSL证书 + IsDefault bool + + // 监听器的ID + ListenerId string + + // 监听器的名称 + ListenerName string + + // 负载均衡实例的ID + LoadBalancerId string + + // 负载均衡实例的名称 + LoadBalancerName string +} + +/* +SSLInfo - SSL返回信息 +*/ +type SSLInfo struct { + + // SSL证书的创建时间 + CreateTime int + + // USSL证书平台的域名,只有当SSLSource为1时才出现 + Domains string + + // SSL证书的HASH值 + HashValue string + + // 证书过期时间,只有当SSLSource为1时才出现 + NotAfter int + + // 证书颁发时间,只有当SSLSource为1时才出现 + NotBefore int + + // SSL绑定ULB和ALB的关系 + Relations []SSLRelation + // SSL证书的内容 SSLContent string @@ -161,6 +620,48 @@ type SecurityPolicy struct { VServerSet []BindVServerInfo } +/* +SecurityPolicyRelation - 关联的监听 +*/ +type SecurityPolicyRelation struct { + + // 监听器的ID + ListenerId string + + // 监听器的名称 + ListenerName string + + // 监听端口 + ListenerPort int + + // 负载均衡实例的ID + LoadBalancerId string +} + +/* +SecurityPolicyInfo - 安全策略信息 +*/ +type SecurityPolicyInfo struct { + + // 关联的监听 + Relations []SecurityPolicyRelation + + // 加密套件 + SSLCiphers []string + + // 安全策略ID + SecurityPolicyId string + + // 安全策略名称 + SecurityPolicyName string + + // 安全策略类型 0:预定义 1:自定义 + SecurityPolicyType int + + // TLS最低版本 + TLSVersion string +} + /* TLSAndCiphers - */ @@ -206,6 +707,39 @@ type PolicyBackendSet struct { SubResourceType string } +/* +ULBPolicySet - 内容转发详细列表 +*/ +type ULBPolicySet struct { + + // 内容转发下rs的详细信息,参考PolicyBackendSet + BackendSet []PolicyBackendSet + + // 内容转发规则中域名的匹配方式。枚举值:Regular,正则;Wildcard,泛域名 + DomainMatchMode string + + // 内容转发匹配字段;默认内容转发类型下为空。 + Match string + + // 内容转发Id,默认内容转发类型下为空。 + PolicyId string + + // 内容转发优先级,范围[1,9999],数字越大优先级越高。默认内容转发规则下为0。 + PolicyPriority int + + // 内容类型,枚举值:Custom -> 客户自定义;Default -> 默认内容转发 + PolicyType string + + // 默认内容转发类型下返回当前rs总数 + TotalCount int + + // 内容转发匹配字段的类型,枚举值:Domain -> 域名;Path -> 路径; 默认内容转发类型下为空 + Type string + + // 所属VServerId + VServerId string +} + /* BindSecurityPolicy - VServer绑定的安全策略组信息 */ @@ -278,39 +812,6 @@ type ULBBackendSet struct { Weight int } -/* -ULBPolicySet - 内容转发详细列表 -*/ -type ULBPolicySet struct { - - // 内容转发下rs的详细信息,参考PolicyBackendSet - BackendSet []PolicyBackendSet - - // 内容转发规则中域名的匹配方式。枚举值:Regular,正则;Wildcard,泛域名 - DomainMatchMode string - - // 内容转发匹配字段;默认内容转发类型下为空。 - Match string - - // 内容转发Id,默认内容转发类型下为空。 - PolicyId string - - // 内容转发优先级,范围[1,9999],数字越大优先级越高。默认内容转发规则下为0。 - PolicyPriority int - - // 内容类型,枚举值:Custom -> 客户自定义;Default -> 默认内容转发 - PolicyType string - - // 默认内容转发类型下返回当前rs总数 - TotalCount int - - // 内容转发匹配字段的类型,枚举值:Domain -> 域名;Path -> 路径; 默认内容转发类型下为空 - Type string - - // 所属VServerId - VServerId string -} - /* ULBIPSet - DescribeULB */ @@ -332,33 +833,6 @@ type ULBIPSet struct { OperatorName string } -/* -FirewallSet - ulb防火墙信息 -*/ -type FirewallSet struct { - - // 防火墙ID - FirewallId string - - // 防火墙名称 - FirewallName string -} - -/* -LoggerSet - ulb日志信息 -*/ -type LoggerSet struct { - - // ulb日志上传的bucket - BucketName string - - // 上传到bucket使用的token的tokenid - TokenID string - - // bucket的token名称 - TokenName string -} - /* ULBVServerSet - DescribeULB */ @@ -434,6 +908,21 @@ type ULBVServerSet struct { VServerName string } +/* +LoggerSet - ulb日志信息 +*/ +type LoggerSet struct { + + // ulb日志上传的bucket + BucketName string + + // 上传到bucket使用的token的tokenid + TokenID string + + // bucket的token名称 + TokenName string +} + /* ULBSet - DescribeULB */ @@ -577,3 +1066,18 @@ type ULBSimpleSet struct { // WAF功能状态,枚举类型:Unavailable:无法创建WAF;NoWAF:未绑定WAF;Intranet:内网回源Waf;Extranet:外网回源Waf WAFMode string } + +/* +BackendMsg - ulb修rs状态时返回的信息 +*/ +type BackendMsg struct { + + // rs的资源ID + BackendId string + + // 修改rs返回的消息 + SubMessage string + + // 修改rs的返回值 + SubRetCode int +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go index 744fc4bb..79f676b0 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/apis.go @@ -235,6 +235,9 @@ type CreateUMemSpaceRequest struct { // 协议:memcache, redis (默认redis).注意:redis无single类型 Protocol *string `required:"false"` + // 分布式代理CPU核数 + ProxySize *int `required:"false"` + // 购买时长 默认: 1 Quantity *int `required:"false"` @@ -1108,9 +1111,18 @@ type DescribeUMemPriceRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` + // umem 分片个数 + BlockCnt *int `required:"false"` + // Year, Month, Dynamic 如果不指定,则一次性获取三种计费 ChargeType *string `required:"false"` + // 实例类型是否为性能增强型。默认为false,或者不填,true为性能增强型。 + HighPerformance *bool `required:"false"` + + // umem 代理CPU核心数 + ProxySize *int `required:"false"` + // 购买UMem的时长,默认值为1 Quantity *int `required:"false"` @@ -1749,18 +1761,21 @@ func (c *UMemClient) DescribeURedisGroup(req *DescribeURedisGroupRequest) (*Desc type DescribeURedisPriceRequest struct { request.CommonBase - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) // ProjectId *string `required:"false"` - // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Region *string `required:"true"` - // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` // 计费模式,Year, Month, Dynamic;如果不指定,则一次性获取三种计费 ChargeType *string `required:"false"` + // 查询高性能Redis, 默认为false, 或者不填, 查询高性能为true + HighPerformance *bool `required:"false"` + // 产品类型:MS_Redis(标准主备版),S_Redis(从库),默认为MS_Redis ProductType *string `required:"false"` @@ -1800,7 +1815,7 @@ func (c *UMemClient) NewDescribeURedisPriceRequest() *DescribeURedisPriceRequest /* API: DescribeURedisPrice -取uredis价格信息 +获取URedis价格信息 */ func (c *UMemClient) DescribeURedisPrice(req *DescribeURedisPriceRequest) (*DescribeURedisPriceResponse, error) { var err error diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go index 42ea3f76..b1d7f118 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/models.go @@ -77,6 +77,21 @@ type UnetBandwidthUsageEIPSet struct { EIPId string } +/* +ShareBandwidthSet - DescribeEIP +*/ +type ShareBandwidthSet struct { + + // 共享带宽带宽值 + ShareBandwidth int + + // 共享带宽ID + ShareBandwidthId string + + // 共享带宽的资源名称 + ShareBandwidthName string +} + /* UnetEIPResourceSet - DescribeEIP */ @@ -122,21 +137,6 @@ type EIPBinding struct { PrivateIPType string } -/* -ShareBandwidthSet - DescribeEIP -*/ -type ShareBandwidthSet struct { - - // 共享带宽带宽值 - ShareBandwidth int - - // 共享带宽ID - ShareBandwidthId string - - // 共享带宽的资源名称 - ShareBandwidthName string -} - /* UnetEIPSet - DescribeEIP */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/apis.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/apis.go index 7f1e16ed..b7353e12 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/apis.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/apis.go @@ -245,6 +245,9 @@ type DescribeBaremetalMachineTypeRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` + // 请求版本。仅支持v2,不传或传其他值表示请求旧版本 + APIVersion *string `required:"false"` + // 具体机型。若不填写,则返回全部机型 Type *string `required:"false"` } @@ -253,8 +256,8 @@ type DescribeBaremetalMachineTypeRequest struct { type DescribeBaremetalMachineTypeResponse struct { response.CommonBase - // 机型列表,模型:PHostCloudMachineTypeSet - MachineTypes []PHostCloudMachineTypeSet + // 机型列表,模型:PHostCloudMachineTypeSetV2,仅在入参Version=v2时返回 + MachineTypes []PHostCloudMachineTypeSetV2 } // NewDescribeBaremetalMachineTypeRequest will create request of DescribeBaremetalMachineType action. @@ -372,6 +375,9 @@ type DescribePHostImageRequest struct { // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) // Zone *string `required:"true"` + // 机器的网络集群,MachineType传是必须传,默认25G + Cluster *string `required:"false"` + // 镜像ID ImageId []string `required:"false"` @@ -438,10 +444,13 @@ type DescribePHostMachineTypeRequest struct { // ProjectId *string `required:"false"` // [公共参数] 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) - // Region *string `required:"true"` + // Region *string `required:"false"` // [公共参数] 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) - // Zone *string `required:"true"` + // Zone *string `required:"false"` + + // 请求版本。仅支持v2,不传或传其他值表示请求旧版本 + APIVersion *string `required:"false"` // 具体机型。若不填写,则返回全部机型 Type *string `required:"false"` @@ -451,8 +460,8 @@ type DescribePHostMachineTypeRequest struct { type DescribePHostMachineTypeResponse struct { response.CommonBase - // 机型列表,模型:PHostMachineTypeSet - MachineTypes []PHostMachineTypeSet + // 机型列表,模型:PHostCloudMachineTypeSetV2,仅在入参Version=v2时返回 + MachineTypes []PHostCloudMachineTypeSetV2 } // NewDescribePHostMachineTypeRequest will create request of DescribePHostMachineType action. diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/models.go index a4fa2f83..4157e3f4 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/models.go @@ -15,21 +15,54 @@ type PHostComponentSet struct { } /* -PHostClusterSet - 物理云主机集群库存信息 +PHostGpuInfoV2 - 裸金属Gpu信息V2版本 */ -type PHostClusterSet struct { +type PHostGpuInfoV2 struct { - // 集群名。枚举值:千兆网络集群:1G;万兆网络集群:10G;智能网卡网络:25G; + // GPU数量 + Count int + + // GPU显存大小 + Memory string + + // GPU名称,例如:NVIDIA_V100S Name string - // 库存状态。枚举值:有库存:Available;无库存:SoldOut - StockStatus string + // GPU性能指标 + Performance string } /* -PHostCPUSet - DescribePHost +PHostDiskSetV2 - 裸金属磁盘信息V2版本 */ -type PHostCPUSet struct { +type PHostDiskSetV2 struct { + + // 磁盘类型 + DiskType int + + // IO性能 + IoCap int + + // 磁盘名 + Name string + + // 数量 + Number int + + // Raid级别 + RaidLevel int + + // 空间大小 + Space int + + // 转换单位 + UnitSize int +} + +/* +PHostCPUSetV2 - 裸金属磁盘信息V2版本 +*/ +type PHostCPUSetV2 struct { // CPU核数 CoreCount int @@ -38,58 +71,85 @@ type PHostCPUSet struct { Count int // CPU主频 - Frequence float64 + Frequency string // CPU型号 Model string } /* -PHostCloudMachineTypeSet - 裸金属云盘的MachineTypeSet +PHostCloudMachineTypeSetV2 - 裸金属云盘的MachineTypeSet V2版本 */ -type PHostCloudMachineTypeSet struct { +type PHostCloudMachineTypeSetV2 struct { // CPU信息 - CPU PHostCPUSet + CPU PHostCPUSetV2 - // 集群库存信息 - Clusters []PHostClusterSet + // 集群名。枚举值:千兆网络集群:1G;万兆网络集群:10G;智能网卡网络:25G; + Cluster string - // 其他组件信息 - Components PHostComponentSet + // 组件信息 + Components []PHostComponentSet + + // 磁盘信息 + Disks []PHostDiskSetV2 + + // GPU信息 + GpuInfo PHostGpuInfoV2 + + // 是否是裸金属机型 + IsBaremetal bool + + // 是否是GPU机型 + IsGpu bool + + // 是否需要加新机型标记 + IsNew bool // 内存大小,单位MB Memory int - // 物理云主机机型别名,全网唯一。 + // 通常获取到的都是可售卖的 + OnSale bool + + // 参考价格。字典类型,default:为默认价格;cn-wlcb-01:乌兰察布A可用区价格 + Price string + + // 是否支持做Raid。枚举值:可以:Yes;不可以:No + RaidSupported string + + // 适用场景。例如:ai表示AI学习场景; + Scene []string + + // 库存数量 + Stock int + + // 库存状态。枚举值:有库存:Available;无库存:SoldOut + StockStatus string + + // 物理云主机机型别名 Type string + + // 机型所在可用区 + Zone string } /* -PHostIPSet - DescribePHost +PHostCPUSet - DescribePHost */ -type PHostIPSet struct { - - // IP对应带宽,单位Mb,内网IP不显示带宽信息 - Bandwidth int - - // IP地址, - IPAddr string - - // IP资源ID(内网IP无资源ID)(待废弃) - IPId string +type PHostCPUSet struct { - // MAC地址 - MACAddr string + // CPU核数 + CoreCount int - // 国际: Internation, BGP: BGP, 内网: Private - OperatorName string + // CPU个数 + Count int - // 子网ID - SubnetId string + // CPU主频 + Frequence float64 - // VPC ID - VPCId string + // CPU型号 + Model string } /* @@ -122,6 +182,33 @@ type PHostDescDiskSet struct { Type string } +/* +PHostIPSet - DescribePHost +*/ +type PHostIPSet struct { + + // IP对应带宽,单位Mb,内网IP不显示带宽信息 + Bandwidth int + + // IP地址, + IPAddr string + + // IP资源ID(内网IP无资源ID)(待废弃) + IPId string + + // MAC地址 + MACAddr string + + // 国际: Internation, BGP: BGP, 内网: Private + OperatorName string + + // 子网ID + SubnetId string + + // VPC ID + VPCId string +} + /* PHostSet - DescribePHost */ @@ -215,7 +302,7 @@ PHostImageSet - DescribePHostImage type PHostImageSet struct { // 裸金属2.0参数。镜像创建时间。 - CreateTime int + CreateTime string // 镜像描述 ImageDescription string @@ -248,54 +335,6 @@ type PHostImageSet struct { Version string } -/* -PHostDiskSet - GetPHostTypeInfo -*/ -type PHostDiskSet struct { - - // 磁盘数量 - Count int - - // 磁盘IO性能,单位MB/s(待废弃) - IOCap int - - // 磁盘名称,sys/data - Name string - - // 单盘大小,单位GB - Space int - - // 磁盘属性 - Type string -} - -/* -PHostMachineTypeSet - 物理云主机机型列表 -*/ -type PHostMachineTypeSet struct { - - // CPU信息 - CPU PHostCPUSet - - // 集群库存信息 - Clusters []PHostClusterSet - - // 其他组件信息 - Components PHostComponentSet - - // 磁盘信息 - Disks []PHostDiskSet - - // 内存大小,单位MB - Memory int - - // 是否支持Raid。枚举值:支持:YES;不支持:NO - RaidSupported string - - // 物理云主机机型别名,全网唯一。 - Type string -} - /* PHostTagSet - DescribePHostTags */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/models.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/models.go index 3d3d86ad..a73868b4 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/models.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/models.go @@ -215,6 +215,21 @@ type NatGWIPResInfo struct { OperatorName string } +/* +NatGatewaySubnetSet - natgw里面的子网信息 +*/ +type NatGatewaySubnetSet struct { + + // 子网网段 + Subnet string + + // 子网名字 + SubnetName string + + // 子网id + SubnetworkId string +} + /* NatGatewayIPSet - IPSet信息 */ @@ -236,21 +251,6 @@ type NatGatewayIPSet struct { Weight int } -/* -NatGatewaySubnetSet - natgw里面的子网信息 -*/ -type NatGatewaySubnetSet struct { - - // 子网网段 - Subnet string - - // 子网名字 - SubnetName string - - // 子网id - SubnetworkId string -} - /* NatGatewayDataSet - natgw的信息 */ @@ -434,18 +434,6 @@ type AclInfo struct { VpcId string } -/* -UNIQuotaInfo - 虚拟网卡内网IP配额使用情况 -*/ -type UNIQuotaInfo struct { - - // 网卡拥有的内网IP数量 - PrivateIpCount int - - // 网卡内网IP配额 - PrivateIpQuota int -} - /* UNIIpInfo - 虚拟网卡内网IP信息 */ @@ -458,6 +446,18 @@ type UNIIpInfo struct { IpType string } +/* +UNIQuotaInfo - 虚拟网卡内网IP配额使用情况 +*/ +type UNIQuotaInfo struct { + + // 网卡拥有的内网IP数量 + PrivateIpCount int + + // 网卡内网IP配额 + PrivateIpQuota int +} + /* NetworkInterface - 虚拟网卡信息 */ diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go index f5c930c0..87857586 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go @@ -1,3 +1,3 @@ package version -const Version = "0.22.5" +const Version = "0.22.17" diff --git a/vendor/modules.txt b/vendor/modules.txt index 803132bf..1e28b045 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -298,7 +298,7 @@ github.com/tidwall/match # github.com/tidwall/pretty v1.2.0 ## explicit; go 1.16 github.com/tidwall/pretty -# github.com/ucloud/ucloud-sdk-go v0.22.5 +# github.com/ucloud/ucloud-sdk-go v0.22.17 ## explicit; go 1.13 github.com/ucloud/ucloud-sdk-go/external github.com/ucloud/ucloud-sdk-go/private/protocol/http @@ -307,6 +307,7 @@ github.com/ucloud/ucloud-sdk-go/private/utils github.com/ucloud/ucloud-sdk-go/services/cube github.com/ucloud/ucloud-sdk-go/services/iam github.com/ucloud/ucloud-sdk-go/services/ipsecvpn +github.com/ucloud/ucloud-sdk-go/services/label github.com/ucloud/ucloud-sdk-go/services/sts github.com/ucloud/ucloud-sdk-go/services/uaccount github.com/ucloud/ucloud-sdk-go/services/uads diff --git a/website/allowed-subcategories.txt b/website/allowed-subcategories.txt index 06782ec4..636f3ffb 100644 --- a/website/allowed-subcategories.txt +++ b/website/allowed-subcategories.txt @@ -10,4 +10,5 @@ UDPN UK8S Anti-DDoS Bare Metal (UPhost) +Label Appendix diff --git a/website/docs/d/label_resources.markdown b/website/docs/d/label_resources.markdown new file mode 100644 index 00000000..deb18a2f --- /dev/null +++ b/website/docs/d/label_resources.markdown @@ -0,0 +1,40 @@ +--- +subcategory: "Label" +layout: "ucloud" +page_title: "UCloud: ucloud_label_resources" +description: |- + Provides a list of resources with specific label. +--- + +# ucloud_labels + +Provides a list of labels. + +## Example Usage + +```hcl +data "ucloud_label_resources" "foo" { + key = "key" + value = "value" + resource_types = ["vip"] + project_ids = ["org-xxx"] +} +``` + +## Argument Reference + +The following arguments are supported: + +* `key` - (Required, String) key of the label.s +* `value` - (Required, String) value of the label +* `resource_types` - (Required, String Array) types of the attached resources, for example uhost. +* `project_ids` - (Required, String Array) projects that own the attached resources, for example org-xxx.* +* `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `resources` - Resources with specific label and consists of following attribute + * `id` - ID of the resource + * `name` - Name of the resource diff --git a/website/docs/d/labels.markdown b/website/docs/d/labels.markdown new file mode 100644 index 00000000..3d1a7d82 --- /dev/null +++ b/website/docs/d/labels.markdown @@ -0,0 +1,38 @@ +--- +subcategory: "Label" +layout: "ucloud" +page_title: "UCloud: ucloud_labels" +description: |- + Provides a list of labels. +--- + +# ucloud_labels + +Provides a list of labels. + +## Example Usage + +```hcl +data "ucloud_labels" "foo" { + key_regex = "^key$" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `key_regex` - (Optional) A regex string to filter the returned users by their keys. +* `output_file` - (Optional) File name where to save data source results (after running `terraform plan`). + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `key` - Key of the label +* `value` - Value of the label +* `projects` - Projects which have attached resources and consists of following attribute + * `id` - ID of the project + * `name` - Name of the project + * `resource_types` - Array of strings, which are resource types with query permission for current account + * `disabled_resource_types` - Array of strings, which are resource types without query permission for current account diff --git a/website/docs/r/label.html.markdown b/website/docs/r/label.html.markdown new file mode 100644 index 00000000..dfd904c7 --- /dev/null +++ b/website/docs/r/label.html.markdown @@ -0,0 +1,27 @@ +--- +subcategory: "Label" +layout: "ucloud" +page_title: "UCloud: ucloud_label" +description: |- + Provides a label resource. +--- + +# ucloud_label + +Provides a label resource. + +## Example Usage + +```hcl +resource "ucloud_label" "foo" { + key = "tf-acc-label-key" + value = "tf-acc-label-value" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `key` - (Required, String, ForceNew) key of the label. +* `value` - (Required, String, ForceNew) value of the label diff --git a/website/docs/r/label_attachment.html.markdown b/website/docs/r/label_attachment.html.markdown new file mode 100644 index 00000000..725cf5b9 --- /dev/null +++ b/website/docs/r/label_attachment.html.markdown @@ -0,0 +1,51 @@ +--- +subcategory: "Label" +layout: "ucloud" +page_title: "UCloud: ucloud_label_attachment" +description: |- + Provides a label attachment resource. +--- + +# ucloud_label + +Provides a label attachment resource. + +## Example Usage + +```hcl +resource "ucloud_vpc" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_blocks = ["192.168.0.0/16"] +} +resource "ucloud_subnet" "foo" { + name = "tf-acc-vip" + tag = "tf-acc" + cidr_block = "192.168.1.0/24" + vpc_id = "${ucloud_vpc.foo.id}" +} +resource "ucloud_vip" "foo" { + vpc_id = "${ucloud_vpc.foo.id}" + subnet_id = "${ucloud_subnet.foo.id}" + name = "tf-acc-vip-basic-update" + remark = "test-update" + tag = "tf-acc" +} +resource "ucloud_label" "foo" { + key = "tf-acc-label-key" + value = "tf-acc-label-value" +} +resource "ucloud_label_attachment" "foo" { + key = "${ucloud_label.foo.key}" + value = "${ucloud_label.foo.value}" + resource = "${ucloud_vip.foo.id}" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `key` - (Required, String, ForceNew) key of the label. +* `value` - (Required, String, ForceNew) value of the label +* `resource` - (Required, String, ForceNew) id of the attached resource, for example vip-xxx. \ No newline at end of file