diff --git a/go.mod b/go.mod index 21a0ff348c..2ad3bfb772 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.445 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.412 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.480 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.486 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.445 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.359 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dayu v1.0.335 @@ -60,6 +60,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr v1.0.267 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.268 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.472 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.486 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.480 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.479 diff --git a/go.sum b/go.sum index 0b93383598..d14135471e 100644 --- a/go.sum +++ b/go.sum @@ -489,11 +489,16 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.413/go.mod github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.414/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.443/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.445/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.463/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.466/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.472/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.479/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.480 h1:Dwnfdrk3KXpYRH9Kwrk9sHpZSOmrE7P9LBoNsYUJKR4= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.480/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.484 h1:x37ASMnNHHh7X0JpEhJmUz4OQL9DCIoXB0wv8u1TKic= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.484/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.486 h1:MUO3Gp/jo/t0NBJ2TLH2sDjy+b/eJUCGgBT+7BfN2yE= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.486/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.445 h1:Bh7XD0ypNMHYyBOM8hhKsSu+y0VVKUnJVS+YKKhfpGg= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.445/go.mod h1:jMDD351efCFpT1+KVFbcpu6SbmP4TYmp4qkoCfr63nQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.359 h1:cNKqelPgUxrJkLY0Azd2QHr/UMYOPPnmqs88clt2akk= @@ -547,6 +552,14 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.268 h1:ez5lvK github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.268/go.mod h1:fchXZhmqaYaG2c4wTCBTdnW6TFAtxl3D/P/yuuuLMfA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.472 h1:9Jzrgx78+5XnZ8myNYjCYZn5ZF+tbSIpF6KWGgWr0uY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.472/go.mod h1:ayIL2FNqk7HH5fPQrkWtYjgU4jL7if63f7x+yRwb4a0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.463 h1:QA9uGf9PjzitWIRFtf/NjsB4HjeuJdFi43RvTXNJQ5M= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.463/go.mod h1:D8kkDqqTJQe/qYhXsQkwD3ACxXPoAXwNR4JWe1rOQIs= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.480 h1:sP9z+Q7acbqElkzRfWbESLWycmpQHFKM+qIbeFyW24I= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.480/go.mod h1:XC6UD5UnzncR6O48Ya/FsIdkiPJT/jSKlUjolzpfayg= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.484 h1:7+1ltleuaAz/jI3NIapvOsl7wzu8UcJYjnh+d4UWAtc= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.484/go.mod h1:o3AyKFiYfjK7U/DsDzz1XmTRmXrTsemx/gx/630d+DE= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.486 h1:JRtQYtJB9sErV9tXY6xbrC3RmXNepBKd7aV3inxkUPs= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.486/go.mod h1:wtPJIKxQUR3KoL2KWAt/Qi8KMR4ayKHiOeVJ6sTSC4U= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.480 h1:oZptW2Fo1pW8fKz/dv+RJLr2q8UC1qkqDqWs3rDgvQ8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.480/go.mod h1:rs+BUoY53xfiE5sRsVk2RpsjgzODtq52xiBTc6WTWWM= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199 h1:6Yt74l4pA5QtzhwMNIEUt0spXdSBKH744DDqTHJOCP0= diff --git a/tencentcloud/connectivity/client.go b/tencentcloud/connectivity/client.go index a64faf2c5f..ba9ea80d91 100644 --- a/tencentcloud/connectivity/client.go +++ b/tencentcloud/connectivity/client.go @@ -56,6 +56,7 @@ import ( tcr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924" tdmq "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq/v20200217" tem "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem/v20210701" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" tke "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525" vod "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod/v20180717" vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312" @@ -119,6 +120,7 @@ type TencentCloudClient struct { domainConn *domain.Client lighthouseConn *lighthouse.Client temConn *tem.Client + teoConn *teo.Client } // NewClientProfile returns a new ClientProfile @@ -746,6 +748,19 @@ func (me *TencentCloudClient) UseTemClient() *tem.Client { return me.temConn } +// UseTeoClient returns teo client for service +func (me *TencentCloudClient) UseTeoClient() *teo.Client { + if me.teoConn != nil { + return me.teoConn + } + + cpf := me.NewClientProfile(300) + me.teoConn, _ = teo.NewClient(me.Credential, me.Region, cpf) + me.teoConn.WithHttpTransport(&LogRoundTripper{}) + + return me.teoConn +} + func getEnvDefault(key string, defVal int) int { val, ex := os.LookupEnv(key) if !ex { diff --git a/tencentcloud/data_source_tc_teo_zone_available_plans.go b/tencentcloud/data_source_tc_teo_zone_available_plans.go new file mode 100644 index 0000000000..f92156e0e1 --- /dev/null +++ b/tencentcloud/data_source_tc_teo_zone_available_plans.go @@ -0,0 +1,130 @@ +/* +Use this data source to query zone available plans. + +Example Usage + +```hcl +data "tencentcloud_teo_zone_available_plans" "available_plans" {} +``` +*/ +package tencentcloud + +import ( + "context" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" +) + +func dataSourceTencentCloudTeoZoneAvailablePlans() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudTeoZoneAvailablePlansRead, + + Schema: map[string]*schema.Schema{ + "plan_info_list": { + Type: schema.TypeList, + Computed: true, + Description: "Available plans for a zone.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "plan_type": { + Type: schema.TypeString, + Computed: true, + Description: "Plan type.", + }, + "currency": { + Type: schema.TypeString, + Computed: true, + Description: "Currency type. Valid values: `CNY`, `USD`.", + }, + "flux": { + Type: schema.TypeInt, + Computed: true, + Description: "The number of fluxes included in the zone plan. Unit: Byte.", + }, + "frequency": { + Type: schema.TypeString, + Computed: true, + Description: "Billing cycle. Valid values: `y`: Billed by the year; `m`: Billed by the month; `h`: Billed by the hour; `M`: Billed by the minute; `s`: Billed by the second.", + }, + "price": { + Type: schema.TypeInt, + Computed: true, + Description: "Price of the plan. Unit: cent.", + }, + "request": { + Type: schema.TypeInt, + Computed: true, + Description: "The number of requests included in the zone plan.", + }, + "site_number": { + Type: schema.TypeInt, + Computed: true, + Description: "The number of zones this zone plan can bind.", + }, + }, + }, + }, + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used for save results.", + }, + }, + } +} + +func dataSourceTencentCloudTeoZoneAvailablePlansRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("data_source.tencentcloud_teo_zone_available_plans.read")() + + var ( + logId = getLogId(contextNil) + ctx = context.WithValue(context.TODO(), logIdKey, logId) + service = TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + availablePlans *teo.DescribeAvailablePlansResponseParams + err error + ) + + var outErr, inErr error + availablePlans, outErr = service.DescribeAvailablePlans(ctx) + if outErr != nil { + outErr = resource.Retry(readRetryTimeout, func() *resource.RetryError { + availablePlans, inErr = service.DescribeAvailablePlans(ctx) + if inErr != nil { + return retryError(inErr) + } + return nil + }) + } + + planInfos := availablePlans.PlanInfoList + planInfoList := make([]map[string]interface{}, 0, len(planInfos)) + for _, v := range planInfos { + planInfo := map[string]interface{}{ + "plan_type": v.PlanType, + "currency": v.Currency, + "flux": v.Flux, + "frequency": v.Frequency, + "price": v.Price, + "request": v.Request, + "site_number": v.SiteNumber, + } + planInfoList = append(planInfoList, planInfo) + } + if err = d.Set("plan_info_list", planInfoList); err != nil { + log.Printf("[CRITAL]%s provider set list fail, reason:%s", logId, err.Error()) + return err + } + + d.SetId("zone_available_plans") + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := writeToFile(output.(string), planInfoList); e != nil { + return e + } + } + return nil +} diff --git a/tencentcloud/data_source_tc_teo_zone_ddos_policy.go b/tencentcloud/data_source_tc_teo_zone_ddos_policy.go new file mode 100644 index 0000000000..2444e27ad2 --- /dev/null +++ b/tencentcloud/data_source_tc_teo_zone_ddos_policy.go @@ -0,0 +1,243 @@ +/* +Use this data source to query zone ddos policy. + +Example Usage + +```hcl +data "tencentcloud_teo_zone_ddos_policy" "example" { + zone_id = "" +} +``` +*/ +package tencentcloud + +import ( + "context" + "log" + "strconv" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" +) + +func dataSourceTencentCloudTeoZoneDdosPolicy() *schema.Resource { + return &schema.Resource{ + Read: dataSourceTencentCloudTeoZoneDdosPolicyRead, + + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Optional: true, + Description: "Site ID.", + }, + "app_id": { + Type: schema.TypeString, + Computed: true, + Description: "App ID.", + }, + "shield_areas": { + Type: schema.TypeList, + Computed: true, + Description: "Shield areas of the zone.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Computed: true, + Description: "Site ID.", + }, + "policy_id": { + Type: schema.TypeInt, + Computed: true, + Description: "Policy ID.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Valid values: `domain`, `application`.", + }, + "entity": { + Type: schema.TypeString, + Computed: true, + Description: "When `Type` is `domain`, this field is `ZoneId`. When `Type` is `application`, this field is `ProxyId`. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "entity_name": { + Type: schema.TypeString, + Computed: true, + Description: "When `Type` is `domain`, this field is `ZoneName`. When `Type` is `application`, this field is `ProxyName`. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "tcp_num": { + Type: schema.TypeInt, + Computed: true, + Description: "TCP forwarding rule number of layer 4 application.", + }, + "udp_num": { + Type: schema.TypeInt, + Computed: true, + Description: "UDP forwarding rule number of layer 4 application.", + }, + "share": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether the resource is shared.", + }, + "application": { + Type: schema.TypeList, + Computed: true, + Description: "Layer 7 Domain Name Parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host": { + Type: schema.TypeString, + Computed: true, + Description: "Subdomain.", + }, + "status": { + Type: schema.TypeString, + Computed: true, + Description: "Status of the subdomain. Note: This field may return null, indicating that no valid value can be obtained, init: waiting to config NS; offline: waiting to enable site accelerating; process: config deployment processing; online: normal status.", + }, + "accelerate_type": { + Type: schema.TypeString, + Computed: true, + Description: "on: Enable; off: Disable.", + }, + "security_type": { + Type: schema.TypeString, + Computed: true, + Description: "on: Enable; off: Disable.", + }, + }, + }, + }, + }, + }, + }, + "domains": { + Type: schema.TypeList, + Computed: true, + Description: "All subdomain info. Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host": { + Type: schema.TypeString, + Computed: true, + Description: "Subdomain.", + }, + "status": { + Type: schema.TypeString, + Computed: true, + Description: "Status of the subdomain. Note: This field may return null, indicating that no valid value can be obtained, init: waiting to config NS; offline: waiting to enable site accelerating; process: config deployment processing; online: normal status.", + }, + "accelerate_type": { + Type: schema.TypeString, + Computed: true, + Description: "on: Enable; off: Disable.", + }, + "security_type": { + Type: schema.TypeString, + Computed: true, + Description: "on: Enable; off: Disable.", + }, + }, + }, + }, + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used for save results.", + }, + }, + } +} + +func dataSourceTencentCloudTeoZoneDdosPolicyRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("data_source.tencentcloud_teo_zone_ddos_policy.read")() + + var ( + logId = getLogId(contextNil) + ctx = context.WithValue(context.TODO(), logIdKey, logId) + service = TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + zoneId = d.Get("zone_id").(string) + ddosPolicy *teo.DescribeZoneDDoSPolicyResponseParams + err error + ) + + if err = resource.Retry(readRetryTimeout, func() *resource.RetryError { + ddosPolicy, err = service.DescribeZoneDDoSPolicy(ctx, zoneId) + if err != nil { + return retryError(err, InternalError) + } + return nil + }); err != nil { + return err + } + + appId := strconv.FormatInt(*ddosPolicy.AppId, 10) + + shieldAreasList := make([]map[string]interface{}, 0, len(ddosPolicy.ShieldAreas)) + shieldAreas := ddosPolicy.ShieldAreas + for _, v := range shieldAreas { + applications := make([]map[string]interface{}, 0, len(v.Application)) + for _, vv := range v.Application { + application := map[string]interface{}{ + "host": vv.Host, + "status": vv.Status, + "accelerate_type": vv.AccelerateType, + "security_type": vv.SecurityType, + } + applications = append(applications, application) + } + shieldArea := map[string]interface{}{ + "zone_id": v.ZoneId, + "policy_id": v.PolicyId, + "type": v.Type, + "entity_name": v.EntityName, + "application": applications, + "tcp_num": v.TcpNum, + "udp_num": v.UdpNum, + "entity": v.Entity, + "share": v.Share, + } + shieldAreasList = append(shieldAreasList, shieldArea) + } + if err = d.Set("shield_areas", shieldAreasList); err != nil { + log.Printf("[CRITAL]%s provider set list fail, reason:%s", logId, err.Error()) + return err + } + + domainsList := make([]map[string]interface{}, 0, len(ddosPolicy.Domains)) + for _, v := range ddosPolicy.Domains { + application := map[string]interface{}{ + "host": v.Host, + "status": v.Status, + "accelerate_type": v.AccelerateType, + "security_type": v.SecurityType, + } + domainsList = append(domainsList, application) + } + if err = d.Set("domains", domainsList); err != nil { + log.Printf("[CRITAL]%s provider set list fail, reason:%s", logId, err.Error()) + return err + } + + if err = d.Set("app_id", appId); err != nil { + log.Printf("[CRITAL]%s provider set list fail, reason:%s", logId, err.Error()) + return err + } + + d.SetId(appId) + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if e := writeToFile(output.(string), map[string]interface{}{ + "app_id": appId, + "Shield_areas": shieldAreasList, + "domains": domainsList, + }); e != nil { + return e + } + } + return nil +} diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 88636e9e55..e9a6eb537e 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -661,6 +661,22 @@ TEM tencentcloud_tem_scale_rule tencentcloud_tem_gateway +Teo + Data Source + tencentcloud_teo_zone_available_plans + + Resource + tencentcloud_teo_zone + tencentcloud_teo_zone_setting + tencentcloud_teo_dns_record + tencentcloud_teo_dns_sec + tencentcloud_teo_load_balancing + tencentcloud_teo_origin_group + tencentcloud_teo_rule_engine + tencentcloud_teo_application_proxy + tencentcloud_teo_application_proxy_rule + tencentcloud_teo_host_certificate + tencentcloud_teo_default_certificate */ package tencentcloud @@ -948,6 +964,8 @@ func Provider() terraform.ResourceProvider { "tencentcloud_ssm_secret_versions": dataSourceTencentCloudSsmSecretVersions(), "tencentcloud_cdh_instances": dataSourceTencentCloudCdhInstances(), "tencentcloud_dayu_eip": dataSourceTencentCloudDayuEip(), + "tencentcloud_teo_zone_ddos_policy": dataSourceTencentCloudTeoZoneDdosPolicy(), + "tencentcloud_teo_zone_available_plans": dataSourceTencentCloudTeoZoneAvailablePlans(), }, ResourcesMap: map[string]*schema.Resource{ @@ -1185,6 +1203,19 @@ func Provider() terraform.ResourceProvider { "tencentcloud_tem_log_config": resourceTencentCloudTemLogConfig(), "tencentcloud_tem_scale_rule": resourceTencentCloudTemScaleRule(), "tencentcloud_tem_gateway": resourceTencentCloudTemGateway(), + "tencentcloud_teo_zone": resourceTencentCloudTeoZone(), + "tencentcloud_teo_zone_setting": resourceTencentCloudTeoZoneSetting(), + "tencentcloud_teo_dns_record": resourceTencentCloudTeoDnsRecord(), + "tencentcloud_teo_dns_sec": resourceTencentCloudTeoDnsSec(), + "tencentcloud_teo_load_balancing": resourceTencentCloudTeoLoadBalancing(), + "tencentcloud_teo_origin_group": resourceTencentCloudTeoOriginGroup(), + "tencentcloud_teo_rule_engine": resourceTencentCloudTeoRuleEngine(), + "tencentcloud_teo_application_proxy": resourceTencentCloudTeoApplicationProxy(), + "tencentcloud_teo_application_proxy_rule": resourceTencentCloudTeoApplicationProxyRule(), + "tencentcloud_teo_security_policy": resourceTencentCloudTeoSecurityPolicy(), + "tencentcloud_teo_host_certificate": resourceTencentCloudTeoHostCertificate(), + "tencentcloud_teo_default_certificate": resourceTencentCloudTeoDefaultCertificate(), + "tencentcloud_teo_ddos_policy": resourceTencentCloudTeoDdosPolicy(), }, ConfigureFunc: providerConfigure, diff --git a/tencentcloud/resource_tc_mysql_instance.go b/tencentcloud/resource_tc_mysql_instance.go index a102c311eb..67cf1606e2 100644 --- a/tencentcloud/resource_tc_mysql_instance.go +++ b/tencentcloud/resource_tc_mysql_instance.go @@ -654,6 +654,15 @@ func resourceTencentCloudMysqlInstanceCreate(d *schema.ResourceData, meta interf mysqlID := d.Id() + if tags := helper.GetTags(d, "tags"); len(tags) > 0 { + tcClient := meta.(*TencentCloudClient).apiV3Conn + tagService := &TagService{client: tcClient} + resourceName := BuildTagResourceName("cdb", "instanceId", tcClient.Region, d.Id()) + if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil { + return err + } + } + err := resource.Retry(7*readRetryTimeout, func() *resource.RetryError { mysqlInfo, err := mysqlService.DescribeDBInstanceById(ctx, mysqlID) if err != nil { @@ -767,15 +776,6 @@ func resourceTencentCloudMysqlInstanceCreate(d *schema.ResourceData, meta interf } } - if tags := helper.GetTags(d, "tags"); len(tags) > 0 { - tcClient := meta.(*TencentCloudClient).apiV3Conn - tagService := &TagService{client: tcClient} - resourceName := BuildTagResourceName("cdb", "instanceId", tcClient.Region, d.Id()) - if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil { - return err - } - } - return resourceTencentCloudMysqlInstanceRead(d, meta) } diff --git a/tencentcloud/resource_tc_teo_application_proxy.go b/tencentcloud/resource_tc_teo_application_proxy.go new file mode 100644 index 0000000000..69454162e9 --- /dev/null +++ b/tencentcloud/resource_tc_teo_application_proxy.go @@ -0,0 +1,376 @@ +/* +Provides a resource to create a teo application_proxy + +Example Usage + +```hcl +resource "tencentcloud_teo_application_proxy" "application_proxy" { + zone_id = tencentcloud_teo_zone.zone.id + zone_name = "sfurnace.work" + + accelerate_type = 1 + security_type = 1 + plat_type = "domain" + proxy_name = "www.sfurnace.work" + proxy_type = "hostname" + session_persist_time = 2400 +} + +``` +Import + +teo application_proxy can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_application_proxy.application_proxy zoneId#proxyId +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoApplicationProxy() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoApplicationProxyRead, + Create: resourceTencentCloudTeoApplicationProxyCreate, + Update: resourceTencentCloudTeoApplicationProxyUpdate, + Delete: resourceTencentCloudTeoApplicationProxyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "zone_name": { + Type: schema.TypeString, + Required: true, + Description: "Site name.", + }, + + "proxy_name": { + Type: schema.TypeString, + Required: true, + Description: "Layer-4 proxy name.", + }, + + "plat_type": { + Type: schema.TypeString, + Required: true, + Description: "Scheduling mode.- ip: Anycast IP.- domain: CNAME.", + }, + + "security_type": { + Type: schema.TypeInt, + Required: true, + Description: "- 0: Disable security protection.- 1: Enable security protection.", + }, + + "accelerate_type": { + Type: schema.TypeInt, + Required: true, + Description: "- 0: Disable acceleration.- 1: Enable acceleration.", + }, + + "session_persist_time": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Session persistence duration. Value range: 30-3600 (in seconds).", + }, + + "proxy_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Specifies how a layer-4 proxy is created.- hostname: Subdomain name.- instance: Instance.", + }, + + "proxy_id": { + Type: schema.TypeString, + Computed: true, + Description: "Proxy ID.", + }, + + "schedule_value": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + Description: "Scheduling information.", + }, + + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Last modification date.", + }, + + "host_id": { + Type: schema.TypeString, + Computed: true, + Description: "ID of the layer-7 domain name.", + }, + }, + } +} + +func resourceTencentCloudTeoApplicationProxyCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateApplicationProxyRequest() + response *teo.CreateApplicationProxyResponse + zoneId string + proxyId string + ) + + request.ForwardClientIp = helper.String("") + request.SessionPersist = helper.Bool(true) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("zone_name"); ok { + request.ZoneName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("proxy_name"); ok { + request.ProxyName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("plat_type"); ok { + request.PlatType = helper.String(v.(string)) + } + + if v, ok := d.GetOk("security_type"); ok { + request.SecurityType = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("accelerate_type"); ok { + request.AccelerateType = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("session_persist_time"); ok { + request.SessionPersistTime = helper.IntUint64(v.(int)) + } + + if v, ok := d.GetOk("proxy_type"); ok { + request.ProxyType = helper.String(v.(string)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateApplicationProxy(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo applicationProxy failed, reason:%+v", logId, err) + return err + } + + proxyId = *response.Response.ProxyId + + d.SetId(zoneId + FILED_SP + proxyId) + return resourceTencentCloudTeoApplicationProxyRead(d, meta) +} + +func resourceTencentCloudTeoApplicationProxyRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + proxyId := idSplit[1] + + applicationProxy, err := service.DescribeTeoApplicationProxy(ctx, zoneId, proxyId) + + if err != nil { + return err + } + + if applicationProxy == nil { + d.SetId("") + return fmt.Errorf("resource `applicationProxy` %s does not exist", proxyId) + } + + if applicationProxy.ZoneId != nil { + _ = d.Set("zone_id", applicationProxy.ZoneId) + } + + if applicationProxy.ZoneName != nil { + _ = d.Set("zone_name", applicationProxy.ZoneName) + } + + if applicationProxy.ProxyName != nil { + _ = d.Set("proxy_name", applicationProxy.ProxyName) + } + + if applicationProxy.PlatType != nil { + _ = d.Set("plat_type", applicationProxy.PlatType) + } + + if applicationProxy.SecurityType != nil { + _ = d.Set("security_type", applicationProxy.SecurityType) + } + + if applicationProxy.AccelerateType != nil { + _ = d.Set("accelerate_type", applicationProxy.AccelerateType) + } + + if applicationProxy.SessionPersistTime != nil { + _ = d.Set("session_persist_time", applicationProxy.SessionPersistTime) + } + + if applicationProxy.ProxyType != nil { + _ = d.Set("proxy_type", applicationProxy.ProxyType) + } + + if applicationProxy.ProxyId != nil { + _ = d.Set("proxy_id", applicationProxy.ProxyId) + } + + if applicationProxy.ScheduleValue != nil { + _ = d.Set("schedule_value", applicationProxy.ScheduleValue) + } + + if applicationProxy.UpdateTime != nil { + _ = d.Set("update_time", applicationProxy.UpdateTime) + } + + if applicationProxy.HostId != nil { + _ = d.Set("host_id", applicationProxy.HostId) + } + + return nil +} + +func resourceTencentCloudTeoApplicationProxyUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyApplicationProxyRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + proxyId := idSplit[1] + + request.ZoneId = &zoneId + request.ProxyId = &proxyId + request.ForwardClientIp = helper.String("") + request.SessionPersist = helper.Bool(true) + + if v, ok := d.GetOk("proxy_name"); ok { + request.ProxyName = helper.String(v.(string)) + } + + if d.HasChange("zone_id") { + return fmt.Errorf("`zone_id` do not support change now.") + } + + if d.HasChange("zone_name") { + return fmt.Errorf("`zone_name` do not support change now.") + } + + if d.HasChange("plat_type") { + return fmt.Errorf("`plat_type` do not support change now.") + } + + if d.HasChange("security_type") { + return fmt.Errorf("`security_type` do not support change now.") + } + + if d.HasChange("accelerate_type") { + return fmt.Errorf("`accelerate_type` do not support change now.") + } + + if d.HasChange("session_persist_time") { + if v, ok := d.GetOk("session_persist_time"); ok { + request.SessionPersistTime = helper.IntUint64(v.(int)) + } + } + + if d.HasChange("proxy_type") { + if v, ok := d.GetOk("proxy_type"); ok { + request.ProxyType = helper.String(v.(string)) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyApplicationProxy(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + return resourceTencentCloudTeoApplicationProxyRead(d, meta) +} + +func resourceTencentCloudTeoApplicationProxyDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + proxyId := idSplit[1] + + if err := service.DeleteTeoApplicationProxyById(ctx, zoneId, proxyId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_application_proxy_rule.go b/tencentcloud/resource_tc_teo_application_proxy_rule.go new file mode 100644 index 0000000000..ae6ca3f467 --- /dev/null +++ b/tencentcloud/resource_tc_teo_application_proxy_rule.go @@ -0,0 +1,364 @@ +/* +Provides a resource to create a teo application_proxy_rule + +Example Usage + +```hcl +resource "tencentcloud_teo_application_proxy_rule" "application_proxy_rule" { + zone_id = tencentcloud_teo_zone.zone.id + proxy_id = tencentcloud_teo_application_proxy.application_proxy_rule.proxy_id + + forward_client_ip = "TOA" + origin_type = "custom" + origin_value = [ + "1.1.1.1:80", + ] + port = [ + "80", + ] + proto = "TCP" + session_persist = false +} + +``` +Import + +teo application_proxy_rule can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_application_proxy_rule.application_proxy_rule zoneId#proxyId#ruleId +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoApplicationProxyRule() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoApplicationProxyRuleRead, + Create: resourceTencentCloudTeoApplicationProxyRuleCreate, + Update: resourceTencentCloudTeoApplicationProxyRuleUpdate, + Delete: resourceTencentCloudTeoApplicationProxyRuleDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Site ID.", + }, + + "proxy_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Proxy ID.", + }, + + "rule_id": { + Type: schema.TypeString, + Computed: true, + Description: "Rule ID.", + }, + + "proto": { + Type: schema.TypeString, + Required: true, + Description: "Protocol. Valid values: `TCP`, `UDP`.", + }, + + "port": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Valid values:- port number: `80` means port 80.- port range: `81-90` means port range 81-90.", + }, + + "origin_type": { + Type: schema.TypeString, + Required: true, + Description: "Origin server type.- custom: Specified origins.- origins: An origin group.- load_balancing: A load balancer.", + }, + + "origin_value": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Origin server information.When OriginType is custom, this field value indicates multiple origin servers in either of the following formats:- IP:Port- Domain name:Port.When OriginType is origins, it indicates the origin group ID.", + }, + + "forward_client_ip": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Passes the client IP.When Proto is TCP, valid values:- TOA: Pass the client IP via TOA.- PPV1: Pass the client IP via Proxy Protocol V1.- PPV2: Pass the client IP via Proxy Protocol V2.- OFF: Do not pass the client IP.When Proto=UDP, valid values:- PPV2: Pass the client IP via Proxy Protocol V2.- OFF: Do not pass the client IP.", + }, + + "session_persist": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Specifies whether to enable session persistence.", + }, + }, + } +} + +func resourceTencentCloudTeoApplicationProxyRuleCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy_rule.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateApplicationProxyRuleRequest() + response *teo.CreateApplicationProxyRuleResponse + zoneId string + proxyId string + ruleId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("proxy_id"); ok { + proxyId = v.(string) + request.ProxyId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("proto"); ok { + request.Proto = helper.String(v.(string)) + } + + if v, ok := d.GetOk("port"); ok { + portSet := v.(*schema.Set).List() + for i := range portSet { + port := portSet[i].(string) + request.Port = append(request.Port, &port) + } + } + + if v, ok := d.GetOk("origin_type"); ok { + request.OriginType = helper.String(v.(string)) + } + + if v, ok := d.GetOk("origin_value"); ok { + originValueSet := v.(*schema.Set).List() + for i := range originValueSet { + originValue := originValueSet[i].(string) + request.OriginValue = append(request.OriginValue, &originValue) + } + } + + if v, ok := d.GetOk("forward_client_ip"); ok { + request.ForwardClientIp = helper.String(v.(string)) + } + + if v, ok := d.GetOk("session_persist"); ok { + request.SessionPersist = helper.Bool(v.(bool)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateApplicationProxyRule(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo applicationProxyRule failed, reason:%+v", logId, err) + return err + } + + ruleId = *response.Response.RuleId + + d.SetId(zoneId + FILED_SP + proxyId + FILED_SP + ruleId) + return resourceTencentCloudTeoApplicationProxyRuleRead(d, meta) +} + +func resourceTencentCloudTeoApplicationProxyRuleRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy_rule.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 3 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + proxyId := idSplit[1] + ruleId := idSplit[2] + + applicationProxyRule, err := service.DescribeTeoApplicationProxyRule(ctx, zoneId, proxyId, ruleId) + + if err != nil { + return err + } + + if applicationProxyRule == nil { + d.SetId("") + return fmt.Errorf("resource `applicationProxyRule` %s does not exist", ruleId) + } + + if applicationProxyRule.RuleId != nil { + _ = d.Set("rule_id", applicationProxyRule.RuleId) + } + + if applicationProxyRule.Proto != nil { + _ = d.Set("proto", applicationProxyRule.Proto) + } + + if applicationProxyRule.Port != nil { + _ = d.Set("port", applicationProxyRule.Port) + } + + if applicationProxyRule.OriginType != nil { + _ = d.Set("origin_type", applicationProxyRule.OriginType) + } + + if applicationProxyRule.OriginValue != nil { + _ = d.Set("origin_value", applicationProxyRule.OriginValue) + } + + if applicationProxyRule.ForwardClientIp != nil { + _ = d.Set("forward_client_ip", applicationProxyRule.ForwardClientIp) + } + + if applicationProxyRule.SessionPersist != nil { + _ = d.Set("session_persist", applicationProxyRule.SessionPersist) + } + + return nil +} + +func resourceTencentCloudTeoApplicationProxyRuleUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy_rule.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyApplicationProxyRuleRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 3 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + proxyId := idSplit[1] + ruleId := idSplit[2] + + request.ZoneId = &zoneId + request.ProxyId = &proxyId + request.RuleId = &ruleId + + if d.HasChange("zone_id") { + return fmt.Errorf("`zone_id` do not support change now.") + } + + if d.HasChange("proxy_id") { + return fmt.Errorf("`proxy_id` do not support change now.") + } + + if v, ok := d.GetOk("proto"); ok { + request.Proto = helper.String(v.(string)) + } + + if v, ok := d.GetOk("port"); ok { + portSet := v.(*schema.Set).List() + for i := range portSet { + port := portSet[i].(string) + request.Port = append(request.Port, &port) + } + } + + if v, ok := d.GetOk("origin_type"); ok { + request.OriginType = helper.String(v.(string)) + } + + if v, ok := d.GetOk("origin_value"); ok { + originValueSet := v.(*schema.Set).List() + for i := range originValueSet { + originValue := originValueSet[i].(string) + request.OriginValue = append(request.OriginValue, &originValue) + } + } + + if d.HasChange("forward_client_ip") { + if v, ok := d.GetOk("forward_client_ip"); ok { + request.ForwardClientIp = helper.String(v.(string)) + } + } + + if d.HasChange("session_persist") { + if v, ok := d.GetOk("session_persist"); ok { + request.SessionPersist = helper.Bool(v.(bool)) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyApplicationProxyRule(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + return resourceTencentCloudTeoApplicationProxyRuleRead(d, meta) +} + +func resourceTencentCloudTeoApplicationProxyRuleDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_application_proxy_rule.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 3 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + proxyId := idSplit[1] + ruleId := idSplit[2] + + if err := service.DeleteTeoApplicationProxyRuleById(ctx, zoneId, proxyId, ruleId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_application_proxy_rule_test.go b/tencentcloud/resource_tc_teo_application_proxy_rule_test.go new file mode 100644 index 0000000000..21f905db3e --- /dev/null +++ b/tencentcloud/resource_tc_teo_application_proxy_rule_test.go @@ -0,0 +1,49 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoApplicationProxyRule_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoApplicationProxyRule, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_application_proxy_rule.application_proxy_rule", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_application_proxy_rule.application_proxy_rule", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoApplicationProxyRule = ` + +resource "tencentcloud_teo_application_proxy_rule" "application_proxy_rule" { + zone_id = tencentcloud_teo_zone.zone.id + proxy_id = tencentcloud_teo_application_proxy.application_proxy_rule.proxy_id + + forward_client_ip = "TOA" + origin_type = "custom" + origin_value = [ + "1.1.1.1:80", + ] + port = [ + "80", + ] + proto = "TCP" + session_persist = false +} + +` diff --git a/tencentcloud/resource_tc_teo_application_proxy_test.go b/tencentcloud/resource_tc_teo_application_proxy_test.go new file mode 100644 index 0000000000..14ff2b6159 --- /dev/null +++ b/tencentcloud/resource_tc_teo_application_proxy_test.go @@ -0,0 +1,45 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoApplicationProxy_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoApplicationProxy, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_application_proxy.application_proxy", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_application_proxy.application_proxy", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoApplicationProxy = ` + +resource "tencentcloud_teo_application_proxy" "application_proxy" { + zone_id = tencentcloud_teo_zone.zone.id + zone_name = "sfurnace.work" + + accelerate_type = 1 + security_type = 1 + plat_type = "domain" + proxy_name = "www.sfurnace.work" + proxy_type = "hostname" + session_persist_time = 2400 +} + +` diff --git a/tencentcloud/resource_tc_teo_ddos_policy.go b/tencentcloud/resource_tc_teo_ddos_policy.go new file mode 100644 index 0000000000..52f357bbcf --- /dev/null +++ b/tencentcloud/resource_tc_teo_ddos_policy.go @@ -0,0 +1,1346 @@ +/* +Provides a resource to create a teo ddosPolicy + +Example Usage + +```hcl +resource "tencentcloud_teo_ddos_policy" "ddosPolicy" { + zone_id = "" + policy_id = "" + ddos_rule { + switch = "" + udp_shard_open = "" + ddos_status_info { + ply_level = "" + } + ddos_geo_ip { + region_id = "" + switch = "" + } + ddos_allow_block { + switch = "" + user_allow_block_ip { + ip = "" + mask = "" + type = "" + ip2 = "" + mask2 = "" + } + } + ddos_anti_ply { + drop_tcp = "" + drop_udp = "" + drop_icmp = "" + drop_other = "" + source_create_limit = "" + source_connect_limit = "" + destination_create_limit = "" + destination_connect_limit = "" + abnormal_connect_num = "" + abnormal_syn_ratio = "" + abnormal_syn_num = "" + connect_timeout = "" + empty_connect_protect = "" + udp_shard = "" + } + ddos_packet_filter { + switch = "" + packet_filter { + action = "" + protocol = "" + dport_start = "" + dport_end = "" + packet_min = "" + packet_max = "" + sport_start = "" + sport_end = "" + match_type = "" + is_not = "" + offset = "" + depth = "" + match_begin = "" + str = "" + match_type2 = "" + is_not2 = "" + offset2 = "" + depth2 = "" + match_begin2 = "" + str2 = "" + match_logic = "" + } + } + ddos_acl { + switch = "" + acl { + dport_end = "" + dport_start = "" + sport_end = "" + sport_start = "" + protocol = "" + action = "" + default = "" + } + } + + } +} + +``` +Import + +teo ddosPolicy can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_ddos_policy.ddosPolicy ddosPolicy_id +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strconv" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoDdosPolicy() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoDdosPolicyRead, + Create: resourceTencentCloudTeoDdosPolicyCreate, + Update: resourceTencentCloudTeoDdosPolicyUpdate, + Delete: resourceTencentCloudTeoDdosPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "policy_id": { + Type: schema.TypeInt, + Required: true, + Description: "Policy ID.", + }, + + "ddos_rule": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "DDoS Configuration of the zone.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "DDoS protection switch. Valid values:- on: Enable.- off: Disable.", + }, + "udp_shard_open": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "UDP shard switch. Valid values:- on: Enable.- off: Disable.", + }, + "ddos_status_info": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "DDoS protection level.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ply_level": { + Type: schema.TypeString, + Required: true, + Description: "Policy level. Valid values:- low: loose.- middle: moderate.- high: strict.", + }, + }, + }, + }, + "ddos_geo_ip": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "DDoS Protection by Geo Info.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "region_id": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Computed: true, + Description: "Region ID. See details in data source `security_policy_regions`.", + }, + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "- on: Enable.- off: Disable.", + }, + }, + }, + }, + "ddos_allow_block": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "DDoS black-white list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "- on: Enable. `UserAllowBlockIp` parameter is required.- off: Disable.", + }, + "user_allow_block_ip": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "DDoS black-white list detail.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ip": { + Type: schema.TypeString, + Optional: true, + Description: "Client IP.", + }, + "mask": { + Type: schema.TypeInt, + Optional: true, + Description: "IP Mask.", + }, + "type": { + Type: schema.TypeString, + Required: true, + Description: "Valid values: `block`, `allow`.", + }, + "update_time": { + Type: schema.TypeInt, + Computed: true, + Description: "Last modification date.", + }, + "ip2": { + Type: schema.TypeString, + Optional: true, + Description: "End of the IP address when setting an IP range.", + }, + "mask2": { + Type: schema.TypeInt, + Optional: true, + Description: "IP mask of the end IP address.", + }, + }, + }, + }, + }, + }, + }, + "ddos_anti_ply": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "DDoS protocol and connection protection.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "drop_tcp": { + Type: schema.TypeString, + Required: true, + Description: "Block TCP protocol. Valid values: `on`, `off`.", + }, + "drop_udp": { + Type: schema.TypeString, + Required: true, + Description: "Block UDP protocol. Valid values: `on`, `off`.", + }, + "drop_icmp": { + Type: schema.TypeString, + Required: true, + Description: "Block ICMP protocol. Valid values: `on`, `off`.", + }, + "drop_other": { + Type: schema.TypeString, + Required: true, + Description: "Block other protocols. Valid values: `on`, `off`.", + }, + "source_create_limit": { + Type: schema.TypeInt, + Required: true, + Description: "Limitation of new connection to origin website per second. Valid value range: 0-4294967295.", + }, + "source_connect_limit": { + Type: schema.TypeInt, + Required: true, + Description: "Limitation of connections to origin website. Valid value range: 0-4294967295.", + }, + "destination_create_limit": { + Type: schema.TypeInt, + Required: true, + Description: "Limitation of new connection to dest port per second. Valid value range: 0-4294967295.", + }, + "destination_connect_limit": { + Type: schema.TypeInt, + Required: true, + Description: "Limitation of connections to dest port. Valid value range: 0-4294967295.", + }, + "abnormal_connect_num": { + Type: schema.TypeInt, + Required: true, + Description: "Abnormal connections threshold. Valid value range: 0-4294967295.", + }, + "abnormal_syn_ratio": { + Type: schema.TypeInt, + Required: true, + Description: "Abnormal syn packet ratio threshold. Valid value range: 0-100.", + }, + "abnormal_syn_num": { + Type: schema.TypeInt, + Required: true, + Description: "Abnormal syn packet number threshold. Valid value range: 0-65535.", + }, + "connect_timeout": { + Type: schema.TypeInt, + Required: true, + Description: "Connection timeout detection per second. Valid value range: 0-65535.", + }, + "empty_connect_protect": { + Type: schema.TypeString, + Required: true, + Description: "Empty connection protection switch. Valid values: `on`, `off`.", + }, + "udp_shard": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "UDP shard protection switch. Valid values: `on`, `off`.", + }, + }, + }, + }, + "ddos_packet_filter": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "DDoS feature filtering configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "- on: Enable. `ModifyDDoSPolicy` parameter is required.- off: Disable.", + }, + "packet_filter": { + Type: schema.TypeList, + Optional: true, + Description: "DDoS feature filtering configuration detail.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Action to take. Valid values: `drop`, `transmit`, `drop_block`, `forward`.", + }, + "protocol": { + Type: schema.TypeString, + Optional: true, + Description: "Valid value: `tcp`, `udp`, `icmp`, `all`.", + }, + "dport_start": { + Type: schema.TypeInt, + Optional: true, + Description: "Start of the dest port range. Valid value range: 0-65535.", + }, + "dport_end": { + Type: schema.TypeInt, + Optional: true, + Description: "End of the dest port range. Valid value range: 0-65535.", + }, + "packet_min": { + Type: schema.TypeInt, + Optional: true, + Description: "Min packet size. Valid value range: 0-1500.", + }, + "packet_max": { + Type: schema.TypeInt, + Optional: true, + Description: "Max packet size. Valid value range: 0-1500.", + }, + "sport_start": { + Type: schema.TypeInt, + Optional: true, + Description: "Start of the source port range. Valid value range: 0-65535.", + }, + "sport_end": { + Type: schema.TypeInt, + Optional: true, + Description: "End of the source port range. Valid value range: 0-65535.", + }, + "match_type": { + Type: schema.TypeString, + Optional: true, + Description: "Match type of feature 1. Valid values:- pcre: regex expression.- sunday: string match.", + }, + "is_not": { + Type: schema.TypeInt, + Optional: true, + Description: "Negate the match condition of feature 1. Valid values:- 0: match.- 1: not match.", + }, + "offset": { + Type: schema.TypeInt, + Optional: true, + Description: "Offset of feature 1. Valid value range: 1-1500.", + }, + "depth": { + Type: schema.TypeInt, + Optional: true, + Description: "Packet character depth to check of feature 1. Valid value range: 1-1500.", + }, + "match_begin": { + Type: schema.TypeString, + Optional: true, + Description: "Packet layer for matching begin of feature 1. Valid values:- begin_l5: matching from packet payload.- begin_l4: matching from TCP/UDP header.- begin_l3: matching from IP header.", + }, + "str": { + Type: schema.TypeString, + Optional: true, + Description: "Regex expression or string to match.", + }, + "match_type2": { + Type: schema.TypeString, + Optional: true, + Description: "Match type of feature 2. Valid values:- pcre: regex expression.- sunday: string match.", + }, + "is_not2": { + Type: schema.TypeInt, + Optional: true, + Description: "Negate the match condition of feature 2. Valid values:- 0: match.- 1: not match.", + }, + "offset2": { + Type: schema.TypeInt, + Optional: true, + Description: "Offset of feature 2. Valid value range: 1-1500.", + }, + "depth2": { + Type: schema.TypeInt, + Optional: true, + Description: "Packet character depth to check of feature 2. Valid value range: 1-1500.", + }, + "match_begin2": { + Type: schema.TypeString, + Optional: true, + Description: "Packet layer for matching begin of feature 2. Valid values:- begin_l5: matching from packet payload.- begin_l4: matching from TCP/UDP header.- begin_l3: matching from IP header.", + }, + "str2": { + Type: schema.TypeString, + Optional: true, + Description: "Regex expression or string to match.", + }, + "match_logic": { + Type: schema.TypeString, + Optional: true, + Description: "Relation between multi features. Valid values: `and`, `or`, `none` (only feature 1 is used).", + }, + }, + }, + }, + }, + }, + }, + "ddos_acl": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "DDoS ACL rule configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "- on: Enable. `Acl` parameter is require.- off: Disable.", + }, + "acl": { + Type: schema.TypeList, + Optional: true, + Description: "DDoS ACL rule configuration detail.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dport_end": { + Type: schema.TypeInt, + Optional: true, + Description: "End of the dest port range. Valid value range: 0-65535.", + }, + "dport_start": { + Type: schema.TypeInt, + Optional: true, + Description: "Start of the dest port range. Valid value range: 0-65535.", + }, + "sport_end": { + Type: schema.TypeInt, + Optional: true, + Description: "End of the source port range. Valid value range: 0-65535.", + }, + "sport_start": { + Type: schema.TypeInt, + Optional: true, + Description: "Start of the source port range. Valid value range: 0-65535.", + }, + "protocol": { + Type: schema.TypeString, + Optional: true, + Description: "Valid values: `tcp`, `udp`, `all`.", + }, + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Action to take. Valid values: `drop`, `transmit`, `forward`.", + }, + "default": { + Type: schema.TypeInt, + Optional: true, + Description: "Whether it is default configuration. Valid value:- 0: custom configuration.- 1: default configuration.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudTeoDdosPolicyCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_ddos_policy.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewModifyDDoSPolicyRequest() + response *teo.ModifyDDoSPolicyResponse + zoneId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("policy_id"); ok { + request.PolicyId = helper.IntInt64(v.(int)) + } + + if dMap, ok := helper.InterfacesHeadMap(d, "ddos_rule"); ok { + ddosRule := teo.DdosRule{} + if v, ok := dMap["switch"]; ok { + ddosRule.Switch = helper.String(v.(string)) + } + if v, ok := dMap["udp_shard_open"]; ok { + ddosRule.UdpShardOpen = helper.String(v.(string)) + } + if DdosStatusInfoMap, ok := helper.InterfaceToMap(dMap, "ddos_status_info"); ok { + dDoSStatusInfo := teo.DDoSStatusInfo{} + if v, ok := DdosStatusInfoMap["ply_level"]; ok { + dDoSStatusInfo.PlyLevel = helper.String(v.(string)) + } + ddosRule.DdosStatusInfo = &dDoSStatusInfo + } + if DdosGeoIpMap, ok := helper.InterfaceToMap(dMap, "ddos_geo_ip"); ok { + dDoSGeoIp := teo.DDoSGeoIp{} + if v, ok := DdosGeoIpMap["region_id"]; ok { + regionIdSet := v.(*schema.Set).List() + for i := range regionIdSet { + regionId := regionIdSet[i].(int) + dDoSGeoIp.RegionId = append(dDoSGeoIp.RegionId, helper.IntInt64(regionId)) + } + } + if v, ok := DdosGeoIpMap["switch"]; ok { + dDoSGeoIp.Switch = helper.String(v.(string)) + } + ddosRule.DdosGeoIp = &dDoSGeoIp + } + if DdosAllowBlockMap, ok := helper.InterfaceToMap(dMap, "ddos_allow_block"); ok { + ddosAllowBlock := teo.DdosAllowBlock{} + if v, ok := DdosAllowBlockMap["switch"]; ok { + ddosAllowBlock.Switch = helper.String(v.(string)) + } + if v, ok := DdosAllowBlockMap["user_allow_block_ip"]; ok { + for _, item := range v.([]interface{}) { + UserAllowBlockIpMap := item.(map[string]interface{}) + dDoSUserAllowBlockIP := teo.DDoSUserAllowBlockIP{} + if v, ok := UserAllowBlockIpMap["ip"]; ok { + dDoSUserAllowBlockIP.Ip = helper.String(v.(string)) + } + if v, ok := UserAllowBlockIpMap["mask"]; ok { + dDoSUserAllowBlockIP.Mask = helper.IntInt64(v.(int)) + } + if v, ok := UserAllowBlockIpMap["type"]; ok { + dDoSUserAllowBlockIP.Type = helper.String(v.(string)) + } + if v, ok := UserAllowBlockIpMap["ip2"]; ok { + dDoSUserAllowBlockIP.Ip2 = helper.String(v.(string)) + } + if v, ok := UserAllowBlockIpMap["mask2"]; ok { + dDoSUserAllowBlockIP.Mask2 = helper.IntInt64(v.(int)) + } + ddosAllowBlock.UserAllowBlockIp = append(ddosAllowBlock.UserAllowBlockIp, &dDoSUserAllowBlockIP) + } + } + ddosRule.DdosAllowBlock = &ddosAllowBlock + } + if DdosAntiPlyMap, ok := helper.InterfaceToMap(dMap, "ddos_anti_ply"); ok { + dDoSAntiPly := teo.DDoSAntiPly{} + if v, ok := DdosAntiPlyMap["drop_tcp"]; ok { + dDoSAntiPly.DropTcp = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["drop_udp"]; ok { + dDoSAntiPly.DropUdp = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["drop_icmp"]; ok { + dDoSAntiPly.DropIcmp = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["drop_other"]; ok { + dDoSAntiPly.DropOther = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["source_create_limit"]; ok { + dDoSAntiPly.SourceCreateLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["source_connect_limit"]; ok { + dDoSAntiPly.SourceConnectLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["destination_create_limit"]; ok { + dDoSAntiPly.DestinationCreateLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["destination_connect_limit"]; ok { + dDoSAntiPly.DestinationConnectLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["abnormal_connect_num"]; ok { + dDoSAntiPly.AbnormalConnectNum = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["abnormal_syn_ratio"]; ok { + dDoSAntiPly.AbnormalSynRatio = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["abnormal_syn_num"]; ok { + dDoSAntiPly.AbnormalSynNum = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["connect_timeout"]; ok { + dDoSAntiPly.ConnectTimeout = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["empty_connect_protect"]; ok { + dDoSAntiPly.EmptyConnectProtect = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["udp_shard"]; ok { + dDoSAntiPly.UdpShard = helper.String(v.(string)) + } + ddosRule.DdosAntiPly = &dDoSAntiPly + } + if DdosPacketFilterMap, ok := helper.InterfaceToMap(dMap, "ddos_packet_filter"); ok { + ddosPacketFilter := teo.DdosPacketFilter{} + if v, ok := DdosPacketFilterMap["switch"]; ok { + ddosPacketFilter.Switch = helper.String(v.(string)) + } + if v, ok := DdosPacketFilterMap["packet_filter"]; ok { + for _, item := range v.([]interface{}) { + PacketFilterMap := item.(map[string]interface{}) + dDoSFeaturesFilter := teo.DDoSFeaturesFilter{} + if v, ok := PacketFilterMap["action"]; ok { + dDoSFeaturesFilter.Action = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["protocol"]; ok { + dDoSFeaturesFilter.Protocol = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["dport_start"]; ok { + dDoSFeaturesFilter.DportStart = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["dport_end"]; ok { + dDoSFeaturesFilter.DportEnd = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["packet_min"]; ok { + dDoSFeaturesFilter.PacketMin = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["packet_max"]; ok { + dDoSFeaturesFilter.PacketMax = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["sport_start"]; ok { + dDoSFeaturesFilter.SportStart = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["sport_end"]; ok { + dDoSFeaturesFilter.SportEnd = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["match_type"]; ok { + dDoSFeaturesFilter.MatchType = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["is_not"]; ok { + dDoSFeaturesFilter.IsNot = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["offset"]; ok { + dDoSFeaturesFilter.Offset = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["depth"]; ok { + dDoSFeaturesFilter.Depth = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["match_begin"]; ok { + dDoSFeaturesFilter.MatchBegin = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["str"]; ok { + dDoSFeaturesFilter.Str = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["match_type2"]; ok { + dDoSFeaturesFilter.MatchType2 = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["is_not2"]; ok { + dDoSFeaturesFilter.IsNot2 = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["offset2"]; ok { + dDoSFeaturesFilter.Offset2 = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["depth2"]; ok { + dDoSFeaturesFilter.Depth2 = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["match_begin2"]; ok { + dDoSFeaturesFilter.MatchBegin2 = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["str2"]; ok { + dDoSFeaturesFilter.Str2 = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["match_logic"]; ok { + dDoSFeaturesFilter.MatchLogic = helper.String(v.(string)) + } + ddosPacketFilter.PacketFilter = append(ddosPacketFilter.PacketFilter, &dDoSFeaturesFilter) + } + } + ddosRule.DdosPacketFilter = &ddosPacketFilter + } + if DdosAclMap, ok := helper.InterfaceToMap(dMap, "ddos_acl"); ok { + ddosAcls := teo.DdosAcls{} + if v, ok := DdosAclMap["switch"]; ok { + ddosAcls.Switch = helper.String(v.(string)) + } + if v, ok := DdosAclMap["acl"]; ok { + for _, item := range v.([]interface{}) { + AclMap := item.(map[string]interface{}) + dDoSAcl := teo.DDoSAcl{} + if v, ok := AclMap["dport_end"]; ok { + dDoSAcl.DportEnd = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["dport_start"]; ok { + dDoSAcl.DportStart = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["sport_end"]; ok { + dDoSAcl.SportEnd = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["sport_start"]; ok { + dDoSAcl.SportStart = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["protocol"]; ok { + dDoSAcl.Protocol = helper.String(v.(string)) + } + if v, ok := AclMap["action"]; ok { + dDoSAcl.Action = helper.String(v.(string)) + } + if v, ok := AclMap["default"]; ok { + dDoSAcl.Default = helper.IntInt64(v.(int)) + } + ddosAcls.Acl = append(ddosAcls.Acl, &dDoSAcl) + } + } + ddosRule.DdosAcl = &ddosAcls + } + + request.DdosRule = &ddosRule + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyDDoSPolicy(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo ddosPolicy failed, reason:%+v", logId, err) + return err + } + + ddosPolicyId := strconv.FormatInt(*response.Response.PolicyId, 10) + + d.SetId(zoneId + FILED_SP + ddosPolicyId) + return resourceTencentCloudTeoDdosPolicyRead(d, meta) +} + +func resourceTencentCloudTeoDdosPolicyRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_ddos_policy.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + policyId := idSplit[1] + + ddosPolicy, err := service.DescribeTeoDdosPolicy(ctx, zoneId, policyId) + + if err != nil { + return err + } + + if ddosPolicy == nil { + d.SetId("") + return fmt.Errorf("resource `ddosPolicy` %s does not exist", policyId) + } + + _ = d.Set("zone_id", zoneId) + _ = d.Set("policy_id", policyId) + + if ddosPolicy.DdosRule != nil { + ddosRuleMap := map[string]interface{}{} + if ddosPolicy.DdosRule.Switch != nil { + ddosRuleMap["switch"] = ddosPolicy.DdosRule.Switch + } + if ddosPolicy.DdosRule.UdpShardOpen != nil { + ddosRuleMap["udp_shard_open"] = ddosPolicy.DdosRule.UdpShardOpen + } + if ddosPolicy.DdosRule.DdosStatusInfo != nil { + ddosStatusInfoMap := map[string]interface{}{} + if ddosPolicy.DdosRule.DdosStatusInfo.PlyLevel != nil { + ddosStatusInfoMap["ply_level"] = ddosPolicy.DdosRule.DdosStatusInfo.PlyLevel + } + + ddosRuleMap["ddos_status_info"] = []interface{}{ddosStatusInfoMap} + } + if ddosPolicy.DdosRule.DdosGeoIp != nil { + ddosGeoIpMap := map[string]interface{}{} + if ddosPolicy.DdosRule.DdosGeoIp.RegionId != nil { + ddosGeoIpMap["region_id"] = ddosPolicy.DdosRule.DdosGeoIp.RegionId + } + if ddosPolicy.DdosRule.DdosGeoIp.Switch != nil { + ddosGeoIpMap["switch"] = ddosPolicy.DdosRule.DdosGeoIp.Switch + } + + ddosRuleMap["ddos_geo_ip"] = []interface{}{ddosGeoIpMap} + } + if ddosPolicy.DdosRule.DdosAllowBlock != nil { + ddosAllowBlockMap := map[string]interface{}{} + if ddosPolicy.DdosRule.DdosAllowBlock.Switch != nil { + ddosAllowBlockMap["switch"] = ddosPolicy.DdosRule.DdosAllowBlock.Switch + } + if ddosPolicy.DdosRule.DdosAllowBlock.UserAllowBlockIp != nil { + userAllowBlockIpList := []interface{}{} + for _, userAllowBlockIp := range ddosPolicy.DdosRule.DdosAllowBlock.UserAllowBlockIp { + userAllowBlockIpMap := map[string]interface{}{} + if userAllowBlockIp.Ip != nil { + userAllowBlockIpMap["ip"] = userAllowBlockIp.Ip + } + if userAllowBlockIp.Mask != nil { + userAllowBlockIpMap["mask"] = userAllowBlockIp.Mask + } + if userAllowBlockIp.Type != nil { + userAllowBlockIpMap["type"] = userAllowBlockIp.Type + } + if userAllowBlockIp.UpdateTime != nil { + userAllowBlockIpMap["update_time"] = userAllowBlockIp.UpdateTime + } + if userAllowBlockIp.Ip2 != nil { + userAllowBlockIpMap["ip2"] = userAllowBlockIp.Ip2 + } + if userAllowBlockIp.Mask2 != nil { + userAllowBlockIpMap["mask2"] = userAllowBlockIp.Mask2 + } + + userAllowBlockIpList = append(userAllowBlockIpList, userAllowBlockIpMap) + } + ddosAllowBlockMap["user_allow_block_ip"] = userAllowBlockIpList + } + + ddosRuleMap["ddos_allow_block"] = []interface{}{ddosAllowBlockMap} + } + if ddosPolicy.DdosRule.DdosAntiPly != nil { + ddosAntiPlyMap := map[string]interface{}{} + if ddosPolicy.DdosRule.DdosAntiPly.DropTcp != nil { + ddosAntiPlyMap["drop_tcp"] = ddosPolicy.DdosRule.DdosAntiPly.DropTcp + } + if ddosPolicy.DdosRule.DdosAntiPly.DropUdp != nil { + ddosAntiPlyMap["drop_udp"] = ddosPolicy.DdosRule.DdosAntiPly.DropUdp + } + if ddosPolicy.DdosRule.DdosAntiPly.DropIcmp != nil { + ddosAntiPlyMap["drop_icmp"] = ddosPolicy.DdosRule.DdosAntiPly.DropIcmp + } + if ddosPolicy.DdosRule.DdosAntiPly.DropOther != nil { + ddosAntiPlyMap["drop_other"] = ddosPolicy.DdosRule.DdosAntiPly.DropOther + } + if ddosPolicy.DdosRule.DdosAntiPly.SourceCreateLimit != nil { + ddosAntiPlyMap["source_create_limit"] = ddosPolicy.DdosRule.DdosAntiPly.SourceCreateLimit + } + if ddosPolicy.DdosRule.DdosAntiPly.SourceConnectLimit != nil { + ddosAntiPlyMap["source_connect_limit"] = ddosPolicy.DdosRule.DdosAntiPly.SourceConnectLimit + } + if ddosPolicy.DdosRule.DdosAntiPly.DestinationCreateLimit != nil { + ddosAntiPlyMap["destination_create_limit"] = ddosPolicy.DdosRule.DdosAntiPly.DestinationCreateLimit + } + if ddosPolicy.DdosRule.DdosAntiPly.DestinationConnectLimit != nil { + ddosAntiPlyMap["destination_connect_limit"] = ddosPolicy.DdosRule.DdosAntiPly.DestinationConnectLimit + } + if ddosPolicy.DdosRule.DdosAntiPly.AbnormalConnectNum != nil { + ddosAntiPlyMap["abnormal_connect_num"] = ddosPolicy.DdosRule.DdosAntiPly.AbnormalConnectNum + } + if ddosPolicy.DdosRule.DdosAntiPly.AbnormalSynRatio != nil { + ddosAntiPlyMap["abnormal_syn_ratio"] = ddosPolicy.DdosRule.DdosAntiPly.AbnormalSynRatio + } + if ddosPolicy.DdosRule.DdosAntiPly.AbnormalSynNum != nil { + ddosAntiPlyMap["abnormal_syn_num"] = ddosPolicy.DdosRule.DdosAntiPly.AbnormalSynNum + } + if ddosPolicy.DdosRule.DdosAntiPly.ConnectTimeout != nil { + ddosAntiPlyMap["connect_timeout"] = ddosPolicy.DdosRule.DdosAntiPly.ConnectTimeout + } + if ddosPolicy.DdosRule.DdosAntiPly.EmptyConnectProtect != nil { + ddosAntiPlyMap["empty_connect_protect"] = ddosPolicy.DdosRule.DdosAntiPly.EmptyConnectProtect + } + if ddosPolicy.DdosRule.DdosAntiPly.UdpShard != nil { + ddosAntiPlyMap["udp_shard"] = ddosPolicy.DdosRule.DdosAntiPly.UdpShard + } + + ddosRuleMap["ddos_anti_ply"] = []interface{}{ddosAntiPlyMap} + } + if ddosPolicy.DdosRule.DdosPacketFilter != nil { + ddosPacketFilterMap := map[string]interface{}{} + if ddosPolicy.DdosRule.DdosPacketFilter.Switch != nil { + ddosPacketFilterMap["switch"] = ddosPolicy.DdosRule.DdosPacketFilter.Switch + } + if ddosPolicy.DdosRule.DdosPacketFilter.PacketFilter != nil { + packetFilterList := []interface{}{} + for _, packetFilter := range ddosPolicy.DdosRule.DdosPacketFilter.PacketFilter { + packetFilterMap := map[string]interface{}{} + if packetFilter.Action != nil { + packetFilterMap["action"] = packetFilter.Action + } + if packetFilter.Protocol != nil { + packetFilterMap["protocol"] = packetFilter.Protocol + } + if packetFilter.DportStart != nil { + packetFilterMap["dport_start"] = packetFilter.DportStart + } + if packetFilter.DportEnd != nil { + packetFilterMap["dport_end"] = packetFilter.DportEnd + } + if packetFilter.PacketMin != nil { + packetFilterMap["packet_min"] = packetFilter.PacketMin + } + if packetFilter.PacketMax != nil { + packetFilterMap["packet_max"] = packetFilter.PacketMax + } + if packetFilter.SportStart != nil { + packetFilterMap["sport_start"] = packetFilter.SportStart + } + if packetFilter.SportEnd != nil { + packetFilterMap["sport_end"] = packetFilter.SportEnd + } + if packetFilter.MatchType != nil { + packetFilterMap["match_type"] = packetFilter.MatchType + } + if packetFilter.IsNot != nil { + packetFilterMap["is_not"] = packetFilter.IsNot + } + if packetFilter.Offset != nil { + packetFilterMap["offset"] = packetFilter.Offset + } + if packetFilter.Depth != nil { + packetFilterMap["depth"] = packetFilter.Depth + } + if packetFilter.MatchBegin != nil { + packetFilterMap["match_begin"] = packetFilter.MatchBegin + } + if packetFilter.Str != nil { + packetFilterMap["str"] = packetFilter.Str + } + if packetFilter.MatchType2 != nil { + packetFilterMap["match_type2"] = packetFilter.MatchType2 + } + if packetFilter.IsNot2 != nil { + packetFilterMap["is_not2"] = packetFilter.IsNot2 + } + if packetFilter.Offset2 != nil { + packetFilterMap["offset2"] = packetFilter.Offset2 + } + if packetFilter.Depth2 != nil { + packetFilterMap["depth2"] = packetFilter.Depth2 + } + if packetFilter.MatchBegin2 != nil { + packetFilterMap["match_begin2"] = packetFilter.MatchBegin2 + } + if packetFilter.Str2 != nil { + packetFilterMap["str2"] = packetFilter.Str2 + } + if packetFilter.MatchLogic != nil { + packetFilterMap["match_logic"] = packetFilter.MatchLogic + } + + packetFilterList = append(packetFilterList, packetFilterMap) + } + ddosPacketFilterMap["packet_filter"] = packetFilterList + } + + ddosRuleMap["ddos_packet_filter"] = []interface{}{ddosPacketFilterMap} + } + if ddosPolicy.DdosRule.DdosAcl != nil { + ddosAclMap := map[string]interface{}{} + if ddosPolicy.DdosRule.DdosAcl.Switch != nil { + ddosAclMap["switch"] = ddosPolicy.DdosRule.DdosAcl.Switch + } + if ddosPolicy.DdosRule.DdosAcl.Acl != nil { + aclList := []interface{}{} + for _, acl := range ddosPolicy.DdosRule.DdosAcl.Acl { + aclMap := map[string]interface{}{} + if acl.DportEnd != nil { + aclMap["dport_end"] = acl.DportEnd + } + if acl.DportStart != nil { + aclMap["dport_start"] = acl.DportStart + } + if acl.SportEnd != nil { + aclMap["sport_end"] = acl.SportEnd + } + if acl.SportStart != nil { + aclMap["sport_start"] = acl.SportStart + } + if acl.Protocol != nil { + aclMap["protocol"] = acl.Protocol + } + if acl.Action != nil { + aclMap["action"] = acl.Action + } + if acl.Default != nil { + aclMap["default"] = acl.Default + } + + aclList = append(aclList, aclMap) + } + ddosAclMap["acl"] = aclList + } + + ddosRuleMap["ddos_acl"] = []interface{}{ddosAclMap} + } + + _ = d.Set("ddos_rule", []interface{}{ddosRuleMap}) + } + + return nil +} + +func resourceTencentCloudTeoDdosPolicyUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_ddos_policy.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + request := teo.NewModifyDDoSPolicyRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + policyId := idSplit[1] + + policyId64, errRet := strconv.ParseInt(policyId, 10, 64) + if errRet != nil { + return fmt.Errorf("Type conversion failed, [%s] conversion int64 failed\n", policyId) + } + + request.ZoneId = &zoneId + request.PolicyId = &policyId64 + + if d.HasChange("zone_id") { + return fmt.Errorf("`zone_id` do not support change now.") + } + + if d.HasChange("policy_id") { + return fmt.Errorf("`policy_id` do not support change now.") + } + + if d.HasChange("ddos_rule") { + if dMap, ok := helper.InterfacesHeadMap(d, "ddos_rule"); ok { + ddosRule := teo.DdosRule{} + if v, ok := dMap["switch"]; ok { + ddosRule.Switch = helper.String(v.(string)) + } + if v, ok := dMap["udp_shard_open"]; ok { + ddosRule.UdpShardOpen = helper.String(v.(string)) + } + if DdosStatusInfoMap, ok := helper.InterfaceToMap(dMap, "ddos_status_info"); ok { + dDoSStatusInfo := teo.DDoSStatusInfo{} + if v, ok := DdosStatusInfoMap["ply_level"]; ok { + dDoSStatusInfo.PlyLevel = helper.String(v.(string)) + } + ddosRule.DdosStatusInfo = &dDoSStatusInfo + } + if DdosGeoIpMap, ok := helper.InterfaceToMap(dMap, "ddos_geo_ip"); ok { + dDoSGeoIp := teo.DDoSGeoIp{} + if v, ok := DdosGeoIpMap["region_id"]; ok { + regionIdSet := v.(*schema.Set).List() + for i := range regionIdSet { + regionId := regionIdSet[i].(int) + dDoSGeoIp.RegionId = append(dDoSGeoIp.RegionId, helper.IntInt64(regionId)) + } + } + if v, ok := DdosGeoIpMap["switch"]; ok { + dDoSGeoIp.Switch = helper.String(v.(string)) + } + ddosRule.DdosGeoIp = &dDoSGeoIp + } + if DdosAllowBlockMap, ok := helper.InterfaceToMap(dMap, "ddos_allow_block"); ok { + ddosAllowBlock := teo.DdosAllowBlock{} + if v, ok := DdosAllowBlockMap["switch"]; ok { + ddosAllowBlock.Switch = helper.String(v.(string)) + } + if v, ok := DdosAllowBlockMap["user_allow_block_ip"]; ok { + for _, item := range v.([]interface{}) { + UserAllowBlockIpMap := item.(map[string]interface{}) + dDoSUserAllowBlockIP := teo.DDoSUserAllowBlockIP{} + if v, ok := UserAllowBlockIpMap["ip"]; ok { + dDoSUserAllowBlockIP.Ip = helper.String(v.(string)) + } + if v, ok := UserAllowBlockIpMap["mask"]; ok { + dDoSUserAllowBlockIP.Mask = helper.IntInt64(v.(int)) + } + if v, ok := UserAllowBlockIpMap["type"]; ok { + dDoSUserAllowBlockIP.Type = helper.String(v.(string)) + } + if v, ok := UserAllowBlockIpMap["ip2"]; ok { + dDoSUserAllowBlockIP.Ip2 = helper.String(v.(string)) + } + if v, ok := UserAllowBlockIpMap["mask2"]; ok { + dDoSUserAllowBlockIP.Mask2 = helper.IntInt64(v.(int)) + } + ddosAllowBlock.UserAllowBlockIp = append(ddosAllowBlock.UserAllowBlockIp, &dDoSUserAllowBlockIP) + } + } + ddosRule.DdosAllowBlock = &ddosAllowBlock + } + if DdosAntiPlyMap, ok := helper.InterfaceToMap(dMap, "ddos_anti_ply"); ok { + dDoSAntiPly := teo.DDoSAntiPly{} + if v, ok := DdosAntiPlyMap["drop_tcp"]; ok { + dDoSAntiPly.DropTcp = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["drop_udp"]; ok { + dDoSAntiPly.DropUdp = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["drop_icmp"]; ok { + dDoSAntiPly.DropIcmp = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["drop_other"]; ok { + dDoSAntiPly.DropOther = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["source_create_limit"]; ok { + dDoSAntiPly.SourceCreateLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["source_connect_limit"]; ok { + dDoSAntiPly.SourceConnectLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["destination_create_limit"]; ok { + dDoSAntiPly.DestinationCreateLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["destination_connect_limit"]; ok { + dDoSAntiPly.DestinationConnectLimit = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["abnormal_connect_num"]; ok { + dDoSAntiPly.AbnormalConnectNum = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["abnormal_syn_ratio"]; ok { + dDoSAntiPly.AbnormalSynRatio = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["abnormal_syn_num"]; ok { + dDoSAntiPly.AbnormalSynNum = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["connect_timeout"]; ok { + dDoSAntiPly.ConnectTimeout = helper.IntInt64(v.(int)) + } + if v, ok := DdosAntiPlyMap["empty_connect_protect"]; ok { + dDoSAntiPly.EmptyConnectProtect = helper.String(v.(string)) + } + if v, ok := DdosAntiPlyMap["udp_shard"]; ok { + dDoSAntiPly.UdpShard = helper.String(v.(string)) + } + ddosRule.DdosAntiPly = &dDoSAntiPly + } + if DdosPacketFilterMap, ok := helper.InterfaceToMap(dMap, "ddos_packet_filter"); ok { + ddosPacketFilter := teo.DdosPacketFilter{} + if v, ok := DdosPacketFilterMap["switch"]; ok { + ddosPacketFilter.Switch = helper.String(v.(string)) + } + if v, ok := DdosPacketFilterMap["packet_filter"]; ok { + for _, item := range v.([]interface{}) { + PacketFilterMap := item.(map[string]interface{}) + dDoSFeaturesFilter := teo.DDoSFeaturesFilter{} + if v, ok := PacketFilterMap["action"]; ok { + dDoSFeaturesFilter.Action = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["protocol"]; ok { + dDoSFeaturesFilter.Protocol = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["dport_start"]; ok { + dDoSFeaturesFilter.DportStart = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["dport_end"]; ok { + dDoSFeaturesFilter.DportEnd = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["packet_min"]; ok { + dDoSFeaturesFilter.PacketMin = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["packet_max"]; ok { + dDoSFeaturesFilter.PacketMax = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["sport_start"]; ok { + dDoSFeaturesFilter.SportStart = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["sport_end"]; ok { + dDoSFeaturesFilter.SportEnd = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["match_type"]; ok { + dDoSFeaturesFilter.MatchType = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["is_not"]; ok { + dDoSFeaturesFilter.IsNot = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["offset"]; ok { + dDoSFeaturesFilter.Offset = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["depth"]; ok { + dDoSFeaturesFilter.Depth = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["match_begin"]; ok { + dDoSFeaturesFilter.MatchBegin = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["str"]; ok { + dDoSFeaturesFilter.Str = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["match_type2"]; ok { + dDoSFeaturesFilter.MatchType2 = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["is_not2"]; ok { + dDoSFeaturesFilter.IsNot2 = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["offset2"]; ok { + dDoSFeaturesFilter.Offset2 = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["depth2"]; ok { + dDoSFeaturesFilter.Depth2 = helper.IntInt64(v.(int)) + } + if v, ok := PacketFilterMap["match_begin2"]; ok { + dDoSFeaturesFilter.MatchBegin2 = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["str2"]; ok { + dDoSFeaturesFilter.Str2 = helper.String(v.(string)) + } + if v, ok := PacketFilterMap["match_logic"]; ok { + dDoSFeaturesFilter.MatchLogic = helper.String(v.(string)) + } + ddosPacketFilter.PacketFilter = append(ddosPacketFilter.PacketFilter, &dDoSFeaturesFilter) + } + } + ddosRule.DdosPacketFilter = &ddosPacketFilter + } + if DdosAclMap, ok := helper.InterfaceToMap(dMap, "ddos_acl"); ok { + ddosAcls := teo.DdosAcls{} + if v, ok := DdosAclMap["switch"]; ok { + ddosAcls.Switch = helper.String(v.(string)) + } + if v, ok := DdosAclMap["acl"]; ok { + for _, item := range v.([]interface{}) { + AclMap := item.(map[string]interface{}) + dDoSAcl := teo.DDoSAcl{} + if v, ok := AclMap["dport_end"]; ok { + dDoSAcl.DportEnd = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["dport_start"]; ok { + dDoSAcl.DportStart = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["sport_end"]; ok { + dDoSAcl.SportEnd = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["sport_start"]; ok { + dDoSAcl.SportStart = helper.IntInt64(v.(int)) + } + if v, ok := AclMap["protocol"]; ok { + dDoSAcl.Protocol = helper.String(v.(string)) + } + if v, ok := AclMap["action"]; ok { + dDoSAcl.Action = helper.String(v.(string)) + } + if v, ok := AclMap["default"]; ok { + dDoSAcl.Default = helper.IntInt64(v.(int)) + } + ddosAcls.Acl = append(ddosAcls.Acl, &dDoSAcl) + } + } + ddosRule.DdosAcl = &ddosAcls + } + + request.DdosRule = &ddosRule + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyDDoSPolicy(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + return resourceTencentCloudTeoDdosPolicyRead(d, meta) +} + +func resourceTencentCloudTeoDdosPolicyDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_ddos_policy.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + policyId := idSplit[1] + + if err := service.DeleteTeoDdosPolicyById(ctx, zoneId, policyId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_ddos_policy_test.go b/tencentcloud/resource_tc_teo_ddos_policy_test.go new file mode 100644 index 0000000000..e4f2cc7ece --- /dev/null +++ b/tencentcloud/resource_tc_teo_ddos_policy_test.go @@ -0,0 +1,108 @@ +package tencentcloud + +//func TestAccTencentCloudTeoDdosPolicy_basic(t *testing.T) { +// t.Parallel() +// +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// Steps: []resource.TestStep{ +// { +// Config: testAccTeoDdosPolicy, +// Check: resource.ComposeTestCheckFunc( +// resource.TestCheckResourceAttrSet("tencentcloud_teo_ddos_policy.ddosPolicy", "id"), +// ), +// }, +// { +// ResourceName: "tencentcloud_teo_ddos_policy.ddosPolicy", +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +//} + +const testAccTeoDdosPolicy = ` + +resource "tencentcloud_teo_ddos_policy" "ddosPolicy" { + zone_id = "" + policy_id = "" + ddos_rule { + switch = "" + udp_shard_open = "" + ddos_status_info { + ply_level = "" + } + ddos_geo_ip { + region_id = "" + switch = "" + } + ddos_allow_block { + switch = "" + user_allow_block_ip { + ip = "" + mask = "" + type = "" + ip2 = "" + mask2 = "" + } + } + ddos_anti_ply { + drop_tcp = "" + drop_udp = "" + drop_icmp = "" + drop_other = "" + source_create_limit = "" + source_connect_limit = "" + destination_create_limit = "" + destination_connect_limit = "" + abnormal_connect_num = "" + abnormal_syn_ratio = "" + abnormal_syn_num = "" + connect_timeout = "" + empty_connect_protect = "" + udp_shard = "" + } + ddos_packet_filter { + switch = "" + packet_filter { + action = "" + protocol = "" + dport_start = "" + dport_end = "" + packet_min = "" + packet_max = "" + sport_start = "" + sport_end = "" + match_type = "" + is_not = "" + offset = "" + depth = "" + match_begin = "" + str = "" + match_type2 = "" + is_not2 = "" + offset2 = "" + depth2 = "" + match_begin2 = "" + str2 = "" + match_logic = "" + } + } + ddos_acl { + switch = "" + acl { + dport_end = "" + dport_start = "" + sport_end = "" + sport_start = "" + protocol = "" + action = "" + default = "" + } + } + + } +} + +` diff --git a/tencentcloud/resource_tc_teo_default_certificate.go b/tencentcloud/resource_tc_teo_default_certificate.go new file mode 100644 index 0000000000..0c769b3d39 --- /dev/null +++ b/tencentcloud/resource_tc_teo_default_certificate.go @@ -0,0 +1,262 @@ +/* +Provides a resource to create a teo defaultCertificate + +Example Usage + +```hcl +resource "tencentcloud_teo_default_certificate" "default_certificate" { + zone_id = tencentcloud_teo_zone.zone.id + + cert_info { + cert_id = "teo-28i46c1gtmkl" + status = "deployed" + } +} + +``` +Import + +teo default_certificate can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_default_certificate.default_certificate zoneId +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" +) + +func resourceTencentCloudTeoDefaultCertificate() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoDefaultCertificateRead, + Create: resourceTencentCloudTeoDefaultCertificateCreate, + Update: resourceTencentCloudTeoDefaultCertificateUpdate, + Delete: resourceTencentCloudTeoDefaultCertificateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "cert_info": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "List of default certificates. Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cert_id": { + Type: schema.TypeString, + Required: true, + Description: "Server certificate ID, which is the ID of the default certificate. If you choose to upload an external certificate for SSL certificate management, a certificate ID will be generated.", + }, + "alias": { + Type: schema.TypeString, + Computed: true, + Description: "Certificate alias. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Certificate type.- default: Default certificate.- upload: External certificate.- managed: Tencent Cloud managed certificate.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + Description: "Time when the certificate expires. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "effective_time": { + Type: schema.TypeString, + Computed: true, + Description: "Time when the certificate takes effect. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "common_name": { + Type: schema.TypeString, + Computed: true, + Description: "Certificate common name. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "subject_alt_name": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + Description: "Domain names added to the SAN certificate. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Certificate status.- applying: Application in progress.- failed: Application failed.- processing: Deploying certificate.- deployed: Certificate deployed.- disabled: Certificate disabled.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "message": { + Type: schema.TypeString, + Computed: true, + Description: "Returns a message to display failure causes when `Status` is failed.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudTeoDefaultCertificateCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_default_certificate.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + zoneId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + } + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + err := resource.Retry(60*readRetryTimeout, func() *resource.RetryError { + instance, errRet := service.DescribeTeoDefaultCertificate(ctx, zoneId) + if errRet != nil { + return retryError(errRet, InternalError) + } + if *instance.Status == "deployed" { + return nil + } + if *instance.Status == "disabled" { + return resource.NonRetryableError(fmt.Errorf("defaultCertificate status is %v, operate failed.", *instance.Status)) + } + return resource.RetryableError(fmt.Errorf("defaultCertificate status is %v, retry...", *instance.Status)) + }) + if err != nil { + return err + } + + d.SetId(zoneId) + return resourceTencentCloudTeoDefaultCertificateUpdate(d, meta) +} + +func resourceTencentCloudTeoDefaultCertificateRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_default_certificate.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + zoneId := d.Id() + + defaultCertificate, err := service.DescribeTeoDefaultCertificate(ctx, zoneId) + + if err != nil { + return err + } + + if defaultCertificate == nil { + d.SetId("") + return fmt.Errorf("resource `defaultCertificate` %s does not exist", zoneId) + } + + if defaultCertificate != nil { + certInfoMap := map[string]interface{}{} + if defaultCertificate.CertId != nil { + certInfoMap["cert_id"] = defaultCertificate.CertId + } + if defaultCertificate.Alias != nil { + certInfoMap["alias"] = defaultCertificate.Alias + } + if defaultCertificate.Type != nil { + certInfoMap["type"] = defaultCertificate.Type + } + if defaultCertificate.ExpireTime != nil { + certInfoMap["expire_time"] = defaultCertificate.ExpireTime + } + if defaultCertificate.EffectiveTime != nil { + certInfoMap["effective_time"] = defaultCertificate.EffectiveTime + } + if defaultCertificate.CommonName != nil { + certInfoMap["common_name"] = defaultCertificate.CommonName + } + if defaultCertificate.SubjectAltName != nil { + certInfoMap["subject_alt_name"] = defaultCertificate.SubjectAltName + } + if defaultCertificate.Status != nil { + certInfoMap["status"] = defaultCertificate.Status + } + if defaultCertificate.Message != nil { + certInfoMap["message"] = defaultCertificate.Message + } + + _ = d.Set("cert_info", []interface{}{certInfoMap}) + } + + return nil +} + +func resourceTencentCloudTeoDefaultCertificateUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_default_certificate.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyDefaultCertificateRequest() + + zoneId := d.Id() + + request.ZoneId = &zoneId + if certInfo, ok := d.GetOk("cert_info"); ok { + if defaultCertList := certInfo.([]interface{}); len(defaultCertList) > 0 { + if cert := defaultCertList[0].(map[string]interface{}); cert != nil { + if v := cert["cert_id"]; v != nil { + request.CertId = helper.String(v.(string)) + } + if v := cert["status"]; v != nil { + request.Status = helper.String(v.(string)) + } + } + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyDefaultCertificate(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo defaultCertificate failed, reason:%+v", logId, err) + return err + } + + return resourceTencentCloudTeoDefaultCertificateRead(d, meta) +} + +func resourceTencentCloudTeoDefaultCertificateDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_default_certificate.delete")() + defer inconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/resource_tc_teo_default_certificate_test.go b/tencentcloud/resource_tc_teo_default_certificate_test.go new file mode 100644 index 0000000000..0bd69da533 --- /dev/null +++ b/tencentcloud/resource_tc_teo_default_certificate_test.go @@ -0,0 +1,42 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoDefaultCertificate_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoDefaultCertificate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_default_certificate.default_certificate", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_default_certificate.defaultCertificate", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoDefaultCertificate = ` + +resource "tencentcloud_teo_default_certificate" "default_certificate" { + zone_id = tencentcloud_teo_zone.zone.id + + cert_info { + cert_id = "teo-28i46c1gtmkl" + status = "deployed" + } +} + +` diff --git a/tencentcloud/resource_tc_teo_dns_record.go b/tencentcloud/resource_tc_teo_dns_record.go new file mode 100644 index 0000000000..64f8b50c45 --- /dev/null +++ b/tencentcloud/resource_tc_teo_dns_record.go @@ -0,0 +1,427 @@ +/* +Provides a resource to create a teo dnsRecord + +Example Usage + +```hcl +resource "tencentcloud_teo_dns_record" "dns_record" { + zone_id = tencentcloud_teo_zone.zone.id + record_type = "A" + name = "sfurnace.work" + mode = "proxied" + content = "2.2.2.2" + ttl = 80 +} + +``` +Import + +teo dns_record can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_dns_record.dnsRecord zoneId#dnsRecordId#name +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoDnsRecord() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoDnsRecordRead, + Create: resourceTencentCloudTeoDnsRecordCreate, + Update: resourceTencentCloudTeoDnsRecordUpdate, + Delete: resourceTencentCloudTeoDnsRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "record_type": { + Type: schema.TypeString, + Required: true, + Description: "DNS Record Type.", + }, + + "name": { + Type: schema.TypeString, + Required: true, + Description: "DNS Record Name.", + }, + + "content": { + Type: schema.TypeString, + Required: true, + Description: "DNS Record Content.", + }, + + "mode": { + Type: schema.TypeString, + Required: true, + Description: "Proxy mode. Valid values: dns_only, cdn_only, and secure_cdn.", + }, + + "ttl": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "TTL, the range is 1-604800, and the minimum value of different levels of domain names is different.", + }, + + "priority": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Priority.", + }, + + "created_on": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + + "modified_on": { + Type: schema.TypeString, + Computed: true, + Description: "Modification time.", + }, + + "locked": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether the DNS record is locked.", + }, + + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "zone_name": { + Type: schema.TypeString, + Computed: true, + Description: "Site Name.", + }, + + "status": { + Type: schema.TypeString, + Computed: true, + Description: "Resolution status.", + }, + + "cname": { + Type: schema.TypeString, + Computed: true, + Description: "CNAME address.", + }, + + "domain_status": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + Description: ".", + }, + + "tags": { + Type: schema.TypeMap, + Optional: true, + Description: "Tag description list.", + }, + }, + } +} + +func resourceTencentCloudTeoDnsRecordCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_record.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateDnsRecordRequest() + response *teo.CreateDnsRecordResponse + ) + + if v, ok := d.GetOk("record_type"); ok { + request.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("name"); ok { + request.Name = helper.String(v.(string)) + } + + if v, ok := d.GetOk("content"); ok { + request.Content = helper.String(v.(string)) + } + + if v, ok := d.GetOk("mode"); ok { + request.Mode = helper.String(v.(string)) + } + + if v, ok := d.GetOk("ttl"); ok { + request.Ttl = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("priority"); ok { + request.Priority = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOk("zone_id"); ok { + request.ZoneId = helper.String(v.(string)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateDnsRecord(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo dnsRecord failed, reason:%+v", logId, err) + return err + } + + dnsRecordId := *response.Response.Id + + ctx := context.WithValue(context.TODO(), logIdKey, logId) + if tags := helper.GetTags(d, "tags"); len(tags) > 0 { + tagService := TagService{client: meta.(*TencentCloudClient).apiV3Conn} + region := meta.(*TencentCloudClient).apiV3Conn.Region + resourceName := fmt.Sprintf("qcs::teo:%s:uin/:zone/%s", region, dnsRecordId) + if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil { + return err + } + } + + zoneId := *response.Response.ZoneId + name := *response.Response.Name + d.SetId(strings.Join([]string{zoneId, dnsRecordId, name}, FILED_SP)) + return resourceTencentCloudTeoDnsRecordRead(d, meta) +} + +func resourceTencentCloudTeoDnsRecordRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dnsRecord.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + ids := strings.Split(d.Id(), FILED_SP) + if len(ids) != 3 { + return fmt.Errorf("id is broken, id is %s", d.Id()) + } + + zoneId := ids[0] + //dnsRecordId := ids[1] + name := ids[2] + + dnsRecord, err := service.DescribeTeoDnsRecord(ctx, zoneId, name) + + if err != nil { + return err + } + + if dnsRecord == nil { + d.SetId("") + return fmt.Errorf("resource `dnsRecord` %s does not exist", name) + } + + _ = d.Set("id", dnsRecord.Id) + + if dnsRecord.Type != nil { + _ = d.Set("record_type", dnsRecord.Type) + } + + if dnsRecord.Name != nil { + _ = d.Set("name", dnsRecord.Name) + } + + if dnsRecord.Content != nil { + _ = d.Set("content", dnsRecord.Content) + } + + if dnsRecord.Mode != nil { + _ = d.Set("mode", dnsRecord.Mode) + } + + if dnsRecord.Ttl != nil { + _ = d.Set("ttl", dnsRecord.Ttl) + } + + if dnsRecord.Priority != nil { + _ = d.Set("priority", dnsRecord.Priority) + } + + if dnsRecord.CreatedOn != nil { + _ = d.Set("created_on", dnsRecord.CreatedOn) + } + + if dnsRecord.ModifiedOn != nil { + _ = d.Set("modified_on", dnsRecord.ModifiedOn) + } + + if dnsRecord.Locked != nil { + _ = d.Set("locked", dnsRecord.Locked) + } + + if dnsRecord.ZoneId != nil { + _ = d.Set("zone_id", dnsRecord.ZoneId) + } + + if dnsRecord.ZoneName != nil { + _ = d.Set("zone_name", dnsRecord.ZoneName) + } + + if dnsRecord.Status != nil { + _ = d.Set("status", dnsRecord.Status) + } + + if dnsRecord.Cname != nil { + _ = d.Set("cname", dnsRecord.Cname) + } + + if dnsRecord.DomainStatus != nil { + _ = d.Set("domain_status", dnsRecord.DomainStatus) + } + + tcClient := meta.(*TencentCloudClient).apiV3Conn + tagService := &TagService{client: tcClient} + tags, err := tagService.DescribeResourceTags(ctx, "teo", "zone", tcClient.Region, d.Id()) + if err != nil { + return err + } + _ = d.Set("tags", tags) + + return nil +} + +func resourceTencentCloudTeoDnsRecordUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_record.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + request := teo.NewModifyDnsRecordRequest() + + ids := strings.Split(d.Id(), FILED_SP) + if len(ids) != 3 { + return fmt.Errorf("id is broken, id is %s", d.Id()) + } + + zoneId := ids[0] + dnsRecordId := ids[1] + //name := ids[2] + + request.ZoneId = &zoneId + request.Id = &dnsRecordId + + if d.HasChange("record_type") { + if v, ok := d.GetOk("record_type"); ok { + request.Type = helper.String(v.(string)) + } + } + + if d.HasChange("name") { + if v, ok := d.GetOk("name"); ok { + request.Name = helper.String(v.(string)) + } + } + + if d.HasChange("content") { + if v, ok := d.GetOk("content"); ok { + request.Content = helper.String(v.(string)) + } + } + + if d.HasChange("mode") { + if v, ok := d.GetOk("mode"); ok { + request.Mode = helper.String(v.(string)) + } + } + + if d.HasChange("ttl") { + if v, ok := d.GetOk("ttl"); ok { + request.Ttl = helper.IntInt64(v.(int)) + } + } + + if d.HasChange("priority") { + if v, ok := d.GetOk("priority"); ok { + request.Priority = helper.IntInt64(v.(int)) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyDnsRecord(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + if d.HasChange("tags") { + tcClient := meta.(*TencentCloudClient).apiV3Conn + tagService := &TagService{client: tcClient} + oldTags, newTags := d.GetChange("tags") + replaceTags, deleteTags := diffTags(oldTags.(map[string]interface{}), newTags.(map[string]interface{})) + resourceName := BuildTagResourceName("teo", "zone", tcClient.Region, d.Id()) + if err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags); err != nil { + return err + } + } + + return resourceTencentCloudTeoDnsRecordRead(d, meta) +} + +func resourceTencentCloudTeoDnsRecordDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_record.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + ids := strings.Split(d.Id(), FILED_SP) + if len(ids) != 3 { + return fmt.Errorf("id is broken, id is %s", d.Id()) + } + + zoneId := ids[0] + dnsRecordId := ids[1] + //name := ids[2] + + if err := service.DeleteTeoDnsRecordById(ctx, zoneId, dnsRecordId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_dns_sec.go b/tencentcloud/resource_tc_teo_dns_sec.go new file mode 100644 index 0000000000..a0bc817388 --- /dev/null +++ b/tencentcloud/resource_tc_teo_dns_sec.go @@ -0,0 +1,274 @@ +/* +Provides a resource to create a teo dnsSec + +Example Usage + +```hcl +resource "tencentcloud_teo_dns_sec" "dns_sec" { + zone_id = tencentcloud_teo_zone.zone.id + status = "disabled" +} + +``` +Import + +teo dns_sec can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_dns_sec.dns_sec zoneId +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoDnsSec() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoDnsSecRead, + Create: resourceTencentCloudTeoDnsSecCreate, + Update: resourceTencentCloudTeoDnsSecUpdate, + Delete: resourceTencentCloudTeoDnsSecDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "zone_name": { + Type: schema.TypeString, + Computed: true, + Description: "Site Name.", + }, + + "status": { + Type: schema.TypeString, + Required: true, + Description: "DNSSEC status. Valid values: `enabled`, `disabled`.", + }, + + "dnssec": { + Type: schema.TypeList, + MaxItems: 1, + Computed: true, + Description: "DNSSEC infos.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "flags": { + Type: schema.TypeInt, + Computed: true, + Description: "Flag.", + }, + "algorithm": { + Type: schema.TypeString, + Computed: true, + Description: "Encryption algorithm.", + }, + "key_type": { + Type: schema.TypeString, + Computed: true, + Description: "Encryption type.", + }, + "digest_type": { + Type: schema.TypeString, + Computed: true, + Description: "Digest type.", + }, + "digest_algorithm": { + Type: schema.TypeString, + Computed: true, + Description: "Digest algorithm.", + }, + "digest": { + Type: schema.TypeString, + Computed: true, + Description: "Digest message.", + }, + "d_s": { + Type: schema.TypeString, + Computed: true, + Description: "DS record value.", + }, + "key_tag": { + Type: schema.TypeInt, + Computed: true, + Description: "Key tag.", + }, + "public_key": { + Type: schema.TypeString, + Computed: true, + Description: "Public key.", + }, + }, + }, + }, + + "modified_on": { + Type: schema.TypeString, + Computed: true, + Description: "Last modification date.", + }, + }, + } +} + +func resourceTencentCloudTeoDnsSecCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_sec.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewModifyDnssecRequest() + zoneId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.Id = helper.String(v.(string)) + } + + if v, ok := d.GetOk("status"); ok { + request.Status = helper.String(v.(string)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyDnssec(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo dnsSec failed, reason:%+v", logId, err) + return err + } + + d.SetId(zoneId) + return resourceTencentCloudTeoDnsSecRead(d, meta) +} + +func resourceTencentCloudTeoDnsSecRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_sec.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + zoneId := d.Id() + + dnsSec, err := service.DescribeTeoDnsSec(ctx, zoneId) + + if err != nil { + return err + } + + if dnsSec == nil { + d.SetId("") + return fmt.Errorf("resource `dnsSec` %s does not exist", zoneId) + } + + if dnsSec.Name != nil { + _ = d.Set("zone_name", dnsSec.Name) + } + + if dnsSec.Status != nil { + _ = d.Set("status", dnsSec.Status) + } + + if dnsSec.Dnssec != nil { + dnssecMap := map[string]interface{}{} + if dnsSec.Dnssec.Flags != nil { + dnssecMap["flags"] = dnsSec.Dnssec.Flags + } + if dnsSec.Dnssec.Algorithm != nil { + dnssecMap["algorithm"] = dnsSec.Dnssec.Algorithm + } + if dnsSec.Dnssec.KeyType != nil { + dnssecMap["key_type"] = dnsSec.Dnssec.KeyType + } + if dnsSec.Dnssec.DigestType != nil { + dnssecMap["digest_type"] = dnsSec.Dnssec.DigestType + } + if dnsSec.Dnssec.DigestAlgorithm != nil { + dnssecMap["digest_algorithm"] = dnsSec.Dnssec.DigestAlgorithm + } + if dnsSec.Dnssec.Digest != nil { + dnssecMap["digest"] = dnsSec.Dnssec.Digest + } + if dnsSec.Dnssec.DS != nil { + dnssecMap["d_s"] = dnsSec.Dnssec.DS + } + if dnsSec.Dnssec.KeyTag != nil { + dnssecMap["key_tag"] = dnsSec.Dnssec.KeyTag + } + if dnsSec.Dnssec.PublicKey != nil { + dnssecMap["public_key"] = dnsSec.Dnssec.PublicKey + } + + _ = d.Set("dnssec", []interface{}{dnssecMap}) + } + + if dnsSec.ModifiedOn != nil { + _ = d.Set("modified_on", dnsSec.ModifiedOn) + } + + return nil +} + +func resourceTencentCloudTeoDnsSecUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_sec.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + request := teo.NewModifyDnssecRequest() + + zoneId := d.Id() + request.Id = &zoneId + + if v, ok := d.GetOk("status"); ok { + request.Status = helper.String(v.(string)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyDnssec(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo dnsSec failed, reason:%+v", logId, err) + return err + } + + return resourceTencentCloudTeoDnsSecRead(d, meta) +} + +func resourceTencentCloudTeoDnsSecDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_dns_sec.delete")() + defer inconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/resource_tc_teo_dns_sec_test.go b/tencentcloud/resource_tc_teo_dns_sec_test.go new file mode 100644 index 0000000000..f6acc31a3c --- /dev/null +++ b/tencentcloud/resource_tc_teo_dns_sec_test.go @@ -0,0 +1,37 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoDnsSec_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoDnsSec, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_dns_sec.dns_sec", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_dns_sec.dns_sec", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoDnsSec = ` + +resource "tencentcloud_teo_dns_sec" "dns_sec" { + zone_id = tencentcloud_teo_zone.zone.id + status = "disabled" +} +` diff --git a/tencentcloud/resource_tc_teo_host_certificate.go b/tencentcloud/resource_tc_teo_host_certificate.go new file mode 100644 index 0000000000..1546754dab --- /dev/null +++ b/tencentcloud/resource_tc_teo_host_certificate.go @@ -0,0 +1,237 @@ +/* +Provides a resource to create a teo hostCertificate + +Example Usage + +```hcl +resource "tencentcloud_teo_host_certificate" "host_certificate" { + zone_id = tencentcloud_teo_zone.zone.id + host = tencentcloud_teo_dns_record.dns_record.name + + cert_info { + cert_id = "yqWPPbs7" + status = "deployed" + } +} + +``` +Import + +teo hostCertificate can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_host_certificate.host_certificate zoneId#host +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoHostCertificate() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoHostCertificateRead, + Create: resourceTencentCloudTeoHostCertificateCreate, + Update: resourceTencentCloudTeoHostCertificateUpdate, + Delete: resourceTencentCloudTeoHostCertificateDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "host": { + Type: schema.TypeString, + Required: true, + Description: "Domain name.", + }, + + "cert_info": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "Server certificate configuration.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cert_id": { + Type: schema.TypeString, + Required: true, + Description: "Server certificate ID, which is the ID of the default certificate. If you choose to upload an external certificate for SSL certificate management, a certificate ID will be generated.", + }, + "alias": { + Type: schema.TypeString, + Computed: true, + Description: "Alias of the certificate.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Certificate type.- default: Default certificate.- upload: External certificate.- managed: Tencent Cloud managed certificate.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "expire_time": { + Type: schema.TypeString, + Computed: true, + Description: "Time when the certificate expires.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "status": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Certificate deployment status.- processing: Deploying- deployed: DeployedNote: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudTeoHostCertificateCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_host_certificate.create")() + defer inconsistentCheck(d, meta)() + + var ( + zoneId string + host string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + } + + if v, ok := d.GetOk("host"); ok { + host = v.(string) + } + d.SetId(zoneId + FILED_SP + host) + return resourceTencentCloudTeoHostCertificateUpdate(d, meta) +} + +func resourceTencentCloudTeoHostCertificateRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_host_certificate.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + host := idSplit[1] + + hostCertificate, err := service.DescribeTeoHostCertificate(ctx, zoneId, host) + + if err != nil { + return err + } + + if hostCertificate == nil { + d.SetId("") + return fmt.Errorf("resource `hostCertificate` %s does not exist", d.Id()) + } + + if hostCertificate.Host != nil { + _ = d.Set("host", hostCertificate.Host) + } + + if hostCertificate.CertInfo != nil { + certInfoList := []interface{}{} + for _, certInfo := range hostCertificate.CertInfo { + certInfoMap := map[string]interface{}{} + if certInfo.CertId != nil { + certInfoMap["cert_id"] = certInfo.CertId + } + if certInfo.Alias != nil { + certInfoMap["alias"] = certInfo.Alias + } + if certInfo.Type != nil { + certInfoMap["type"] = certInfo.Type + } + if certInfo.ExpireTime != nil { + certInfoMap["expire_time"] = certInfo.ExpireTime + } + if certInfo.Status != nil { + certInfoMap["status"] = certInfo.Status + } + + certInfoList = append(certInfoList, certInfoMap) + } + _ = d.Set("cert_info", certInfoList) + } + + return nil +} + +func resourceTencentCloudTeoHostCertificateUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_host_certificate.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyHostsCertificateRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + host := idSplit[1] + + request.ZoneId = helper.String(zoneId) + request.Hosts = []*string{helper.String(host)} + + if v, ok := d.GetOk("cert_info"); ok { + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + serverCertInfo := teo.ServerCertInfo{} + if v, ok := dMap["cert_id"]; ok { + serverCertInfo.CertId = helper.String(v.(string)) + } + if v, ok := dMap["status"]; ok { + serverCertInfo.Status = helper.String(v.(string)) + } + + request.CertInfo = append(request.CertInfo, &serverCertInfo) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyHostsCertificate(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo hostCertificate failed, reason:%+v", logId, err) + return err + } + + return resourceTencentCloudTeoHostCertificateRead(d, meta) +} + +func resourceTencentCloudTeoHostCertificateDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_host_certificate.delete")() + defer inconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/resource_tc_teo_host_certificate_test.go b/tencentcloud/resource_tc_teo_host_certificate_test.go new file mode 100644 index 0000000000..5a08d83f29 --- /dev/null +++ b/tencentcloud/resource_tc_teo_host_certificate_test.go @@ -0,0 +1,43 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoHostCertificate_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoHostCertificate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_host_certificate.host_certificate", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_host_certificate.host_certificate", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoHostCertificate = ` + +resource "tencentcloud_teo_host_certificate" "host_certificate" { + zone_id = tencentcloud_teo_zone.zone.id + host = tencentcloud_teo_dns_record.dns_record.name + + cert_info { + cert_id = "yqWPPbs7" + status = "deployed" + } +} + +` diff --git a/tencentcloud/resource_tc_teo_load_balancing.go b/tencentcloud/resource_tc_teo_load_balancing.go new file mode 100644 index 0000000000..f1d71701bb --- /dev/null +++ b/tencentcloud/resource_tc_teo_load_balancing.go @@ -0,0 +1,302 @@ +/* +Provides a resource to create a teo loadBalancing + +Example Usage + +```hcl +resource "tencentcloud_teo_load_balancing" "load_balancing" { + zone_id = tencentcloud_teo_zone.zone.id + + host = "sfurnace.work" + origin_id = [ + split("#", tencentcloud_teo_origin_group.group0.id)[1] + ] + ttl = 600 + type = "proxied" +} + +``` +Import + +teo loadBalancing can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_load_balancing.loadBalancing loadBalancing_id +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoLoadBalancing() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoLoadBalancingRead, + Create: resourceTencentCloudTeoLoadBalancingCreate, + Update: resourceTencentCloudTeoLoadBalancingUpdate, + Delete: resourceTencentCloudTeoLoadBalancingDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "load_balancing_id": { + Type: schema.TypeString, + Computed: true, + Description: "CLB instance ID.", + }, + + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Site ID.", + }, + + "host": { + Type: schema.TypeString, + Required: true, + Description: "Subdomain name. You can use @ to represent the root domain.", + }, + + "type": { + Type: schema.TypeString, + Required: true, + Description: "Proxy mode. Valid values: dns_only: Only DNS, proxied: Enable proxy.", + }, + + "ttl": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Indicates DNS TTL time when Type=dns_only.", + }, + + "origin_id": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "ID of the origin group used.", + }, + + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Update time.", + }, + + "cname": { + Type: schema.TypeString, + Computed: true, + Description: "Schedules domain names, Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + } +} + +func resourceTencentCloudTeoLoadBalancingCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_load_balancing.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateLoadBalancingRequest() + response *teo.CreateLoadBalancingResponse + zoneId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(zoneId) + } + + if v, ok := d.GetOk("host"); ok { + request.Host = helper.String(v.(string)) + } + + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("ttl"); ok { + request.TTL = helper.IntUint64(v.(int)) + } + + if v, ok := d.GetOk("origin_id"); ok { + originIdSet := v.(*schema.Set).List() + for i := range originIdSet { + originId := originIdSet[i].(string) + request.OriginId = append(request.OriginId, &originId) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateLoadBalancing(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo loadBalancing failed, reason:%+v", logId, err) + return err + } + + loadBalancingId := *response.Response.LoadBalancingId + + d.SetId(zoneId + "#" + loadBalancingId) + return resourceTencentCloudTeoLoadBalancingRead(d, meta) +} + +func resourceTencentCloudTeoLoadBalancingRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_loadBalancing.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + loadBalancingId := idSplit[1] + + loadBalancing, err := service.DescribeTeoLoadBalancing(ctx, zoneId, loadBalancingId) + + if err != nil { + return err + } + + if loadBalancing == nil { + d.SetId("") + return fmt.Errorf("resource `loadBalancing` %s does not exist", loadBalancingId) + } + + if loadBalancing.LoadBalancingId != nil { + _ = d.Set("load_balancing_id", loadBalancing.LoadBalancingId) + } + + if loadBalancing.ZoneId != nil { + _ = d.Set("zone_id", loadBalancing.ZoneId) + } + + if loadBalancing.Host != nil { + _ = d.Set("host", loadBalancing.Host) + } + + if loadBalancing.Type != nil { + _ = d.Set("type", loadBalancing.Type) + } + + if loadBalancing.TTL != nil { + _ = d.Set("ttl", loadBalancing.TTL) + } + + if loadBalancing.OriginId != nil { + _ = d.Set("origin_id", loadBalancing.OriginId) + } + + if loadBalancing.UpdateTime != nil { + _ = d.Set("update_time", loadBalancing.UpdateTime) + } + + if loadBalancing.Cname != nil { + _ = d.Set("cname", loadBalancing.Cname) + } + + return nil +} + +func resourceTencentCloudTeoLoadBalancingUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_load_balancing.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyLoadBalancingRequest() + + request.ZoneId = helper.String(d.Id()) + + if d.HasChange("host") { + return fmt.Errorf("`host` do not support change now.") + } + + if d.HasChange("type") { + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + } + + if d.HasChange("ttl") { + if v, ok := d.GetOk("ttl"); ok { + request.TTL = helper.IntUint64(v.(int)) + } + } + + if d.HasChange("origin_id") { + if v, ok := d.GetOk("origin_id"); ok { + originIdSet := v.(*schema.Set).List() + for i := range originIdSet { + originId := originIdSet[i].(string) + request.OriginId = append(request.OriginId, &originId) + } + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyLoadBalancing(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + return resourceTencentCloudTeoLoadBalancingRead(d, meta) +} + +func resourceTencentCloudTeoLoadBalancingDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_load_balancing.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + loadBalancingId := idSplit[1] + + if err := service.DeleteTeoLoadBalancingById(ctx, zoneId, loadBalancingId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_origin_group.go b/tencentcloud/resource_tc_teo_origin_group.go new file mode 100644 index 0000000000..0c4726e00c --- /dev/null +++ b/tencentcloud/resource_tc_teo_origin_group.go @@ -0,0 +1,480 @@ +/* +Provides a resource to create a teo originGroup + +Example Usage + +```hcl +locals { + group0 = [ + { + "record" = "1.1.1.1" + "port" = 80 + "weight" = 30 + }, { + "record" = "2.2.2.2" + "port" = 443 + "weight" = 70 + } + ] +} + +resource "tencentcloud_teo_origin_group" "origin_group" { + zone_id = tencentcloud_teo_zone.zone.id + origin_name = "group0" + origin_type = "self" + type = "weight" + + dynamic "record" { + for_each = local.group0 + content { + record = record.value["record"] + port = record.value["port"] + weight = record.value["weight"] + area = [] + } + } +} + +``` +Import + +teo origin_group can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_origin_group.origin_group zoneId#originId +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoOriginGroup() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoOriginGroupRead, + Create: resourceTencentCloudTeoOriginGroupCreate, + Update: resourceTencentCloudTeoOriginGroupUpdate, + Delete: resourceTencentCloudTeoOriginGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "origin_name": { + Type: schema.TypeString, + Required: true, + Description: "OriginGroup Name.", + }, + + "type": { + Type: schema.TypeString, + Required: true, + Description: "Type of the origin group, this field is required only when `OriginType` is `self`. Valid values:- area: select an origin by using Geo info of the client IP and `Area` field in Records.- weight: weighted select an origin by using `Weight` field in Records.", + }, + + "record": { + Type: schema.TypeList, + Required: true, + Description: "Origin website records.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "record": { + Type: schema.TypeString, + Required: true, + Description: "Record Value.", + }, + "area": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Indicating origin website's area when `Type` field is `area`. An empty List indicate the default area.", + }, + "weight": { + Type: schema.TypeInt, + Required: true, + Description: "Indicating origin website's weight when `Type` field is `weight`. Valid value range: 1-100. Sum of all weights should be 100.", + }, + "port": { + Type: schema.TypeInt, + Required: true, + Description: "Port of the origin website.", + }, + "private": { + Type: schema.TypeBool, + Optional: true, + Description: "Whether origin website is using private authentication. Only valid when `OriginType` is `third_party`.", + }, + "private_parameter": { + Type: schema.TypeList, + Optional: true, + Description: "Parameters for private authentication. Only valid when `Private` is `true`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Parameter Name. Valid values:- AccessKeyId: Access Key ID.- SecretAccessKey: Secret Access Key.", + }, + "value": { + Type: schema.TypeString, + Required: true, + Description: "Parameter value.", + }, + }, + }, + }, + "record_id": { + Type: schema.TypeString, + Computed: true, + Description: "Record Id.", + }, + }, + }, + }, + + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "origin_type": { + Type: schema.TypeString, + Optional: true, + Description: "Type of the origin website. Valid values:- self: self-build website.- cos: tencent cos.- third_party: third party cos.", + }, + + "zone_name": { + Type: schema.TypeString, + Computed: true, + Description: "Site Name.", + }, + + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Last modification date.", + }, + }, + } +} + +func resourceTencentCloudTeoOriginGroupCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_origin_group.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateOriginGroupRequest() + response *teo.CreateOriginGroupResponse + zoneId string + originId string + ) + + if v, ok := d.GetOk("origin_name"); ok { + request.OriginName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("record"); ok { + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + originRecord := teo.OriginRecord{} + if v, ok := dMap["record"]; ok { + originRecord.Record = helper.String(v.(string)) + } + if v, ok := dMap["area"]; ok { + areaSet := v.(*schema.Set).List() + for i := range areaSet { + area := areaSet[i].(string) + originRecord.Area = append(originRecord.Area, &area) + } + } + if v, ok := dMap["weight"]; ok { + originRecord.Weight = helper.IntUint64(v.(int)) + } + if v, ok := dMap["port"]; ok { + originRecord.Port = helper.IntUint64(v.(int)) + } + if v, ok := dMap["private"]; ok { + originRecord.Private = helper.Bool(v.(bool)) + } + if v, ok := dMap["private_parameter"]; ok { + for _, item := range v.([]interface{}) { + PrivateParameterMap := item.(map[string]interface{}) + originRecordPrivateParameter := teo.OriginRecordPrivateParameter{} + if v, ok := PrivateParameterMap["name"]; ok { + originRecordPrivateParameter.Name = helper.String(v.(string)) + } + if v, ok := PrivateParameterMap["value"]; ok { + originRecordPrivateParameter.Value = helper.String(v.(string)) + } + originRecord.PrivateParameter = append(originRecord.PrivateParameter, &originRecordPrivateParameter) + } + } + + request.Record = append(request.Record, &originRecord) + } + } + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("origin_type"); ok { + request.OriginType = helper.String(v.(string)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateOriginGroup(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo originGroup failed, reason:%+v", logId, err) + return err + } + + originId = *response.Response.OriginId + + d.SetId(zoneId + FILED_SP + originId) + return resourceTencentCloudTeoOriginGroupRead(d, meta) +} + +func resourceTencentCloudTeoOriginGroupRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_origin_group.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + originId := idSplit[1] + + originGroup, err := service.DescribeTeoOriginGroup(ctx, zoneId, originId) + + if err != nil { + return err + } + + if originGroup == nil { + d.SetId("") + return fmt.Errorf("resource `originGroup` %s does not exist", originId) + } + + if originGroup.OriginName != nil { + _ = d.Set("origin_name", originGroup.OriginName) + } + + if originGroup.Type != nil { + _ = d.Set("type", originGroup.Type) + } + + if originGroup.Record != nil { + recordList := []interface{}{} + for _, record := range originGroup.Record { + recordMap := map[string]interface{}{} + if record.Record != nil { + recordMap["record"] = record.Record + } + if record.Area != nil { + recordMap["area"] = record.Area + } + if record.Weight != nil { + recordMap["weight"] = record.Weight + } + if record.Port != nil { + recordMap["port"] = record.Port + } + if record.Private != nil { + recordMap["private"] = record.Private + } + if record.PrivateParameter != nil { + privateParameterList := []interface{}{} + for _, privateParameter := range record.PrivateParameter { + privateParameterMap := map[string]interface{}{} + if privateParameter.Name != nil { + privateParameterMap["name"] = privateParameter.Name + } + if privateParameter.Value != nil { + privateParameterMap["value"] = privateParameter.Value + } + + privateParameterList = append(privateParameterList, privateParameterMap) + } + recordMap["private_parameter"] = privateParameterList + } + if record.RecordId != nil { + recordMap["record_id"] = record.RecordId + } + + recordList = append(recordList, recordMap) + } + _ = d.Set("record", recordList) + } + + if originGroup.ZoneId != nil { + _ = d.Set("zone_id", originGroup.ZoneId) + } + + if originGroup.OriginType != nil { + _ = d.Set("origin_type", originGroup.OriginType) + } + + if originGroup.ZoneName != nil { + _ = d.Set("zone_name", originGroup.ZoneName) + } + + if originGroup.UpdateTime != nil { + _ = d.Set("update_time", originGroup.UpdateTime) + } + + return nil +} + +func resourceTencentCloudTeoOriginGroupUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_origin_group.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyOriginGroupRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + originId := idSplit[1] + + request.ZoneId = &zoneId + request.OriginId = &originId + + if v, ok := d.GetOk("origin_name"); ok { + request.OriginName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("origin_type"); ok { + request.OriginType = helper.String(v.(string)) + } + + if d.HasChange("record") { + if v, ok := d.GetOk("record"); ok { + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + originRecord := teo.OriginRecord{} + if v, ok := dMap["record"]; ok { + originRecord.Record = helper.String(v.(string)) + } + if v, ok := dMap["area"]; ok { + areaSet := v.(*schema.Set).List() + for i := range areaSet { + area := areaSet[i].(string) + originRecord.Area = append(originRecord.Area, &area) + } + } + if v, ok := dMap["weight"]; ok { + originRecord.Weight = helper.IntUint64(v.(int)) + } + if v, ok := dMap["port"]; ok { + originRecord.Port = helper.IntUint64(v.(int)) + } + if v, ok := dMap["private"]; ok { + originRecord.Private = helper.Bool(v.(bool)) + } + if v, ok := dMap["private_parameter"]; ok { + for _, item := range v.([]interface{}) { + PrivateParameterMap := item.(map[string]interface{}) + originRecordPrivateParameter := teo.OriginRecordPrivateParameter{} + if v, ok := PrivateParameterMap["name"]; ok { + originRecordPrivateParameter.Name = helper.String(v.(string)) + } + if v, ok := PrivateParameterMap["value"]; ok { + originRecordPrivateParameter.Value = helper.String(v.(string)) + } + originRecord.PrivateParameter = append(originRecord.PrivateParameter, &originRecordPrivateParameter) + } + } + + request.Record = append(request.Record, &originRecord) + } + } + } + + if d.HasChange("zone_id") { + if v, ok := d.GetOk("zone_id"); ok { + request.ZoneId = helper.String(v.(string)) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyOriginGroup(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + return resourceTencentCloudTeoOriginGroupRead(d, meta) +} + +func resourceTencentCloudTeoOriginGroupDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_origin_group.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + originId := idSplit[1] + + if err := service.DeleteTeoOriginGroupById(ctx, zoneId, originId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_origin_group_test.go b/tencentcloud/resource_tc_teo_origin_group_test.go new file mode 100644 index 0000000000..6ac8914bf3 --- /dev/null +++ b/tencentcloud/resource_tc_teo_origin_group_test.go @@ -0,0 +1,64 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoOriginGroup_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoOriginGroup, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_origin_group.originGroup", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_origin_group.originGroup", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoOriginGroup = ` + +locals { + group0 = [ + { + "record" = "1.1.1.1" + "port" = 80 + "weight" = 30 + }, { + "record" = "2.2.2.2" + "port" = 443 + "weight" = 70 + } + ] +} + +resource "tencentcloud_teo_origin_group" "origin_group" { + zone_id = tencentcloud_teo_zone.zone.id + origin_name = "group0" + origin_type = "self" + type = "weight" + + dynamic "record" { + for_each = local.group0 + content { + record = record.value["record"] + port = record.value["port"] + weight = record.value["weight"] + area = [] + } + } +} + +` diff --git a/tencentcloud/resource_tc_teo_rule_engine.go b/tencentcloud/resource_tc_teo_rule_engine.go new file mode 100644 index 0000000000..6de283d8d4 --- /dev/null +++ b/tencentcloud/resource_tc_teo_rule_engine.go @@ -0,0 +1,795 @@ +/* +Provides a resource to create a teo ruleEngine + +Example Usage + +```hcl +resource "tencentcloud_teo_rule_engine" "rule_engine" { + zone_id = tencentcloud_teo_zone.zone.id + rule_name = "rule0" + status = "enable" + + rules { + conditions { + conditions { + operator = "equal" + target = "host" + values = [ + "www.sfurnace.work", + ] + } + } + + actions { + normal_action { + action = "MaxAge" + + parameters { + name = "FollowOrigin" + values = [ + "on", + ] + } + parameters { + name = "MaxAgeTime" + values = [ + "0", + ] + } + } + } + } +} + +``` +Import + +teo ruleEngine can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_rule_engine.rule_engine zoneId#ruleId +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoRuleEngine() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoRuleEngineRead, + Create: resourceTencentCloudTeoRuleEngineCreate, + Update: resourceTencentCloudTeoRuleEngineUpdate, + Delete: resourceTencentCloudTeoRuleEngineDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "rule_name": { + Type: schema.TypeString, + Optional: true, + Description: "Rule name.", + }, + + "status": { + Type: schema.TypeString, + Required: true, + Description: "Status of the rule, valid value can be `enable` or `disable`.", + }, + + "rules": { + Type: schema.TypeList, + Required: true, + Description: "Rule items list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "conditions": { + Type: schema.TypeList, + Required: true, + Description: "OR Conditions list of the rule. Rule would be triggered if any of the condition is true.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "conditions": { + Type: schema.TypeList, + Required: true, + Description: "AND Conditions list of the rule. Rule would be triggered if all conditions are true.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Condition operator. Valid values are `equal`, `notequal`.", + }, + "target": { + Type: schema.TypeString, + Required: true, + Description: "Condition target. Valid values:- host: Host of the URL.- filename: filename of the URL.- extension: file extension of the URL.- full_url: full url.- url: path of the URL.", + }, + "values": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Condition Value.", + }, + }, + }, + }, + }, + }, + }, + "actions": { + Type: schema.TypeList, + Required: true, + Description: "Actions list of the rule. See details in data source `rule_engine_setting`.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "normal_action": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Define a normal action.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "action": { + Type: schema.TypeString, + Required: true, + Description: "Action name.", + }, + "parameters": { + Type: schema.TypeList, + Required: true, + Description: "Action parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Parameter Name.", + }, + "values": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Parameter Values.", + }, + }, + }, + }, + }, + }, + }, + "rewrite_action": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Define a rewrite action.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "action": { + Type: schema.TypeString, + Required: true, + Description: "Action name.", + }, + "parameters": { + Type: schema.TypeList, + Required: true, + Description: "Action parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "action": { + Type: schema.TypeString, + Required: true, + Description: "Action to take on the HEADER.", + }, + "name": { + Type: schema.TypeString, + Required: true, + Description: "Target HEADER name.", + }, + "values": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Parameter Value.", + }, + }, + }, + }, + }, + }, + }, + "code_action": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Define a code action.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "action": { + Type: schema.TypeString, + Required: true, + Description: "Action name.", + }, + "parameters": { + Type: schema.TypeList, + Required: true, + Description: "Action parameters.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Parameter Name.", + }, + "values": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Required: true, + Description: "Parameter Values.", + }, + "status_code": { + Type: schema.TypeInt, + Required: true, + Description: "HTTP status code to use.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "rule_id": { + Type: schema.TypeString, + Computed: true, + Description: "Rule ID.", + }, + }, + } +} + +func resourceTencentCloudTeoRuleEngineCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_rule_engine.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateRuleRequest() + response *teo.CreateRuleResponse + zoneId string + ruleId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("rule_name"); ok { + request.RuleName = helper.String(v.(string)) + } + + if v, ok := d.GetOk("status"); ok { + request.Status = helper.String(v.(string)) + } + + if v, ok := d.GetOk("rules"); ok { + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + ruleItem := teo.RuleItem{} + if v, ok := dMap["conditions"]; ok { + for _, item := range v.([]interface{}) { + ConditionsMap := item.(map[string]interface{}) + ruleAndConditions := teo.RuleAndConditions{} + if v, ok := ConditionsMap["conditions"]; ok { + for _, item := range v.([]interface{}) { + ConditionsMap := item.(map[string]interface{}) + ruleCondition := teo.RuleCondition{} + if v, ok := ConditionsMap["operator"]; ok { + ruleCondition.Operator = helper.String(v.(string)) + } + if v, ok := ConditionsMap["target"]; ok { + ruleCondition.Target = helper.String(v.(string)) + } + if v, ok := ConditionsMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleCondition.Values = append(ruleCondition.Values, &values) + } + } + ruleAndConditions.Conditions = append(ruleAndConditions.Conditions, &ruleCondition) + } + } + ruleItem.Conditions = append(ruleItem.Conditions, &ruleAndConditions) + } + } + if v, ok := dMap["actions"]; ok { + for _, item := range v.([]interface{}) { + ActionsMap := item.(map[string]interface{}) + ruleAction := teo.RuleAction{} + if NormalActionMap, ok := helper.InterfaceToMap(ActionsMap, "normal_action"); ok { + ruleNormalAction := teo.RuleNormalAction{} + if v, ok := NormalActionMap["action"]; ok { + ruleNormalAction.Action = helper.String(v.(string)) + } + if v, ok := NormalActionMap["parameters"]; ok { + for _, item := range v.([]interface{}) { + ParametersMap := item.(map[string]interface{}) + ruleNormalActionParams := teo.RuleNormalActionParams{} + if v, ok := ParametersMap["name"]; ok { + ruleNormalActionParams.Name = helper.String(v.(string)) + } + if v, ok := ParametersMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleNormalActionParams.Values = append(ruleNormalActionParams.Values, &values) + } + } + ruleNormalAction.Parameters = append(ruleNormalAction.Parameters, &ruleNormalActionParams) + } + } + ruleAction.NormalAction = &ruleNormalAction + } + if RewriteActionMap, ok := helper.InterfaceToMap(ActionsMap, "rewrite_action"); ok { + ruleRewriteAction := teo.RuleRewriteAction{} + if v, ok := RewriteActionMap["action"]; ok { + ruleRewriteAction.Action = helper.String(v.(string)) + } + if v, ok := RewriteActionMap["parameters"]; ok { + for _, item := range v.([]interface{}) { + ParametersMap := item.(map[string]interface{}) + ruleRewriteActionParams := teo.RuleRewriteActionParams{} + if v, ok := ParametersMap["action"]; ok { + ruleRewriteActionParams.Action = helper.String(v.(string)) + } + if v, ok := ParametersMap["name"]; ok { + ruleRewriteActionParams.Name = helper.String(v.(string)) + } + if v, ok := ParametersMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleRewriteActionParams.Values = append(ruleRewriteActionParams.Values, &values) + } + } + ruleRewriteAction.Parameters = append(ruleRewriteAction.Parameters, &ruleRewriteActionParams) + } + } + ruleAction.RewriteAction = &ruleRewriteAction + } + if CodeActionMap, ok := helper.InterfaceToMap(ActionsMap, "code_action"); ok { + ruleCodeAction := teo.RuleCodeAction{} + if v, ok := CodeActionMap["action"]; ok { + ruleCodeAction.Action = helper.String(v.(string)) + } + if v, ok := CodeActionMap["parameters"]; ok { + for _, item := range v.([]interface{}) { + ParametersMap := item.(map[string]interface{}) + ruleCodeActionParams := teo.RuleCodeActionParams{} + if v, ok := ParametersMap["name"]; ok { + ruleCodeActionParams.Name = helper.String(v.(string)) + } + if v, ok := ParametersMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleCodeActionParams.Values = append(ruleCodeActionParams.Values, &values) + } + } + if v, ok := ParametersMap["status_code"]; ok { + ruleCodeActionParams.StatusCode = helper.IntInt64(v.(int)) + } + ruleCodeAction.Parameters = append(ruleCodeAction.Parameters, &ruleCodeActionParams) + } + } + ruleAction.CodeAction = &ruleCodeAction + } + ruleItem.Actions = append(ruleItem.Actions, &ruleAction) + } + } + + request.Rules = append(request.Rules, &ruleItem) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateRule(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo ruleEngine failed, reason:%+v", logId, err) + return err + } + + ruleId = *response.Response.RuleId + + d.SetId(zoneId + FILED_SP + ruleId) + return resourceTencentCloudTeoRuleEngineRead(d, meta) +} + +func resourceTencentCloudTeoRuleEngineRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_rule_engine.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + ruleId := idSplit[1] + + ruleEngine, err := service.DescribeTeoRuleEngine(ctx, zoneId, ruleId) + + if err != nil { + return err + } + + if ruleEngine == nil { + d.SetId("") + return fmt.Errorf("resource `ruleEngine` %s does not exist", ruleId) + } + + if ruleEngine.RuleName != nil { + _ = d.Set("rule_name", ruleEngine.RuleName) + } + + if ruleEngine.Status != nil { + _ = d.Set("status", ruleEngine.Status) + } + + if ruleEngine.Rules != nil { + rulesList := []interface{}{} + for _, rules := range ruleEngine.Rules { + rulesMap := map[string]interface{}{} + if rules.Conditions != nil { + conditionsList := []interface{}{} + for _, conditions := range rules.Conditions { + conditionsMap := map[string]interface{}{} + if conditions.Conditions != nil { + conditionsList := []interface{}{} + for _, conditions := range conditions.Conditions { + conditionsMap := map[string]interface{}{} + if conditions.Operator != nil { + conditionsMap["operator"] = conditions.Operator + } + if conditions.Target != nil { + conditionsMap["target"] = conditions.Target + } + if conditions.Values != nil { + conditionsMap["values"] = conditions.Values + } + + conditionsList = append(conditionsList, conditionsMap) + } + conditionsMap["conditions"] = conditionsList + } + + conditionsList = append(conditionsList, conditionsMap) + } + rulesMap["conditions"] = conditionsList + } + if rules.Actions != nil { + actionsList := []interface{}{} + for _, actions := range rules.Actions { + actionsMap := map[string]interface{}{} + if actions.NormalAction != nil { + normalActionMap := map[string]interface{}{} + if actions.NormalAction.Action != nil { + normalActionMap["action"] = actions.NormalAction.Action + } + if actions.NormalAction.Parameters != nil { + parametersList := []interface{}{} + for _, parameters := range actions.NormalAction.Parameters { + parametersMap := map[string]interface{}{} + if parameters.Name != nil { + parametersMap["name"] = parameters.Name + } + if parameters.Values != nil { + parametersMap["values"] = parameters.Values + } + + parametersList = append(parametersList, parametersMap) + } + normalActionMap["parameters"] = parametersList + } + + actionsMap["normal_action"] = []interface{}{normalActionMap} + } + if actions.RewriteAction != nil { + rewriteActionMap := map[string]interface{}{} + if actions.RewriteAction.Action != nil { + rewriteActionMap["action"] = actions.RewriteAction.Action + } + if actions.RewriteAction.Parameters != nil { + parametersList := []interface{}{} + for _, parameters := range actions.RewriteAction.Parameters { + parametersMap := map[string]interface{}{} + if parameters.Action != nil { + parametersMap["action"] = parameters.Action + } + if parameters.Name != nil { + parametersMap["name"] = parameters.Name + } + if parameters.Values != nil { + parametersMap["values"] = parameters.Values + } + + parametersList = append(parametersList, parametersMap) + } + rewriteActionMap["parameters"] = parametersList + } + + actionsMap["rewrite_action"] = []interface{}{rewriteActionMap} + } + if actions.CodeAction != nil { + codeActionMap := map[string]interface{}{} + if actions.CodeAction.Action != nil { + codeActionMap["action"] = actions.CodeAction.Action + } + if actions.CodeAction.Parameters != nil { + parametersList := []interface{}{} + for _, parameters := range actions.CodeAction.Parameters { + parametersMap := map[string]interface{}{} + if parameters.Name != nil { + parametersMap["name"] = parameters.Name + } + if parameters.Values != nil { + parametersMap["values"] = parameters.Values + } + if parameters.StatusCode != nil { + parametersMap["status_code"] = parameters.StatusCode + } + + parametersList = append(parametersList, parametersMap) + } + codeActionMap["parameters"] = parametersList + } + + actionsMap["code_action"] = []interface{}{codeActionMap} + } + + actionsList = append(actionsList, actionsMap) + } + rulesMap["actions"] = actionsList + } + + rulesList = append(rulesList, rulesMap) + } + _ = d.Set("rules", rulesList) + } + + if ruleEngine.RuleId != nil { + _ = d.Set("rule_id", ruleEngine.RuleId) + } + + return nil +} + +func resourceTencentCloudTeoRuleEngineUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_rule_engine.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifyRuleRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + ruleId := idSplit[1] + + request.ZoneId = &zoneId + request.RuleId = &ruleId + if v, ok := d.GetOk("rule_name"); ok { + request.RuleName = helper.String(v.(string)) + } + if v, ok := d.GetOk("status"); ok { + request.Status = helper.String(v.(string)) + } + if v, ok := d.GetOk("rules"); ok { + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + ruleItem := teo.RuleItem{} + if v, ok := dMap["conditions"]; ok { + for _, item := range v.([]interface{}) { + ConditionsMap := item.(map[string]interface{}) + ruleAndConditions := teo.RuleAndConditions{} + if v, ok := ConditionsMap["conditions"]; ok { + for _, item := range v.([]interface{}) { + ConditionsMap := item.(map[string]interface{}) + ruleCondition := teo.RuleCondition{} + if v, ok := ConditionsMap["operator"]; ok { + ruleCondition.Operator = helper.String(v.(string)) + } + if v, ok := ConditionsMap["target"]; ok { + ruleCondition.Target = helper.String(v.(string)) + } + if v, ok := ConditionsMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleCondition.Values = append(ruleCondition.Values, &values) + } + } + ruleAndConditions.Conditions = append(ruleAndConditions.Conditions, &ruleCondition) + } + } + ruleItem.Conditions = append(ruleItem.Conditions, &ruleAndConditions) + } + } + if v, ok := dMap["actions"]; ok { + for _, item := range v.([]interface{}) { + ActionsMap := item.(map[string]interface{}) + ruleAction := teo.RuleAction{} + if NormalActionMap, ok := helper.InterfaceToMap(ActionsMap, "normal_action"); ok { + ruleNormalAction := teo.RuleNormalAction{} + if v, ok := NormalActionMap["action"]; ok { + ruleNormalAction.Action = helper.String(v.(string)) + } + if v, ok := NormalActionMap["parameters"]; ok { + for _, item := range v.([]interface{}) { + ParametersMap := item.(map[string]interface{}) + ruleNormalActionParams := teo.RuleNormalActionParams{} + if v, ok := ParametersMap["name"]; ok { + ruleNormalActionParams.Name = helper.String(v.(string)) + } + if v, ok := ParametersMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleNormalActionParams.Values = append(ruleNormalActionParams.Values, &values) + } + } + ruleNormalAction.Parameters = append(ruleNormalAction.Parameters, &ruleNormalActionParams) + } + } + ruleAction.NormalAction = &ruleNormalAction + } + if RewriteActionMap, ok := helper.InterfaceToMap(ActionsMap, "rewrite_action"); ok { + ruleRewriteAction := teo.RuleRewriteAction{} + if v, ok := RewriteActionMap["action"]; ok { + ruleRewriteAction.Action = helper.String(v.(string)) + } + if v, ok := RewriteActionMap["parameters"]; ok { + for _, item := range v.([]interface{}) { + ParametersMap := item.(map[string]interface{}) + ruleRewriteActionParams := teo.RuleRewriteActionParams{} + if v, ok := ParametersMap["action"]; ok { + ruleRewriteActionParams.Action = helper.String(v.(string)) + } + if v, ok := ParametersMap["name"]; ok { + ruleRewriteActionParams.Name = helper.String(v.(string)) + } + if v, ok := ParametersMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleRewriteActionParams.Values = append(ruleRewriteActionParams.Values, &values) + } + } + ruleRewriteAction.Parameters = append(ruleRewriteAction.Parameters, &ruleRewriteActionParams) + } + } + ruleAction.RewriteAction = &ruleRewriteAction + } + if CodeActionMap, ok := helper.InterfaceToMap(ActionsMap, "code_action"); ok { + ruleCodeAction := teo.RuleCodeAction{} + if v, ok := CodeActionMap["action"]; ok { + ruleCodeAction.Action = helper.String(v.(string)) + } + if v, ok := CodeActionMap["parameters"]; ok { + for _, item := range v.([]interface{}) { + ParametersMap := item.(map[string]interface{}) + ruleCodeActionParams := teo.RuleCodeActionParams{} + if v, ok := ParametersMap["name"]; ok { + ruleCodeActionParams.Name = helper.String(v.(string)) + } + if v, ok := ParametersMap["values"]; ok { + valuesSet := v.(*schema.Set).List() + for i := range valuesSet { + values := valuesSet[i].(string) + ruleCodeActionParams.Values = append(ruleCodeActionParams.Values, &values) + } + } + if v, ok := ParametersMap["status_code"]; ok { + ruleCodeActionParams.StatusCode = helper.IntInt64(v.(int)) + } + ruleCodeAction.Parameters = append(ruleCodeAction.Parameters, &ruleCodeActionParams) + } + } + ruleAction.CodeAction = &ruleCodeAction + } + ruleItem.Actions = append(ruleItem.Actions, &ruleAction) + } + } + + request.Rules = append(request.Rules, &ruleItem) + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyRule(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + return resourceTencentCloudTeoRuleEngineRead(d, meta) +} + +func resourceTencentCloudTeoRuleEngineDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_rule_engine.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + ruleId := idSplit[1] + + if err := service.DeleteTeoRuleEngineById(ctx, zoneId, ruleId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_rule_engine_test.go b/tencentcloud/resource_tc_teo_rule_engine_test.go new file mode 100644 index 0000000000..08a2648472 --- /dev/null +++ b/tencentcloud/resource_tc_teo_rule_engine_test.go @@ -0,0 +1,71 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoRuleEngine_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoRuleEngine, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_rule_engine.rule_engine", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_rule_engine.rule_engine", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoRuleEngine = ` + +resource "tencentcloud_teo_rule_engine" "rule_engine" { + zone_id = tencentcloud_teo_zone.zone.id + rule_name = "rule0" + status = "enable" + + rules { + conditions { + conditions { + operator = "equal" + target = "host" + values = [ + "www.sfurnace.work", + ] + } + } + + actions { + normal_action { + action = "MaxAge" + + parameters { + name = "FollowOrigin" + values = [ + "on", + ] + } + parameters { + name = "MaxAgeTime" + values = [ + "0", + ] + } + } + } + } +} + + +` diff --git a/tencentcloud/resource_tc_teo_security_policy.go b/tencentcloud/resource_tc_teo_security_policy.go new file mode 100644 index 0000000000..c4ac609be2 --- /dev/null +++ b/tencentcloud/resource_tc_teo_security_policy.go @@ -0,0 +1,1663 @@ +/* +Provides a resource to create a teo securityPolicy + +Example Usage + +```hcl +resource "tencentcloud_teo_security_policy" "securityPolicy" { + zone_id = "" + entity = "" + config { + waf_config { + switch = "" + level = "" + mode = "" + waf_rules { + switch = "" + block_rule_ids = "" + observe_rule_ids = "" + } + ai_rule { + mode = "" + } + } + rate_limit_config { + switch = "" + user_rules { + rule_name = "" + threshold = "" + period = "" + action = "" + punish_time = "" + punish_time_unit = "" + rule_status = "" + freq_fields = "" + conditions { + match_from = "" + match_param = "" + operator = "" + match_content = "" + } + rule_priority = "" + } + template { + mode = "" + detail { + mode = "" + id = "" + action = "" + punish_time = "" + threshold = "" + period = "" + } + } + intelligence { + switch = "" + action = "" + } + } + acl_config { + switch = "" + user_rules { + rule_name = "" + action = "" + rule_status = "" + conditions { + match_from = "" + match_param = "" + operator = "" + match_content = "" + } + rule_priority = "" + punish_time = "" + punish_time_unit = "" + name = "" + page_id = "" + redirect_url = "" + response_code = "" + } + } + bot_config { + switch = "" + managed_rule { + rule_id = "" + action = "" + punish_time = "" + punish_time_unit = "" + name = "" + page_id = "" + redirect_url = "" + response_code = "" + trans_managed_ids = "" + alg_managed_ids = "" + cap_managed_ids = "" + mon_managed_ids = "" + drop_managed_ids = "" + } + portrait_rule { + rule_id = "" + alg_managed_ids = "" + cap_managed_ids = "" + mon_managed_ids = "" + drop_managed_ids = "" + switch = "" + } + intelligence_rule { + switch = "" + items { + label = "" + action = "" + } + } + } + switch_config { + web_switch = "" + } + ip_table_config { + switch = "" + rules { + action = "" + match_from = "" + match_content = "" + rule_id = "" + } + } + + } +} + +``` +Import + +teo securityPolicy can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_security_policy.securityPolicy securityPolicy_id#entity +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoSecurityPolicy() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoSecurityPolicyRead, + Create: resourceTencentCloudTeoSecurityPolicyCreate, + Update: resourceTencentCloudTeoSecurityPolicyUpdate, + Delete: resourceTencentCloudTeoSecurityPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "entity": { + Type: schema.TypeString, + Required: true, + Description: "Subdomain.", + }, + + "config": { + Type: schema.TypeList, + MaxItems: 1, + Required: true, + Description: "Security policy configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "waf_config": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "WAF (Web Application Firewall) Configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable WAF rules. Valid values:- on: Enable.- off: Disable.", + }, + "level": { + Type: schema.TypeString, + Required: true, + Description: "Protection level. Valid values: `loose`, `normal`, `strict`, `stricter`, `custom`.", + }, + "mode": { + Type: schema.TypeString, + Required: true, + Description: "Protection mode. Valid values:- block: use block mode globally, you still can set a group of rules to use observe mode.- observe: use observe mode globally.", + }, + "waf_rules": { + Type: schema.TypeList, + MaxItems: 1, + Required: true, + Description: "WAF Rules Configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to host the rules' configuration.- on: Enable.- off: Disable.", + }, + "block_rule_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Required: true, + Description: "Block mode rules list. See details in data source `waf_managed_rules`.", + }, + "observe_rule_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Computed: true, + Description: "Observe rules list. See details in data source `waf_managed_rules`.", + }, + }, + }, + }, + "ai_rule": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "AI based rules configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Valid values:- smart_status_close: disabled.- smart_status_open: blocked.- smart_status_observe: observed.", + }, + }, + }, + }, + }, + }, + }, + "rate_limit_config": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "RateLimit Configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "- on: Enable.- off: Disable.", + }, + "user_rules": { + Type: schema.TypeList, + Required: true, + Description: "Custom configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "rule_id": { + Type: schema.TypeInt, + Computed: true, + Description: "Rule ID.", + }, + "rule_name": { + Type: schema.TypeString, + Required: true, + Description: "Rule Name.", + }, + "threshold": { + Type: schema.TypeInt, + Required: true, + Description: "Threshold of the rate limit. Valid value range: 0-4294967294.", + }, + "period": { + Type: schema.TypeInt, + Required: true, + Description: "Period of the rate limit. Valid values: 10, 20, 30, 40, 50, 60 (in seconds).", + }, + "action": { + Type: schema.TypeString, + Required: true, + Description: "Valid values: `monitor`, `drop`.", + }, + "punish_time": { + Type: schema.TypeInt, + Required: true, + Description: "Punish time, Valid value range: 0-2 days.", + }, + "punish_time_unit": { + Type: schema.TypeString, + Required: true, + Description: "Time unit of the punish time. Valid values: `second`,`minutes`,`hour`.", + }, + "rule_status": { + Type: schema.TypeString, + Required: true, + Description: "Status of the rule.", + }, + "freq_fields": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Description: "Filter words.", + }, + "conditions": { + Type: schema.TypeList, + Required: true, + Description: "Conditions of the rule.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "match_from": { + Type: schema.TypeString, + Required: true, + Description: "Matching field.", + }, + "match_param": { + Type: schema.TypeString, + Required: true, + Description: "Matching string.", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Matching operator.", + }, + "match_content": { + Type: schema.TypeString, + Required: true, + Description: "Matching content.", + }, + }, + }, + }, + "rule_priority": { + Type: schema.TypeInt, + Required: true, + Description: "Priority of the rule.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Last modification date.", + }, + }, + }, + }, + "template": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Default Template.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mode": { + Type: schema.TypeString, + Optional: true, + Description: "Template Name.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "detail": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Detail of the template.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mode": { + Type: schema.TypeString, + Optional: true, + Description: "Template Name.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "id": { + Type: schema.TypeInt, + Optional: true, + Description: "Template ID.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Action to take.", + }, + "punish_time": { + Type: schema.TypeInt, + Optional: true, + Description: "Punish time.", + }, + "threshold": { + Type: schema.TypeInt, + Optional: true, + Description: "Threshold.", + }, + "period": { + Type: schema.TypeInt, + Optional: true, + Description: "Period.", + }, + }, + }, + }, + }, + }, + }, + "intelligence": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Intelligent client filter.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Description: "- on: Enable.- off: Disable.", + }, + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Action to take. Valid values: `monitor`, `alg`.", + }, + }, + }, + }, + }, + }, + }, + "acl_config": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "ACL configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "- on: Enable.- off: Disable.", + }, + "user_rules": { + Type: schema.TypeList, + Required: true, + Description: "Custom configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "rule_id": { + Type: schema.TypeInt, + Computed: true, + Description: "Rule ID.", + }, + "rule_name": { + Type: schema.TypeString, + Required: true, + Description: "Rule name.", + }, + "action": { + Type: schema.TypeString, + Required: true, + Description: "Action to take. Valid values: `trans`, `drop`, `monitor`, `ban`, `redirect`, `page`, `alg`.", + }, + "rule_status": { + Type: schema.TypeString, + Required: true, + Description: "Status of the rule.", + }, + "conditions": { + Type: schema.TypeList, + Required: true, + Description: "Conditions of the rule.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "match_from": { + Type: schema.TypeString, + Required: true, + Description: "Matching field.", + }, + "match_param": { + Type: schema.TypeString, + Required: true, + Description: "Matching string.", + }, + "operator": { + Type: schema.TypeString, + Required: true, + Description: "Matching operator.", + }, + "match_content": { + Type: schema.TypeString, + Required: true, + Description: "Matching content.", + }, + }, + }, + }, + "rule_priority": { + Type: schema.TypeInt, + Required: true, + Description: "Priority of the rule. Valid value range: 0-100.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Last modification date.", + }, + "punish_time": { + Type: schema.TypeInt, + Optional: true, + Description: "Punish time, Valid value range: 0-2 days.", + }, + "punish_time_unit": { + Type: schema.TypeString, + Optional: true, + Description: "Time unit of the punish time. Valid values: `second`, `minutes`, `hour`.", + }, + "name": { + Type: schema.TypeString, + Optional: true, + Description: "Name of the custom response page.", + }, + "page_id": { + Type: schema.TypeInt, + Optional: true, + Description: "ID of the custom response page.", + }, + "redirect_url": { + Type: schema.TypeString, + Optional: true, + Description: "Redirect target URL, must be an sub-domain from one of the account's site.", + }, + "response_code": { + Type: schema.TypeInt, + Optional: true, + Description: "Response code to use when redirecting.", + }, + }, + }, + }, + }, + }, + }, + "bot_config": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Bot Configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Description: "- on: Enable.- off: Disable.", + }, + "managed_rule": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Preset rules.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "rule_id": { + Type: schema.TypeInt, + Required: true, + Description: "Rule ID.", + }, + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Action to take. Valid values: `drop`, `trans`, `monitor`, `alg`.", + }, + "punish_time": { + Type: schema.TypeInt, + Optional: true, + Description: "Punish time.", + }, + "punish_time_unit": { + Type: schema.TypeString, + Optional: true, + Description: "Time unit of the punish time.", + }, + "name": { + Type: schema.TypeString, + Optional: true, + Description: "Name of the custom response page.", + }, + "page_id": { + Type: schema.TypeInt, + Optional: true, + Description: "ID of the custom response page.", + }, + "redirect_url": { + Type: schema.TypeString, + Optional: true, + Description: "Redirect target URL, must be an sub-domain from one of the account's site.", + }, + "response_code": { + Type: schema.TypeInt, + Optional: true, + Description: "Response code to use when redirecting.", + }, + "trans_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `trans`. See details in data source `bot_managed_rules`.", + }, + "alg_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `alg`. See details in data source `bot_managed_rules`.", + }, + "cap_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `captcha`. See details in data source `bot_managed_rules`.", + }, + "mon_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `monitor`. See details in data source `bot_managed_rules`.", + }, + "drop_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `drop`. See details in data source `bot_managed_rules`.", + }, + }, + }, + }, + "portrait_rule": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Portrait rule.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "rule_id": { + Type: schema.TypeInt, + Optional: true, + Description: "Rule ID.", + }, + "alg_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `alg`. See details in data source `bot_portrait_rules`.", + }, + "cap_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `captcha`. See details in data source `bot_portrait_rules`.", + }, + "mon_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `monitor`. See details in data source `bot_portrait_rules`.", + }, + "drop_managed_ids": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeInt, + }, + Optional: true, + Description: "Rules to enable when action is `drop`. See details in data source `bot_portrait_rules`.", + }, + "switch": { + Type: schema.TypeString, + Optional: true, + Description: "- on: Enable.- off: Disable.", + }, + }, + }, + }, + "intelligence_rule": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Bot intelligent rule configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Description: "- on: Enable.- off: Disable.", + }, + "items": { + Type: schema.TypeList, + Optional: true, + Description: "Configuration detail.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "label": { + Type: schema.TypeString, + Optional: true, + Description: "Bot label, valid values: `evil_bot`, `suspect_bot`, `good_bot`, `normal`.", + }, + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Action to take. Valid values: `trans`, `monitor`, `alg`, `captcha`, `drop`.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "switch_config": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Main switch of 7-layer security.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "web_switch": { + Type: schema.TypeString, + Optional: true, + Description: "- on: Enable.- off: Disable.", + }, + }, + }, + }, + "ip_table_config": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Basic access control.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Description: "- on: Enable.- off: Disable.", + }, + "rules": { + Type: schema.TypeList, + Optional: true, + Description: "Rules list.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "action": { + Type: schema.TypeString, + Optional: true, + Description: "Actions to take. Valid values: `drop`, `trans`, `monitor`.", + }, + "match_from": { + Type: schema.TypeString, + Optional: true, + Description: "Matching type. Valid values: `ip`, `area`.", + }, + "match_content": { + Type: schema.TypeString, + Optional: true, + Description: "Matching content.", + }, + "rule_id": { + Type: schema.TypeInt, + Optional: true, + Description: "Rule ID.", + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: "Last modification date.", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudTeoSecurityPolicyCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_security_policy.create")() + defer inconsistentCheck(d, meta)() + + var ( + zoneId string + entity string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + } + + if v, ok := d.GetOk("entity"); ok { + entity = v.(string) + } + + d.SetId(zoneId + FILED_SP + entity) + return resourceTencentCloudTeoSecurityPolicyUpdate(d, meta) +} + +func resourceTencentCloudTeoSecurityPolicyRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_security_policy.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + entity := idSplit[1] + + securityPolicy, err := service.DescribeTeoSecurityPolicy(ctx, zoneId, entity) + + if err != nil { + return err + } + + if securityPolicy == nil { + d.SetId("") + return fmt.Errorf("resource `securityPolicy` %s does not exist", d.Id()) + } + + if securityPolicy.ZoneId != nil { + _ = d.Set("zone_id", securityPolicy.ZoneId) + } + + if securityPolicy.Entity != nil { + _ = d.Set("entity", securityPolicy.Entity) + } + + if securityPolicy.Config != nil { + configMap := map[string]interface{}{} + if securityPolicy.Config.WafConfig != nil { + wafConfigMap := map[string]interface{}{} + if securityPolicy.Config.WafConfig.Switch != nil { + wafConfigMap["switch"] = securityPolicy.Config.WafConfig.Switch + } + if securityPolicy.Config.WafConfig.Level != nil { + wafConfigMap["level"] = securityPolicy.Config.WafConfig.Level + } + if securityPolicy.Config.WafConfig.Mode != nil { + wafConfigMap["mode"] = securityPolicy.Config.WafConfig.Mode + } + if securityPolicy.Config.WafConfig.WafRules != nil { + wafRulesMap := map[string]interface{}{} + if securityPolicy.Config.WafConfig.WafRules.Switch != nil { + wafRulesMap["switch"] = securityPolicy.Config.WafConfig.WafRules.Switch + } + if securityPolicy.Config.WafConfig.WafRules.BlockRuleIDs != nil { + wafRulesMap["block_rule_ids"] = securityPolicy.Config.WafConfig.WafRules.BlockRuleIDs + } + if securityPolicy.Config.WafConfig.WafRules.ObserveRuleIDs != nil { + wafRulesMap["observe_rule_ids"] = securityPolicy.Config.WafConfig.WafRules.ObserveRuleIDs + } + + wafConfigMap["waf_rules"] = []interface{}{wafRulesMap} + } + if securityPolicy.Config.WafConfig.AiRule != nil { + aiRuleMap := map[string]interface{}{} + if securityPolicy.Config.WafConfig.AiRule.Mode != nil { + aiRuleMap["mode"] = securityPolicy.Config.WafConfig.AiRule.Mode + } + + wafConfigMap["ai_rule"] = []interface{}{aiRuleMap} + } + + configMap["waf_config"] = []interface{}{wafConfigMap} + } + if securityPolicy.Config.RateLimitConfig != nil { + rateLimitConfigMap := map[string]interface{}{} + if securityPolicy.Config.RateLimitConfig.Switch != nil { + rateLimitConfigMap["switch"] = securityPolicy.Config.RateLimitConfig.Switch + } + if securityPolicy.Config.RateLimitConfig.UserRules != nil { + userRulesList := []interface{}{} + for _, userRules := range securityPolicy.Config.RateLimitConfig.UserRules { + userRulesMap := map[string]interface{}{} + if userRules.RuleID != nil { + userRulesMap["rule_id"] = userRules.RuleID + } + if userRules.RuleName != nil { + userRulesMap["rule_name"] = userRules.RuleName + } + if userRules.Threshold != nil { + userRulesMap["threshold"] = userRules.Threshold + } + if userRules.Period != nil { + userRulesMap["period"] = userRules.Period + } + if userRules.Action != nil { + userRulesMap["action"] = userRules.Action + } + if userRules.PunishTime != nil { + userRulesMap["punish_time"] = userRules.PunishTime + } + if userRules.PunishTimeUnit != nil { + userRulesMap["punish_time_unit"] = userRules.PunishTimeUnit + } + if userRules.RuleStatus != nil { + userRulesMap["rule_status"] = userRules.RuleStatus + } + if userRules.FreqFields != nil { + userRulesMap["freq_fields"] = userRules.FreqFields + } + if userRules.Conditions != nil { + conditionsList := []interface{}{} + for _, conditions := range userRules.Conditions { + conditionsMap := map[string]interface{}{} + if conditions.MatchFrom != nil { + conditionsMap["match_from"] = conditions.MatchFrom + } + if conditions.MatchParam != nil { + conditionsMap["match_param"] = conditions.MatchParam + } + if conditions.Operator != nil { + conditionsMap["operator"] = conditions.Operator + } + if conditions.MatchContent != nil { + conditionsMap["match_content"] = conditions.MatchContent + } + + conditionsList = append(conditionsList, conditionsMap) + } + userRulesMap["conditions"] = conditionsList + } + if userRules.RulePriority != nil { + userRulesMap["rule_priority"] = userRules.RulePriority + } + if userRules.UpdateTime != nil { + userRulesMap["update_time"] = userRules.UpdateTime + } + + userRulesList = append(userRulesList, userRulesMap) + } + rateLimitConfigMap["user_rules"] = userRulesList + } + if securityPolicy.Config.RateLimitConfig.Template != nil { + templateMap := map[string]interface{}{} + if securityPolicy.Config.RateLimitConfig.Template.Mode != nil { + templateMap["mode"] = securityPolicy.Config.RateLimitConfig.Template.Mode + } + if securityPolicy.Config.RateLimitConfig.Template.Detail != nil { + detailMap := map[string]interface{}{} + if securityPolicy.Config.RateLimitConfig.Template.Detail.Mode != nil { + detailMap["mode"] = securityPolicy.Config.RateLimitConfig.Template.Detail.Mode + } + if securityPolicy.Config.RateLimitConfig.Template.Detail.ID != nil { + detailMap["id"] = securityPolicy.Config.RateLimitConfig.Template.Detail.ID + } + if securityPolicy.Config.RateLimitConfig.Template.Detail.Action != nil { + detailMap["action"] = securityPolicy.Config.RateLimitConfig.Template.Detail.Action + } + if securityPolicy.Config.RateLimitConfig.Template.Detail.PunishTime != nil { + detailMap["punish_time"] = securityPolicy.Config.RateLimitConfig.Template.Detail.PunishTime + } + if securityPolicy.Config.RateLimitConfig.Template.Detail.Threshold != nil { + detailMap["threshold"] = securityPolicy.Config.RateLimitConfig.Template.Detail.Threshold + } + if securityPolicy.Config.RateLimitConfig.Template.Detail.Period != nil { + detailMap["period"] = securityPolicy.Config.RateLimitConfig.Template.Detail.Period + } + + templateMap["detail"] = []interface{}{detailMap} + } + + rateLimitConfigMap["template"] = []interface{}{templateMap} + } + if securityPolicy.Config.RateLimitConfig.Intelligence != nil { + intelligenceMap := map[string]interface{}{} + if securityPolicy.Config.RateLimitConfig.Intelligence.Switch != nil { + intelligenceMap["switch"] = securityPolicy.Config.RateLimitConfig.Intelligence.Switch + } + if securityPolicy.Config.RateLimitConfig.Intelligence.Action != nil { + intelligenceMap["action"] = securityPolicy.Config.RateLimitConfig.Intelligence.Action + } + + rateLimitConfigMap["intelligence"] = []interface{}{intelligenceMap} + } + + configMap["rate_limit_config"] = []interface{}{rateLimitConfigMap} + } + if securityPolicy.Config.AclConfig != nil { + aclConfigMap := map[string]interface{}{} + if securityPolicy.Config.AclConfig.Switch != nil { + aclConfigMap["switch"] = securityPolicy.Config.AclConfig.Switch + } + if securityPolicy.Config.AclConfig.UserRules != nil { + userRulesList := []interface{}{} + for _, userRules := range securityPolicy.Config.AclConfig.UserRules { + userRulesMap := map[string]interface{}{} + if userRules.RuleID != nil { + userRulesMap["rule_id"] = userRules.RuleID + } + if userRules.RuleName != nil { + userRulesMap["rule_name"] = userRules.RuleName + } + if userRules.Action != nil { + userRulesMap["action"] = userRules.Action + } + if userRules.RuleStatus != nil { + userRulesMap["rule_status"] = userRules.RuleStatus + } + if userRules.Conditions != nil { + conditionsList := []interface{}{} + for _, conditions := range userRules.Conditions { + conditionsMap := map[string]interface{}{} + if conditions.MatchFrom != nil { + conditionsMap["match_from"] = conditions.MatchFrom + } + if conditions.MatchParam != nil { + conditionsMap["match_param"] = conditions.MatchParam + } + if conditions.Operator != nil { + conditionsMap["operator"] = conditions.Operator + } + if conditions.MatchContent != nil { + conditionsMap["match_content"] = conditions.MatchContent + } + + conditionsList = append(conditionsList, conditionsMap) + } + userRulesMap["conditions"] = conditionsList + } + if userRules.RulePriority != nil { + userRulesMap["rule_priority"] = userRules.RulePriority + } + if userRules.UpdateTime != nil { + userRulesMap["update_time"] = userRules.UpdateTime + } + if userRules.PunishTime != nil { + userRulesMap["punish_time"] = userRules.PunishTime + } + if userRules.PunishTimeUnit != nil { + userRulesMap["punish_time_unit"] = userRules.PunishTimeUnit + } + if userRules.Name != nil { + userRulesMap["name"] = userRules.Name + } + if userRules.PageId != nil { + userRulesMap["page_id"] = userRules.PageId + } + if userRules.RedirectUrl != nil { + userRulesMap["redirect_url"] = userRules.RedirectUrl + } + if userRules.ResponseCode != nil { + userRulesMap["response_code"] = userRules.ResponseCode + } + + userRulesList = append(userRulesList, userRulesMap) + } + aclConfigMap["user_rules"] = userRulesList + } + + configMap["acl_config"] = []interface{}{aclConfigMap} + } + if securityPolicy.Config.BotConfig != nil { + botConfigMap := map[string]interface{}{} + if securityPolicy.Config.BotConfig.Switch != nil { + botConfigMap["switch"] = securityPolicy.Config.BotConfig.Switch + } + if securityPolicy.Config.BotConfig.ManagedRule != nil { + managedRuleMap := map[string]interface{}{} + if securityPolicy.Config.BotConfig.ManagedRule.RuleID != nil { + managedRuleMap["rule_id"] = securityPolicy.Config.BotConfig.ManagedRule.RuleID + } + if securityPolicy.Config.BotConfig.ManagedRule.Action != nil { + managedRuleMap["action"] = securityPolicy.Config.BotConfig.ManagedRule.Action + } + if securityPolicy.Config.BotConfig.ManagedRule.PunishTime != nil { + managedRuleMap["punish_time"] = securityPolicy.Config.BotConfig.ManagedRule.PunishTime + } + if securityPolicy.Config.BotConfig.ManagedRule.PunishTimeUnit != nil { + managedRuleMap["punish_time_unit"] = securityPolicy.Config.BotConfig.ManagedRule.PunishTimeUnit + } + if securityPolicy.Config.BotConfig.ManagedRule.Name != nil { + managedRuleMap["name"] = securityPolicy.Config.BotConfig.ManagedRule.Name + } + if securityPolicy.Config.BotConfig.ManagedRule.PageId != nil { + managedRuleMap["page_id"] = securityPolicy.Config.BotConfig.ManagedRule.PageId + } + if securityPolicy.Config.BotConfig.ManagedRule.RedirectUrl != nil { + managedRuleMap["redirect_url"] = securityPolicy.Config.BotConfig.ManagedRule.RedirectUrl + } + if securityPolicy.Config.BotConfig.ManagedRule.ResponseCode != nil { + managedRuleMap["response_code"] = securityPolicy.Config.BotConfig.ManagedRule.ResponseCode + } + if securityPolicy.Config.BotConfig.ManagedRule.TransManagedIds != nil { + managedRuleMap["trans_managed_ids"] = securityPolicy.Config.BotConfig.ManagedRule.TransManagedIds + } + if securityPolicy.Config.BotConfig.ManagedRule.AlgManagedIds != nil { + managedRuleMap["alg_managed_ids"] = securityPolicy.Config.BotConfig.ManagedRule.AlgManagedIds + } + if securityPolicy.Config.BotConfig.ManagedRule.CapManagedIds != nil { + managedRuleMap["cap_managed_ids"] = securityPolicy.Config.BotConfig.ManagedRule.CapManagedIds + } + if securityPolicy.Config.BotConfig.ManagedRule.MonManagedIds != nil { + managedRuleMap["mon_managed_ids"] = securityPolicy.Config.BotConfig.ManagedRule.MonManagedIds + } + if securityPolicy.Config.BotConfig.ManagedRule.DropManagedIds != nil { + managedRuleMap["drop_managed_ids"] = securityPolicy.Config.BotConfig.ManagedRule.DropManagedIds + } + + botConfigMap["managed_rule"] = []interface{}{managedRuleMap} + } + if securityPolicy.Config.BotConfig.PortraitRule != nil { + portraitRuleMap := map[string]interface{}{} + if securityPolicy.Config.BotConfig.PortraitRule.RuleID != nil { + portraitRuleMap["rule_id"] = securityPolicy.Config.BotConfig.PortraitRule.RuleID + } + if securityPolicy.Config.BotConfig.PortraitRule.AlgManagedIds != nil { + portraitRuleMap["alg_managed_ids"] = securityPolicy.Config.BotConfig.PortraitRule.AlgManagedIds + } + if securityPolicy.Config.BotConfig.PortraitRule.CapManagedIds != nil { + portraitRuleMap["cap_managed_ids"] = securityPolicy.Config.BotConfig.PortraitRule.CapManagedIds + } + if securityPolicy.Config.BotConfig.PortraitRule.MonManagedIds != nil { + portraitRuleMap["mon_managed_ids"] = securityPolicy.Config.BotConfig.PortraitRule.MonManagedIds + } + if securityPolicy.Config.BotConfig.PortraitRule.DropManagedIds != nil { + portraitRuleMap["drop_managed_ids"] = securityPolicy.Config.BotConfig.PortraitRule.DropManagedIds + } + if securityPolicy.Config.BotConfig.PortraitRule.Switch != nil { + portraitRuleMap["switch"] = securityPolicy.Config.BotConfig.PortraitRule.Switch + } + + botConfigMap["portrait_rule"] = []interface{}{portraitRuleMap} + } + if securityPolicy.Config.BotConfig.IntelligenceRule != nil { + intelligenceRuleMap := map[string]interface{}{} + if securityPolicy.Config.BotConfig.IntelligenceRule.Switch != nil { + intelligenceRuleMap["switch"] = securityPolicy.Config.BotConfig.IntelligenceRule.Switch + } + if securityPolicy.Config.BotConfig.IntelligenceRule.Items != nil { + itemsList := []interface{}{} + for _, items := range securityPolicy.Config.BotConfig.IntelligenceRule.Items { + itemsMap := map[string]interface{}{} + if items.Label != nil { + itemsMap["label"] = items.Label + } + if items.Action != nil { + itemsMap["action"] = items.Action + } + + itemsList = append(itemsList, itemsMap) + } + intelligenceRuleMap["items"] = itemsList + } + + botConfigMap["intelligence_rule"] = []interface{}{intelligenceRuleMap} + } + + configMap["bot_config"] = []interface{}{botConfigMap} + } + if securityPolicy.Config.SwitchConfig != nil { + switchConfigMap := map[string]interface{}{} + if securityPolicy.Config.SwitchConfig.WebSwitch != nil { + switchConfigMap["web_switch"] = securityPolicy.Config.SwitchConfig.WebSwitch + } + + configMap["switch_config"] = []interface{}{switchConfigMap} + } + if securityPolicy.Config.IpTableConfig != nil { + ipTableConfigMap := map[string]interface{}{} + if securityPolicy.Config.IpTableConfig.Switch != nil { + ipTableConfigMap["switch"] = securityPolicy.Config.IpTableConfig.Switch + } + if securityPolicy.Config.IpTableConfig.Rules != nil { + rulesList := []interface{}{} + for _, rules := range securityPolicy.Config.IpTableConfig.Rules { + rulesMap := map[string]interface{}{} + if rules.Action != nil { + rulesMap["action"] = rules.Action + } + if rules.MatchFrom != nil { + rulesMap["match_from"] = rules.MatchFrom + } + if rules.MatchContent != nil { + rulesMap["match_content"] = rules.MatchContent + } + if rules.RuleID != nil { + rulesMap["rule_id"] = rules.RuleID + } + if rules.UpdateTime != nil { + rulesMap["update_time"] = rules.UpdateTime + } + + rulesList = append(rulesList, rulesMap) + } + ipTableConfigMap["rules"] = rulesList + } + + configMap["ip_table_config"] = []interface{}{ipTableConfigMap} + } + + _ = d.Set("config", []interface{}{configMap}) + } + + return nil +} + +func resourceTencentCloudTeoSecurityPolicyUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_security_policy.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + request := teo.NewModifySecurityPolicyRequest() + + idSplit := strings.Split(d.Id(), FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + entity := idSplit[1] + + request.ZoneId = &zoneId + request.Entity = &entity + + if dMap, ok := helper.InterfacesHeadMap(d, "config"); ok { + securityConfig := teo.SecurityConfig{} + if WafConfigMap, ok := helper.InterfaceToMap(dMap, "waf_config"); ok { + wafConfig := teo.WafConfig{} + if v, ok := WafConfigMap["switch"]; ok { + wafConfig.Switch = helper.String(v.(string)) + } + if v, ok := WafConfigMap["level"]; ok { + wafConfig.Level = helper.String(v.(string)) + } + if v, ok := WafConfigMap["mode"]; ok { + wafConfig.Mode = helper.String(v.(string)) + } + if WafRulesMap, ok := helper.InterfaceToMap(WafConfigMap, "waf_rules"); ok { + wafRule := teo.WafRule{} + if v, ok := WafRulesMap["switch"]; ok { + wafRule.Switch = helper.String(v.(string)) + } + if v, ok := WafRulesMap["block_rule_ids"]; ok { + blockRuleIDsSet := v.(*schema.Set).List() + for i := range blockRuleIDsSet { + blockRuleIDs := blockRuleIDsSet[i].(int) + wafRule.BlockRuleIDs = append(wafRule.BlockRuleIDs, helper.IntInt64(blockRuleIDs)) + } + } + if v, ok := WafRulesMap["observe_rule_ids"]; ok { + observeRuleIDsSet := v.(*schema.Set).List() + for i := range observeRuleIDsSet { + observeRuleIDs := observeRuleIDsSet[i].(int) + wafRule.ObserveRuleIDs = append(wafRule.ObserveRuleIDs, helper.IntInt64(observeRuleIDs)) + } + } + wafConfig.WafRules = &wafRule + } + if AiRuleMap, ok := helper.InterfaceToMap(WafConfigMap, "ai_rule"); ok { + aiRule := teo.AiRule{} + if v, ok := AiRuleMap["mode"]; ok { + aiRule.Mode = helper.String(v.(string)) + } + wafConfig.AiRule = &aiRule + } + securityConfig.WafConfig = &wafConfig + } + if RateLimitConfigMap, ok := helper.InterfaceToMap(dMap, "rate_limit_config"); ok { + rateLimitConfig := teo.RateLimitConfig{} + if v, ok := RateLimitConfigMap["switch"]; ok { + rateLimitConfig.Switch = helper.String(v.(string)) + } + if v, ok := RateLimitConfigMap["user_rules"]; ok { + for _, item := range v.([]interface{}) { + UserRulesMap := item.(map[string]interface{}) + rateLimitUserRule := teo.RateLimitUserRule{} + if v, ok := UserRulesMap["rule_name"]; ok { + rateLimitUserRule.RuleName = helper.String(v.(string)) + } + if v, ok := UserRulesMap["threshold"]; ok { + rateLimitUserRule.Threshold = helper.IntInt64(v.(int)) + } + if v, ok := UserRulesMap["period"]; ok { + rateLimitUserRule.Period = helper.IntInt64(v.(int)) + } + if v, ok := UserRulesMap["action"]; ok { + rateLimitUserRule.Action = helper.String(v.(string)) + } + if v, ok := UserRulesMap["punish_time"]; ok { + rateLimitUserRule.PunishTime = helper.IntInt64(v.(int)) + } + if v, ok := UserRulesMap["punish_time_unit"]; ok { + rateLimitUserRule.PunishTimeUnit = helper.String(v.(string)) + } + if v, ok := UserRulesMap["rule_status"]; ok { + rateLimitUserRule.RuleStatus = helper.String(v.(string)) + } + if v, ok := UserRulesMap["freq_fields"]; ok { + freqFieldsSet := v.(*schema.Set).List() + for i := range freqFieldsSet { + freqFields := freqFieldsSet[i].(string) + rateLimitUserRule.FreqFields = append(rateLimitUserRule.FreqFields, &freqFields) + } + } + if v, ok := UserRulesMap["conditions"]; ok { + for _, item := range v.([]interface{}) { + ConditionsMap := item.(map[string]interface{}) + aCLCondition := teo.ACLCondition{} + if v, ok := ConditionsMap["match_from"]; ok { + aCLCondition.MatchFrom = helper.String(v.(string)) + } + if v, ok := ConditionsMap["match_param"]; ok { + aCLCondition.MatchParam = helper.String(v.(string)) + } + if v, ok := ConditionsMap["operator"]; ok { + aCLCondition.Operator = helper.String(v.(string)) + } + if v, ok := ConditionsMap["match_content"]; ok { + aCLCondition.MatchContent = helper.String(v.(string)) + } + rateLimitUserRule.Conditions = append(rateLimitUserRule.Conditions, &aCLCondition) + } + } + if v, ok := UserRulesMap["rule_priority"]; ok { + rateLimitUserRule.RulePriority = helper.IntInt64(v.(int)) + } + rateLimitConfig.UserRules = append(rateLimitConfig.UserRules, &rateLimitUserRule) + } + } + if TemplateMap, ok := helper.InterfaceToMap(RateLimitConfigMap, "template"); ok { + rateLimitTemplate := teo.RateLimitTemplate{} + if v, ok := TemplateMap["mode"]; ok { + rateLimitTemplate.Mode = helper.String(v.(string)) + } + if DetailMap, ok := helper.InterfaceToMap(TemplateMap, "detail"); ok { + rateLimitTemplateDetail := teo.RateLimitTemplateDetail{} + if v, ok := DetailMap["mode"]; ok { + rateLimitTemplateDetail.Mode = helper.String(v.(string)) + } + if v, ok := DetailMap["id"]; ok { + rateLimitTemplateDetail.ID = helper.IntInt64(v.(int)) + } + if v, ok := DetailMap["action"]; ok { + rateLimitTemplateDetail.Action = helper.String(v.(string)) + } + if v, ok := DetailMap["punish_time"]; ok { + rateLimitTemplateDetail.PunishTime = helper.IntInt64(v.(int)) + } + if v, ok := DetailMap["threshold"]; ok { + rateLimitTemplateDetail.Threshold = helper.IntInt64(v.(int)) + } + if v, ok := DetailMap["period"]; ok { + rateLimitTemplateDetail.Period = helper.IntInt64(v.(int)) + } + rateLimitTemplate.Detail = &rateLimitTemplateDetail + } + rateLimitConfig.Template = &rateLimitTemplate + } + if IntelligenceMap, ok := helper.InterfaceToMap(RateLimitConfigMap, "intelligence"); ok { + rateLimitIntelligence := teo.RateLimitIntelligence{} + if v, ok := IntelligenceMap["switch"]; ok { + rateLimitIntelligence.Switch = helper.String(v.(string)) + } + if v, ok := IntelligenceMap["action"]; ok { + rateLimitIntelligence.Action = helper.String(v.(string)) + } + rateLimitConfig.Intelligence = &rateLimitIntelligence + } + securityConfig.RateLimitConfig = &rateLimitConfig + } + if AclConfigMap, ok := helper.InterfaceToMap(dMap, "acl_config"); ok { + aclConfig := teo.AclConfig{} + if v, ok := AclConfigMap["switch"]; ok { + aclConfig.Switch = helper.String(v.(string)) + } + if v, ok := AclConfigMap["user_rules"]; ok { + for _, item := range v.([]interface{}) { + UserRulesMap := item.(map[string]interface{}) + aCLUserRule := teo.ACLUserRule{} + if v, ok := UserRulesMap["rule_name"]; ok { + aCLUserRule.RuleName = helper.String(v.(string)) + } + if v, ok := UserRulesMap["action"]; ok { + aCLUserRule.Action = helper.String(v.(string)) + } + if v, ok := UserRulesMap["rule_status"]; ok { + aCLUserRule.RuleStatus = helper.String(v.(string)) + } + if v, ok := UserRulesMap["conditions"]; ok { + for _, item := range v.([]interface{}) { + ConditionsMap := item.(map[string]interface{}) + aCLCondition := teo.ACLCondition{} + if v, ok := ConditionsMap["match_from"]; ok { + aCLCondition.MatchFrom = helper.String(v.(string)) + } + if v, ok := ConditionsMap["match_param"]; ok { + aCLCondition.MatchParam = helper.String(v.(string)) + } + if v, ok := ConditionsMap["operator"]; ok { + aCLCondition.Operator = helper.String(v.(string)) + } + if v, ok := ConditionsMap["match_content"]; ok { + aCLCondition.MatchContent = helper.String(v.(string)) + } + aCLUserRule.Conditions = append(aCLUserRule.Conditions, &aCLCondition) + } + } + if v, ok := UserRulesMap["rule_priority"]; ok { + aCLUserRule.RulePriority = helper.IntInt64(v.(int)) + } + if v, ok := UserRulesMap["punish_time"]; ok { + aCLUserRule.PunishTime = helper.IntInt64(v.(int)) + } + if v, ok := UserRulesMap["punish_time_unit"]; ok { + aCLUserRule.PunishTimeUnit = helper.String(v.(string)) + } + if v, ok := UserRulesMap["name"]; ok { + aCLUserRule.Name = helper.String(v.(string)) + } + if v, ok := UserRulesMap["page_id"]; ok { + aCLUserRule.PageId = helper.IntInt64(v.(int)) + } + if v, ok := UserRulesMap["redirect_url"]; ok { + aCLUserRule.RedirectUrl = helper.String(v.(string)) + } + if v, ok := UserRulesMap["response_code"]; ok { + aCLUserRule.ResponseCode = helper.IntInt64(v.(int)) + } + aclConfig.UserRules = append(aclConfig.UserRules, &aCLUserRule) + } + } + securityConfig.AclConfig = &aclConfig + } + if BotConfigMap, ok := helper.InterfaceToMap(dMap, "bot_config"); ok { + botConfig := teo.BotConfig{} + if v, ok := BotConfigMap["switch"]; ok { + botConfig.Switch = helper.String(v.(string)) + } + if ManagedRuleMap, ok := helper.InterfaceToMap(BotConfigMap, "managed_rule"); ok { + botManagedRule := teo.BotManagedRule{} + if v, ok := ManagedRuleMap["rule_id"]; ok { + botManagedRule.RuleID = helper.IntInt64(v.(int)) + } + if v, ok := ManagedRuleMap["action"]; ok { + botManagedRule.Action = helper.String(v.(string)) + } + if v, ok := ManagedRuleMap["punish_time"]; ok { + botManagedRule.PunishTime = helper.IntInt64(v.(int)) + } + if v, ok := ManagedRuleMap["punish_time_unit"]; ok { + botManagedRule.PunishTimeUnit = helper.String(v.(string)) + } + if v, ok := ManagedRuleMap["name"]; ok { + botManagedRule.Name = helper.String(v.(string)) + } + if v, ok := ManagedRuleMap["page_id"]; ok { + botManagedRule.PageId = helper.IntInt64(v.(int)) + } + if v, ok := ManagedRuleMap["redirect_url"]; ok { + botManagedRule.RedirectUrl = helper.String(v.(string)) + } + if v, ok := ManagedRuleMap["response_code"]; ok { + botManagedRule.ResponseCode = helper.IntInt64(v.(int)) + } + if v, ok := ManagedRuleMap["trans_managed_ids"]; ok { + transManagedIdsSet := v.(*schema.Set).List() + for i := range transManagedIdsSet { + transManagedIds := transManagedIdsSet[i].(int) + botManagedRule.TransManagedIds = append(botManagedRule.TransManagedIds, helper.IntInt64(transManagedIds)) + } + } + if v, ok := ManagedRuleMap["alg_managed_ids"]; ok { + algManagedIdsSet := v.(*schema.Set).List() + for i := range algManagedIdsSet { + algManagedIds := algManagedIdsSet[i].(int) + botManagedRule.AlgManagedIds = append(botManagedRule.AlgManagedIds, helper.IntInt64(algManagedIds)) + } + } + if v, ok := ManagedRuleMap["cap_managed_ids"]; ok { + capManagedIdsSet := v.(*schema.Set).List() + for i := range capManagedIdsSet { + capManagedIds := capManagedIdsSet[i].(int) + botManagedRule.CapManagedIds = append(botManagedRule.CapManagedIds, helper.IntInt64(capManagedIds)) + } + } + if v, ok := ManagedRuleMap["mon_managed_ids"]; ok { + monManagedIdsSet := v.(*schema.Set).List() + for i := range monManagedIdsSet { + monManagedIds := monManagedIdsSet[i].(int) + botManagedRule.MonManagedIds = append(botManagedRule.MonManagedIds, helper.IntInt64(monManagedIds)) + } + } + if v, ok := ManagedRuleMap["drop_managed_ids"]; ok { + dropManagedIdsSet := v.(*schema.Set).List() + for i := range dropManagedIdsSet { + dropManagedIds := dropManagedIdsSet[i].(int) + botManagedRule.DropManagedIds = append(botManagedRule.DropManagedIds, helper.IntInt64(dropManagedIds)) + } + } + botConfig.ManagedRule = &botManagedRule + } + if PortraitRuleMap, ok := helper.InterfaceToMap(BotConfigMap, "portrait_rule"); ok { + botPortraitRule := teo.BotPortraitRule{} + if v, ok := PortraitRuleMap["rule_id"]; ok { + botPortraitRule.RuleID = helper.IntInt64(v.(int)) + } + if v, ok := PortraitRuleMap["alg_managed_ids"]; ok { + algManagedIdsSet := v.(*schema.Set).List() + for i := range algManagedIdsSet { + algManagedIds := algManagedIdsSet[i].(int) + botPortraitRule.AlgManagedIds = append(botPortraitRule.AlgManagedIds, helper.IntInt64(algManagedIds)) + } + } + if v, ok := PortraitRuleMap["cap_managed_ids"]; ok { + capManagedIdsSet := v.(*schema.Set).List() + for i := range capManagedIdsSet { + capManagedIds := capManagedIdsSet[i].(int) + botPortraitRule.CapManagedIds = append(botPortraitRule.CapManagedIds, helper.IntInt64(capManagedIds)) + } + } + if v, ok := PortraitRuleMap["mon_managed_ids"]; ok { + monManagedIdsSet := v.(*schema.Set).List() + for i := range monManagedIdsSet { + monManagedIds := monManagedIdsSet[i].(int) + botPortraitRule.MonManagedIds = append(botPortraitRule.MonManagedIds, helper.IntInt64(monManagedIds)) + } + } + if v, ok := PortraitRuleMap["drop_managed_ids"]; ok { + dropManagedIdsSet := v.(*schema.Set).List() + for i := range dropManagedIdsSet { + dropManagedIds := dropManagedIdsSet[i].(int) + botPortraitRule.DropManagedIds = append(botPortraitRule.DropManagedIds, helper.IntInt64(dropManagedIds)) + } + } + if v, ok := PortraitRuleMap["switch"]; ok { + botPortraitRule.Switch = helper.String(v.(string)) + } + botConfig.PortraitRule = &botPortraitRule + } + if IntelligenceRuleMap, ok := helper.InterfaceToMap(BotConfigMap, "intelligence_rule"); ok { + intelligenceRule := teo.IntelligenceRule{} + if v, ok := IntelligenceRuleMap["switch"]; ok { + intelligenceRule.Switch = helper.String(v.(string)) + } + if v, ok := IntelligenceRuleMap["items"]; ok { + for _, item := range v.([]interface{}) { + ItemsMap := item.(map[string]interface{}) + intelligenceRuleItem := teo.IntelligenceRuleItem{} + if v, ok := ItemsMap["label"]; ok { + intelligenceRuleItem.Label = helper.String(v.(string)) + } + if v, ok := ItemsMap["action"]; ok { + intelligenceRuleItem.Action = helper.String(v.(string)) + } + intelligenceRule.Items = append(intelligenceRule.Items, &intelligenceRuleItem) + } + } + botConfig.IntelligenceRule = &intelligenceRule + } + securityConfig.BotConfig = &botConfig + } + if SwitchConfigMap, ok := helper.InterfaceToMap(dMap, "switch_config"); ok { + switchConfig := teo.SwitchConfig{} + if v, ok := SwitchConfigMap["web_switch"]; ok { + switchConfig.WebSwitch = helper.String(v.(string)) + } + securityConfig.SwitchConfig = &switchConfig + } + if IpTableConfigMap, ok := helper.InterfaceToMap(dMap, "ip_table_config"); ok { + ipTableConfig := teo.IpTableConfig{} + if v, ok := IpTableConfigMap["switch"]; ok { + ipTableConfig.Switch = helper.String(v.(string)) + } + if v, ok := IpTableConfigMap["rules"]; ok { + for _, item := range v.([]interface{}) { + RulesMap := item.(map[string]interface{}) + ipTableRule := teo.IpTableRule{} + if v, ok := RulesMap["action"]; ok { + ipTableRule.Action = helper.String(v.(string)) + } + if v, ok := RulesMap["match_from"]; ok { + ipTableRule.MatchFrom = helper.String(v.(string)) + } + if v, ok := RulesMap["match_content"]; ok { + ipTableRule.MatchContent = helper.String(v.(string)) + } + if v, ok := RulesMap["rule_id"]; ok { + ipTableRule.RuleID = helper.IntInt64(v.(int)) + } + ipTableConfig.Rules = append(ipTableConfig.Rules, &ipTableRule) + } + } + securityConfig.IpTableConfig = &ipTableConfig + } + + request.Config = &securityConfig + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifySecurityPolicy(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo securityPolicy failed, reason:%+v", logId, err) + return err + } + + return resourceTencentCloudTeoSecurityPolicyRead(d, meta) +} + +func resourceTencentCloudTeoSecurityPolicyDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_security_policy.delete")() + defer inconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/resource_tc_teo_security_policy_test.go b/tencentcloud/resource_tc_teo_security_policy_test.go new file mode 100644 index 0000000000..02f4c71d08 --- /dev/null +++ b/tencentcloud/resource_tc_teo_security_policy_test.go @@ -0,0 +1,155 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoSecurityPolicy_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoSecurityPolicy, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_security_policy.securityPolicy", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_security_policy.securityPolicy", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoSecurityPolicy = ` + +resource "tencentcloud_teo_security_policy" "securityPolicy" { + zone_id = "" + entity = "" + config { + waf_config { + switch = "" + level = "" + mode = "" + waf_rules { + switch = "" + block_rule_i_ds = "" + observe_rule_i_ds = "" + } + ai_rule { + mode = "" + } + } + rate_limit_config { + switch = "" + user_rules { + rule_name = "" + threshold = "" + period = "" + action = "" + punish_time = "" + punish_time_unit = "" + rule_status = "" + freq_fields = "" + conditions { + match_from = "" + match_param = "" + operator = "" + match_content = "" + } + rule_priority = "" + } + template { + mode = "" + detail { + mode = "" + i_d = "" + action = "" + punish_time = "" + threshold = "" + period = "" + } + } + intelligence { + switch = "" + action = "" + } + } + acl_config { + switch = "" + user_rules { + rule_name = "" + action = "" + rule_status = "" + conditions { + match_from = "" + match_param = "" + operator = "" + match_content = "" + } + rule_priority = "" + punish_time = "" + punish_time_unit = "" + name = "" + page_id = "" + redirect_url = "" + response_code = "" + } + } + bot_config { + switch = "" + managed_rule { + rule_i_d = "" + action = "" + punish_time = "" + punish_time_unit = "" + name = "" + page_id = "" + redirect_url = "" + response_code = "" + trans_managed_ids = "" + alg_managed_ids = "" + cap_managed_ids = "" + mon_managed_ids = "" + drop_managed_ids = "" + } + portrait_rule { + rule_i_d = "" + alg_managed_ids = "" + cap_managed_ids = "" + mon_managed_ids = "" + drop_managed_ids = "" + switch = "" + } + intelligence_rule { + switch = "" + items { + label = "" + action = "" + } + } + } + switch_config { + web_switch = "" + } + ip_table_config { + switch = "" + rules { + action = "" + match_from = "" + match_content = "" + rule_i_d = "" + } + } + + } +} + +` diff --git a/tencentcloud/resource_tc_teo_zone.go b/tencentcloud/resource_tc_teo_zone.go new file mode 100644 index 0000000000..e8f8a401b8 --- /dev/null +++ b/tencentcloud/resource_tc_teo_zone.go @@ -0,0 +1,496 @@ +/* +Provides a resource to create a teo zone + +Example Usage + +```hcl +resource "tencentcloud_teo_zone" "zone" { + name = "sfurnace.work" + plan_type = "ent_cm_with_bot" + type = "full" + paused = false + cname_speed_up = "enabled" + + # vanity_name_servers { + # switch = "on" + # servers = ["2.2.2.2"] + # } +} +``` +Import + +teo zone can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_zone.zone zone_id +``` +*/ +package tencentcloud + +import ( + "context" + "errors" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoZone() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoZoneRead, + Create: resourceTencentCloudTeoZoneCreate, + Update: resourceTencentCloudTeoZoneUpdate, + Delete: resourceTencentCloudTeoZoneDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Site name.", + }, + + "plan_type": { + Type: schema.TypeString, + Required: true, + Description: "Plan type of the zone. See details in data source `zone_available_plans`.", + }, + + "original_name_servers": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + Description: "List of name servers used.", + }, + + "name_servers": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Computed: true, + Description: "List of name servers assigned to users by Tencent Cloud.", + }, + + "status": { + Type: schema.TypeString, + Computed: true, + Description: "Site status.", + }, + + "type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Specifies how the site is connected to EdgeOne.", + }, + + "paused": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether the site is disabled.", + }, + + "created_on": { + Type: schema.TypeString, + Computed: true, + Description: "Site creation date.", + }, + + "modified_on": { + Type: schema.TypeString, + Computed: true, + Description: "Site modification date.", + }, + + "vanity_name_servers": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "User-defined name server information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable the custom name server.", + }, + "servers": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Computed: true, + Description: "List of custom name servers.", + }, + }, + }, + }, + + "vanity_name_servers_ips": { + Type: schema.TypeList, + Computed: true, + Description: "User-defined name server IP information.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + Description: "Name of the custom name server.", + }, + "ipv4": { + Type: schema.TypeString, + Computed: true, + Description: "IPv4 address of the custom name server.", + }, + }, + }, + }, + + "cname_speed_up": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Specifies whether to enable CNAME acceleration, enabled: Enable; disabled: Disable.", + }, + + "cname_status": { + Type: schema.TypeString, + Computed: true, + Description: "Ownership verification status of the site when it accesses via CNAME.", + }, + + "tags": { + Type: schema.TypeMap, + Optional: true, + Description: "Tag description list.", + }, + "area": { + Type: schema.TypeString, + Computed: true, + Description: "Acceleration area of the zone. Valid values: `mainland`, `overseas`.", + }, + }, + } +} + +func resourceTencentCloudTeoZoneCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone.create")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewCreateZoneRequest() + response *teo.CreateZoneResponse + ) + + if v, ok := d.GetOk("name"); ok { + request.Name = helper.String(v.(string)) + } + + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + + if dMap, ok := helper.InterfacesHeadMap(d, "vanity_name_servers"); ok { + vanityNameServers := teo.VanityNameServers{} + if v, ok := dMap["switch"]; ok { + vanityNameServers.Switch = helper.String(v.(string)) + } + if v, ok := dMap["servers"]; ok { + serversSet := v.(*schema.Set).List() + for i := range serversSet { + servers := serversSet[i].(string) + vanityNameServers.Servers = append(vanityNameServers.Servers, &servers) + } + } + } + + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreateZone(request) + if e != nil { + return e + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + + if response == nil || response.Response == nil || response.Response.Id == nil { + return errors.New("CreateZone create teo zone failed") + } + + zoneId := *response.Response.Id + + var planRequest = teo.NewCreatePlanForZoneRequest() + planRequest.ZoneId = &zoneId + if v, ok := d.GetOk("plan_type"); ok { + planRequest.PlanType = helper.String(v.(string)) + } + + resultPlan, err := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().CreatePlanForZone(planRequest) + if e != nil { + log.Printf("[CRITAL]%s create teo zone plan failed, reason:%+v", logId, e) + return err + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), resultPlan.ToJsonString()) + } + + ctx := context.WithValue(context.TODO(), logIdKey, logId) + if tags := helper.GetTags(d, "tags"); len(tags) > 0 { + tagService := TagService{client: meta.(*TencentCloudClient).apiV3Conn} + region := meta.(*TencentCloudClient).apiV3Conn.Region + resourceName := fmt.Sprintf("qcs::teo:%s:uin/:zone/%s", region, zoneId) + if err := tagService.ModifyTags(ctx, resourceName, tags, nil); err != nil { + return err + } + } + d.SetId(zoneId) + return resourceTencentCloudTeoZoneRead(d, meta) +} + +func resourceTencentCloudTeoZoneRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + zoneId := d.Id() + + zone, err := service.DescribeTeoZone(ctx, zoneId) + + if err != nil { + return err + } + + if zone == nil { + d.SetId("") + return fmt.Errorf("resource `zone` %s does not exist", zoneId) + } + + if zone.Id != nil { + _ = d.Set("id", zone.Id) + } + + if zone.Name != nil { + _ = d.Set("name", zone.Name) + } + + if zone.OriginalNameServers != nil { + _ = d.Set("original_name_servers", zone.OriginalNameServers) + } + + if zone.NameServers != nil { + _ = d.Set("name_servers", zone.NameServers) + } + + if zone.Status != nil { + _ = d.Set("status", zone.Status) + } + + if zone.Type != nil { + _ = d.Set("type", zone.Type) + } + + if zone.Paused != nil { + _ = d.Set("paused", zone.Paused) + } + + if zone.CreatedOn != nil { + _ = d.Set("created_on", zone.CreatedOn) + } + + if zone.ModifiedOn != nil { + _ = d.Set("modified_on", zone.ModifiedOn) + } + + if zone.VanityNameServers != nil { + vanityNameServersMap := map[string]interface{}{} + if zone.VanityNameServers.Switch != nil { + vanityNameServersMap["switch"] = zone.VanityNameServers.Switch + } + if zone.VanityNameServers.Servers != nil { + vanityNameServersMap["servers"] = zone.VanityNameServers.Servers + } + + _ = d.Set("vanity_name_servers", []interface{}{vanityNameServersMap}) + } + + if zone.VanityNameServersIps != nil { + vanityNameServersIpsList := []interface{}{} + for _, vanityNameServersIps := range zone.VanityNameServersIps { + vanityNameServersIpsMap := map[string]interface{}{} + if vanityNameServersIps.Name != nil { + vanityNameServersIpsMap["name"] = vanityNameServersIps.Name + } + if vanityNameServersIps.IPv4 != nil { + vanityNameServersIpsMap["ipv4"] = vanityNameServersIps.IPv4 + } + + vanityNameServersIpsList = append(vanityNameServersIpsList, vanityNameServersIpsMap) + } + _ = d.Set("vanity_name_servers_ips", vanityNameServersIpsList) + } + + if zone.CnameSpeedUp != nil { + _ = d.Set("cname_speed_up", zone.CnameSpeedUp) + } + + if zone.CnameStatus != nil { + _ = d.Set("cname_status", zone.CnameStatus) + } + + tcClient := meta.(*TencentCloudClient).apiV3Conn + tagService := &TagService{client: tcClient} + tags, err := tagService.DescribeResourceTags(ctx, "teo", "zone", tcClient.Region, d.Id()) + if err != nil { + return err + } + _ = d.Set("tags", tags) + + if zone.Area != nil { + _ = d.Set("area", zone.Area) + } + + return nil +} + +func resourceTencentCloudTeoZoneUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + request := teo.NewModifyZoneRequest() + + request.Id = helper.String(d.Id()) + + if d.HasChange("name") { + return fmt.Errorf("`name` do not support change now.") + } + + if d.HasChange("type") { + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + } + + if d.HasChange("vanity_name_servers") { + if dMap, ok := helper.InterfacesHeadMap(d, "vanity_name_servers"); ok { + vanityNameServers := teo.VanityNameServers{} + if v, ok := dMap["switch"]; ok { + vanityNameServers.Switch = helper.String(v.(string)) + } + if v, ok := dMap["servers"]; ok { + serversSet := v.(*schema.Set).List() + for i := range serversSet { + servers := serversSet[i].(string) + vanityNameServers.Servers = append(vanityNameServers.Servers, &servers) + } + } + request.VanityNameServers = &vanityNameServers + } + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyZone(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + + if d.HasChange("tags") { + tcClient := meta.(*TencentCloudClient).apiV3Conn + tagService := &TagService{client: tcClient} + oldTags, newTags := d.GetChange("tags") + replaceTags, deleteTags := diffTags(oldTags.(map[string]interface{}), newTags.(map[string]interface{})) + resourceName := BuildTagResourceName("teo", "zone", tcClient.Region, d.Id()) + if err := tagService.ModifyTags(ctx, resourceName, replaceTags, deleteTags); err != nil { + return err + } + } + + if d.HasChange("cname_speed_up") { + requestCnameSpeedUp := teo.NewModifyZoneCnameSpeedUpRequest() + requestCnameSpeedUp.Id = helper.String(d.Id()) + if v, ok := d.GetOk("cname_speed_up"); ok { + requestCnameSpeedUp.Status = helper.String(v.(string)) + } + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyZoneCnameSpeedUp(requestCnameSpeedUp) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + } + + if d.HasChange("paused") { + requestPaused := teo.NewModifyZoneStatusRequest() + requestPaused.Id = helper.String(d.Id()) + v, _ := d.GetOk("paused") + requestPaused.Paused = helper.Bool(v.(bool)) + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyZoneStatus(requestPaused) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + return err + } + } + + return resourceTencentCloudTeoZoneRead(d, meta) +} + +func resourceTencentCloudTeoZoneDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone.delete")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + zoneId := d.Id() + + if err := service.DeleteTeoZoneById(ctx, zoneId); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/resource_tc_teo_zone_setting.go b/tencentcloud/resource_tc_teo_zone_setting.go new file mode 100644 index 0000000000..16e71131f5 --- /dev/null +++ b/tencentcloud/resource_tc_teo_zone_setting.go @@ -0,0 +1,1086 @@ +/* +Provides a resource to create a teo zone_setting + +Example Usage + +```hcl +resource "tencentcloud_teo_zone_setting" "zone_setting" { + zone_id = tencentcloud_teo_zone.zone.id + + cache { + follow_origin { + switch = "off" + } + + no_cache { + switch = "off" + } + } + + cache_key { + full_url_cache = "off" + ignore_case = "on" + + query_string { + action = "excludeCustom" + switch = "on" + value = ["test", "apple"] + } + } + + cache_prefresh { + percent = 90 + switch = "off" + } + + client_ip_header { + switch = "off" + } + + compression { + switch = "off" + } + + force_redirect { + redirect_status_code = 302 + switch = "on" + } + + https { + http2 = "on" + ocsp_stapling = "off" + tls_version = [ + "TLSv1.2", + "TLSv1.3", + ] + + hsts { + include_sub_domains = "off" + max_age = 0 + preload = "off" + switch = "off" + } + } + + max_age { + follow_origin = "off" + max_age_time = 600 + } + + offline_cache { + switch = "off" + } + + origin { + origin_pull_protocol = "follow" + } + + post_max_size { + max_size = 524288000 + switch = "on" + } + + quic { + switch = "on" + } + + smart_routing { + switch = "on" + } + + upstream_http2 { + switch = "off" + } + + web_socket { + switch = "off" + timeout = 30 + } +} + +``` +Import + +teo zone_setting can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_zone_setting.zone_setting zone_id +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func resourceTencentCloudTeoZoneSetting() *schema.Resource { + return &schema.Resource{ + Read: resourceTencentCloudTeoZoneSettingRead, + Create: resourceTencentCloudTeoZoneSettingCreate, + Update: resourceTencentCloudTeoZoneSettingUpdate, + Delete: resourceTencentCloudTeoZoneSettingDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + Description: "Site ID.", + }, + + "cache": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Cache expiration time configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cache": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Cache configuration.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Cache configuration switch.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "cache_time": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Cache expiration time settings.Unit: second. The maximum value is 365 days.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "ignore_cache_control": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Specifies whether to enable force cache.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + "no_cache": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "No-cache configuration.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Whether to cache the configuration.- on: Do not cache.- off: Cache.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + "follow_origin": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Follows the origin server configuration.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "According to the configuration switch of the origin site, the values are: on: open; off: off.", + }, + }, + }, + }, + }, + }, + }, + + "cache_key": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Node cache key configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "full_url_cache": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies whether to enable full-path cache.- on: Enable full-path cache (i.e., disable Ignore Query String).- off: Disable full-path cache (i.e., enable Ignore Query String).Note: This field may return null, indicating that no valid value can be obtained.", + }, + "ignore_case": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies whether the cache key is case-sensitive.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "query_string": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "Request parameter contained in CacheKey.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to use QueryString as part of CacheKey.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "action": { + Type: schema.TypeString, + Optional: true, + Description: "- includeCustom: Include the specified query strings.- excludeCustom: Exclude the specified query strings.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "value": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Description: "Array of query strings used/excluded.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + }, + }, + }, + + "max_age": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Browser cache configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max_age_time": { + Type: schema.TypeInt, + Optional: true, + Description: "Specifies the max age of the cache (in seconds). The maximum value is 365 days.Note: the value 0 means not to cache.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "follow_origin": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies whether to follow the max cache age of the origin server.- on: Enable.- off: Disable.If it's on, MaxAgeTime is ignored.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + + "offline_cache": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Offline cache configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable offline cache.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + + "quic": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "QUIC access configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable QUIC.- on: Enable.- off: Disable.", + }, + }, + }, + }, + + "post_max_size": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Maximum size of files transferred over POST request.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Specifies whether to enable custom setting of the maximum file size.- on: Enable. You can set a custom max size.- off: Disable. In this case, the max size defaults to 32 MB.", + }, + "max_size": { + Type: schema.TypeInt, + Optional: true, + Description: "Maximum size. Value range: 1-500 MB.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + + "compression": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Smart compression configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable Smart compression.- on: Enable.- off: Disable.", + }, + }, + }, + }, + + "upstream_http2": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "HTTP2 origin-pull configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable HTTP2 origin-pull.- on: Enable.- off: Disable.", + }, + }, + }, + }, + + "force_redirect": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Force HTTPS redirect configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable force redirect.- on: Enable.- off: Disable.", + }, + "redirect_status_code": { + Type: schema.TypeInt, + Optional: true, + Description: "Redirection status code.- 301- 302Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + + "https": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "HTTPS acceleration configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "http2": { + Type: schema.TypeString, + Optional: true, + Description: "HTTP2 configuration switch.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "ocsp_stapling": { + Type: schema.TypeString, + Optional: true, + Description: "OCSP configuration switch.- on: Enable.- off: Disable.It is disabled by default. Note: This field may return null, indicating that no valid value can be obtained.", + }, + "tls_version": { + Type: schema.TypeSet, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Description: "TLS version settings. Valid values: `TLSv1`, `TLSV1.1`, `TLSV1.2`, and `TLSv1.3`.Only consecutive versions can be enabled at the same time.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "hsts": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Description: "HSTS Configuration.Note: This field may return null, indicating that no valid value can be obtained.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "- on: Enable.- off: Disable.", + }, + "max_age": { + Type: schema.TypeInt, + Optional: true, + Description: "MaxAge value.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "include_sub_domains": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies whether to include subdomain names. Valid values: `on` and `off`.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "preload": { + Type: schema.TypeString, + Optional: true, + Description: "Specifies whether to preload. Valid values: `on` and `off`.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + }, + }, + }, + + "origin": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Origin server configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "origin_pull_protocol": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Origin-pull protocol.- http: Switch HTTPS requests to HTTP.- follow: Follow the protocol of the request.- https: Switch HTTP requests to HTTPS. This only supports port 443 on the origin server.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + + "smart_routing": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Smart acceleration configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable smart acceleration.- on: Enable.- off: Disable.", + }, + }, + }, + }, + + "web_socket": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "WebSocket configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Whether to enable custom WebSocket timeout setting. When it's off: it means to keep the default WebSocket connection timeout period, which is 15 seconds. To change the timeout period, please set it to on.", + }, + "timeout": { + Type: schema.TypeInt, + Optional: true, + Description: "Sets timeout period in seconds. Maximum value: 120.", + }, + }, + }, + }, + + "client_ip_header": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Origin-pull client IP header configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Specifies whether to enable client IP header.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained.", + }, + "header_name": { + Type: schema.TypeString, + Optional: true, + Description: "Name of the origin-pull client IP request header.Note: This field may return null, indicating that no valid value can be obtained.", + }, + }, + }, + }, + + "cache_prefresh": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Description: "Cache pre-refresh configuration.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "switch": { + Type: schema.TypeString, + Required: true, + Description: "Specifies whether to enable cache prefresh.- on: Enable.- off: Disable.", + }, + "percent": { + Type: schema.TypeInt, + Optional: true, + Description: "Percentage of cache time before try to prefresh. Value range: 1-99.", + }, + }, + }, + }, + }, + } +} + +func resourceTencentCloudTeoZoneSettingCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone_setting.create")() + defer inconsistentCheck(d, meta)() + + var ( + zoneId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + } + + d.SetId(zoneId) + return resourceTencentCloudTeoZoneSettingUpdate(d, meta) +} + +func resourceTencentCloudTeoZoneSettingRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone_setting.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + service := TeoService{client: meta.(*TencentCloudClient).apiV3Conn} + + zoneId := d.Id() + + zoneSetting, err := service.DescribeTeoZoneSetting(ctx, zoneId) + + if err != nil { + return err + } + + if zoneSetting == nil { + d.SetId("") + return fmt.Errorf("resource `zoneSetting` %s does not exist", zoneId) + } + + if zoneSetting.ZoneId != nil { + _ = d.Set("zone_id", zoneSetting.ZoneId) + } + + if zoneSetting.Cache != nil { + cacheMap := map[string]interface{}{} + if zoneSetting.Cache.Cache != nil { + cacheMap := map[string]interface{}{} + if zoneSetting.Cache.Cache.Switch != nil { + cacheMap["switch"] = zoneSetting.Cache.Cache.Switch + } + if zoneSetting.Cache.Cache.CacheTime != nil { + cacheMap["cache_time"] = zoneSetting.Cache.Cache.CacheTime + } + if zoneSetting.Cache.Cache.IgnoreCacheControl != nil { + cacheMap["ignore_cache_control"] = zoneSetting.Cache.Cache.IgnoreCacheControl + } + + cacheMap["cache"] = []interface{}{cacheMap} + } + if zoneSetting.Cache.NoCache != nil { + noCacheMap := map[string]interface{}{} + if zoneSetting.Cache.NoCache.Switch != nil { + noCacheMap["switch"] = zoneSetting.Cache.NoCache.Switch + } + + cacheMap["no_cache"] = []interface{}{noCacheMap} + } + if zoneSetting.Cache.FollowOrigin != nil { + followOriginMap := map[string]interface{}{} + if zoneSetting.Cache.FollowOrigin.Switch != nil { + followOriginMap["switch"] = zoneSetting.Cache.FollowOrigin.Switch + } + + cacheMap["follow_origin"] = []interface{}{followOriginMap} + } + + _ = d.Set("cache", []interface{}{cacheMap}) + } + + if zoneSetting.CacheKey != nil { + cacheKeyMap := map[string]interface{}{} + if zoneSetting.CacheKey.FullUrlCache != nil { + cacheKeyMap["full_url_cache"] = zoneSetting.CacheKey.FullUrlCache + } + if zoneSetting.CacheKey.IgnoreCase != nil { + cacheKeyMap["ignore_case"] = zoneSetting.CacheKey.IgnoreCase + } + if zoneSetting.CacheKey.QueryString != nil { + queryStringMap := map[string]interface{}{} + if zoneSetting.CacheKey.QueryString.Switch != nil { + queryStringMap["switch"] = zoneSetting.CacheKey.QueryString.Switch + } + if zoneSetting.CacheKey.QueryString.Action != nil { + queryStringMap["action"] = zoneSetting.CacheKey.QueryString.Action + } + if zoneSetting.CacheKey.QueryString.Value != nil { + queryStringMap["value"] = zoneSetting.CacheKey.QueryString.Value + } + + cacheKeyMap["query_string"] = []interface{}{queryStringMap} + } + + _ = d.Set("cache_key", []interface{}{cacheKeyMap}) + } + + if zoneSetting.MaxAge != nil { + maxAgeMap := map[string]interface{}{} + if zoneSetting.MaxAge.MaxAgeTime != nil { + maxAgeMap["max_age_time"] = zoneSetting.MaxAge.MaxAgeTime + } + if zoneSetting.MaxAge.FollowOrigin != nil { + maxAgeMap["follow_origin"] = zoneSetting.MaxAge.FollowOrigin + } + + _ = d.Set("max_age", []interface{}{maxAgeMap}) + } + + if zoneSetting.OfflineCache != nil { + offlineCacheMap := map[string]interface{}{} + if zoneSetting.OfflineCache.Switch != nil { + offlineCacheMap["switch"] = zoneSetting.OfflineCache.Switch + } + + _ = d.Set("offline_cache", []interface{}{offlineCacheMap}) + } + + if zoneSetting.Quic != nil { + quicMap := map[string]interface{}{} + if zoneSetting.Quic.Switch != nil { + quicMap["switch"] = zoneSetting.Quic.Switch + } + + _ = d.Set("quic", []interface{}{quicMap}) + } + + if zoneSetting.PostMaxSize != nil { + postMaxSizeMap := map[string]interface{}{} + if zoneSetting.PostMaxSize.Switch != nil { + postMaxSizeMap["switch"] = zoneSetting.PostMaxSize.Switch + } + if zoneSetting.PostMaxSize.MaxSize != nil { + postMaxSizeMap["max_size"] = zoneSetting.PostMaxSize.MaxSize + } + + _ = d.Set("post_max_size", []interface{}{postMaxSizeMap}) + } + + if zoneSetting.Compression != nil { + compressionMap := map[string]interface{}{} + if zoneSetting.Compression.Switch != nil { + compressionMap["switch"] = zoneSetting.Compression.Switch + } + + _ = d.Set("compression", []interface{}{compressionMap}) + } + + if zoneSetting.UpstreamHttp2 != nil { + upstreamHttp2Map := map[string]interface{}{} + if zoneSetting.UpstreamHttp2.Switch != nil { + upstreamHttp2Map["switch"] = zoneSetting.UpstreamHttp2.Switch + } + + _ = d.Set("upstream_http2", []interface{}{upstreamHttp2Map}) + } + + if zoneSetting.ForceRedirect != nil { + forceRedirectMap := map[string]interface{}{} + if zoneSetting.ForceRedirect.Switch != nil { + forceRedirectMap["switch"] = zoneSetting.ForceRedirect.Switch + } + if zoneSetting.ForceRedirect.RedirectStatusCode != nil { + forceRedirectMap["redirect_status_code"] = zoneSetting.ForceRedirect.RedirectStatusCode + } + + _ = d.Set("force_redirect", []interface{}{forceRedirectMap}) + } + + if zoneSetting.Https != nil { + httpsMap := map[string]interface{}{} + if zoneSetting.Https.Http2 != nil { + httpsMap["http2"] = zoneSetting.Https.Http2 + } + if zoneSetting.Https.OcspStapling != nil { + httpsMap["ocsp_stapling"] = zoneSetting.Https.OcspStapling + } + if zoneSetting.Https.TlsVersion != nil { + httpsMap["tls_version"] = zoneSetting.Https.TlsVersion + } + if zoneSetting.Https.Hsts != nil { + hstsMap := map[string]interface{}{} + if zoneSetting.Https.Hsts.Switch != nil { + hstsMap["switch"] = zoneSetting.Https.Hsts.Switch + } + if zoneSetting.Https.Hsts.MaxAge != nil { + hstsMap["max_age"] = zoneSetting.Https.Hsts.MaxAge + } + if zoneSetting.Https.Hsts.IncludeSubDomains != nil { + hstsMap["include_sub_domains"] = zoneSetting.Https.Hsts.IncludeSubDomains + } + if zoneSetting.Https.Hsts.Preload != nil { + hstsMap["preload"] = zoneSetting.Https.Hsts.Preload + } + + httpsMap["hsts"] = []interface{}{hstsMap} + } + + _ = d.Set("https", []interface{}{httpsMap}) + } + + if zoneSetting.Origin != nil { + originMap := map[string]interface{}{} + if zoneSetting.Origin.OriginPullProtocol != nil { + originMap["origin_pull_protocol"] = zoneSetting.Origin.OriginPullProtocol + } + + _ = d.Set("origin", []interface{}{originMap}) + } + + if zoneSetting.SmartRouting != nil { + smartRoutingMap := map[string]interface{}{} + if zoneSetting.SmartRouting.Switch != nil { + smartRoutingMap["switch"] = zoneSetting.SmartRouting.Switch + } + + _ = d.Set("smart_routing", []interface{}{smartRoutingMap}) + } + + if zoneSetting.WebSocket != nil { + webSocketMap := map[string]interface{}{} + if zoneSetting.WebSocket.Switch != nil { + webSocketMap["switch"] = zoneSetting.WebSocket.Switch + } + if zoneSetting.WebSocket.Timeout != nil { + webSocketMap["timeout"] = zoneSetting.WebSocket.Timeout + } + + _ = d.Set("web_socket", []interface{}{webSocketMap}) + } + + if zoneSetting.ClientIpHeader != nil { + clientIpHeaderMap := map[string]interface{}{} + if zoneSetting.ClientIpHeader.Switch != nil { + clientIpHeaderMap["switch"] = zoneSetting.ClientIpHeader.Switch + } + if zoneSetting.ClientIpHeader.HeaderName != nil { + clientIpHeaderMap["header_name"] = zoneSetting.ClientIpHeader.HeaderName + } + + _ = d.Set("client_ip_header", []interface{}{clientIpHeaderMap}) + } + + if zoneSetting.CachePrefresh != nil { + cachePrefreshMap := map[string]interface{}{} + if zoneSetting.CachePrefresh.Switch != nil { + cachePrefreshMap["switch"] = zoneSetting.CachePrefresh.Switch + } + if zoneSetting.CachePrefresh.Percent != nil { + cachePrefreshMap["percent"] = zoneSetting.CachePrefresh.Percent + } + + _ = d.Set("cache_prefresh", []interface{}{cachePrefreshMap}) + } + + return nil +} + +func resourceTencentCloudTeoZoneSettingUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone_setting.update")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + + var ( + request = teo.NewModifyZoneSettingRequest() + ) + + if v, ok := d.GetOk("zone_id"); ok { + request.ZoneId = helper.String(v.(string)) + } + + if dMap, ok := helper.InterfacesHeadMap(d, "cache"); ok { + cacheConfig := teo.CacheConfig{} + if CacheMap, ok := helper.InterfaceToMap(dMap, "cache"); ok { + cacheConfigCache := teo.CacheConfigCache{} + if v, ok := CacheMap["switch"]; ok { + cacheConfigCache.Switch = helper.String(v.(string)) + } + if v, ok := CacheMap["cache_time"]; ok { + cacheConfigCache.CacheTime = helper.IntInt64(v.(int)) + } + if v, ok := CacheMap["ignore_cache_control"]; ok { + cacheConfigCache.IgnoreCacheControl = helper.String(v.(string)) + } + cacheConfig.Cache = &cacheConfigCache + } + if NoCacheMap, ok := helper.InterfaceToMap(dMap, "no_cache"); ok { + cacheConfigNoCache := teo.CacheConfigNoCache{} + if v, ok := NoCacheMap["switch"]; ok { + cacheConfigNoCache.Switch = helper.String(v.(string)) + } + cacheConfig.NoCache = &cacheConfigNoCache + } + if FollowOriginMap, ok := helper.InterfaceToMap(dMap, "follow_origin"); ok { + cacheConfigFollowOrigin := teo.CacheConfigFollowOrigin{} + if v, ok := FollowOriginMap["switch"]; ok { + cacheConfigFollowOrigin.Switch = helper.String(v.(string)) + } + cacheConfig.FollowOrigin = &cacheConfigFollowOrigin + } + + request.Cache = &cacheConfig + } + + if dMap, ok := helper.InterfacesHeadMap(d, "cache_key"); ok { + cacheKey := teo.CacheKey{} + if v, ok := dMap["full_url_cache"]; ok { + cacheKey.FullUrlCache = helper.String(v.(string)) + } + if v, ok := dMap["ignore_case"]; ok { + cacheKey.IgnoreCase = helper.String(v.(string)) + } + if QueryStringMap, ok := helper.InterfaceToMap(dMap, "query_string"); ok { + queryString := teo.QueryString{} + if v, ok := QueryStringMap["switch"]; ok { + queryString.Switch = helper.String(v.(string)) + } + if v, ok := QueryStringMap["action"]; ok { + queryString.Action = helper.String(v.(string)) + } + if v, ok := QueryStringMap["value"]; ok { + valueSet := v.(*schema.Set).List() + for i := range valueSet { + value := valueSet[i].(string) + queryString.Value = append(queryString.Value, &value) + } + } + cacheKey.QueryString = &queryString + } + + request.CacheKey = &cacheKey + } + + if dMap, ok := helper.InterfacesHeadMap(d, "max_age"); ok { + maxAge := teo.MaxAge{} + if v, ok := dMap["max_age_time"]; ok { + maxAge.MaxAgeTime = helper.IntInt64(v.(int)) + } + if v, ok := dMap["follow_origin"]; ok { + maxAge.FollowOrigin = helper.String(v.(string)) + } + + request.MaxAge = &maxAge + } + + if dMap, ok := helper.InterfacesHeadMap(d, "offline_cache"); ok { + offlineCache := teo.OfflineCache{} + if v, ok := dMap["switch"]; ok { + offlineCache.Switch = helper.String(v.(string)) + } + + request.OfflineCache = &offlineCache + } + + if dMap, ok := helper.InterfacesHeadMap(d, "quic"); ok { + quic := teo.Quic{} + if v, ok := dMap["switch"]; ok { + quic.Switch = helper.String(v.(string)) + } + + request.Quic = &quic + } + + if dMap, ok := helper.InterfacesHeadMap(d, "post_max_size"); ok { + postMaxSize := teo.PostMaxSize{} + if v, ok := dMap["switch"]; ok { + postMaxSize.Switch = helper.String(v.(string)) + } + if v, ok := dMap["max_size"]; ok { + postMaxSize.MaxSize = helper.IntInt64(v.(int)) + } + + request.PostMaxSize = &postMaxSize + } + + if dMap, ok := helper.InterfacesHeadMap(d, "compression"); ok { + compression := teo.Compression{} + if v, ok := dMap["switch"]; ok { + compression.Switch = helper.String(v.(string)) + } + + request.Compression = &compression + } + + if dMap, ok := helper.InterfacesHeadMap(d, "upstream_http2"); ok { + upstreamHttp2 := teo.UpstreamHttp2{} + if v, ok := dMap["switch"]; ok { + upstreamHttp2.Switch = helper.String(v.(string)) + } + + request.UpstreamHttp2 = &upstreamHttp2 + } + + if dMap, ok := helper.InterfacesHeadMap(d, "force_redirect"); ok { + forceRedirect := teo.ForceRedirect{} + if v, ok := dMap["switch"]; ok { + forceRedirect.Switch = helper.String(v.(string)) + } + if v, ok := dMap["redirect_status_code"]; ok { + forceRedirect.RedirectStatusCode = helper.IntInt64(v.(int)) + } + + request.ForceRedirect = &forceRedirect + } + + if dMap, ok := helper.InterfacesHeadMap(d, "https"); ok { + https := teo.Https{} + if v, ok := dMap["http2"]; ok { + https.Http2 = helper.String(v.(string)) + } + if v, ok := dMap["ocsp_stapling"]; ok { + https.OcspStapling = helper.String(v.(string)) + } + if v, ok := dMap["tls_version"]; ok { + tlsVersionSet := v.(*schema.Set).List() + for i := range tlsVersionSet { + tlsVersion := tlsVersionSet[i].(string) + https.TlsVersion = append(https.TlsVersion, &tlsVersion) + } + } + if HstsMap, ok := helper.InterfaceToMap(dMap, "hsts"); ok { + hsts := teo.Hsts{} + if v, ok := HstsMap["switch"]; ok { + hsts.Switch = helper.String(v.(string)) + } + if v, ok := HstsMap["max_age"]; ok { + hsts.MaxAge = helper.IntInt64(v.(int)) + } + if v, ok := HstsMap["include_sub_domains"]; ok { + hsts.IncludeSubDomains = helper.String(v.(string)) + } + if v, ok := HstsMap["preload"]; ok { + hsts.Preload = helper.String(v.(string)) + } + https.Hsts = &hsts + } + + request.Https = &https + } + + if dMap, ok := helper.InterfacesHeadMap(d, "origin"); ok { + origin := teo.Origin{} + if v, ok := dMap["origin_pull_protocol"]; ok { + origin.OriginPullProtocol = helper.String(v.(string)) + } + + request.Origin = &origin + } + + if dMap, ok := helper.InterfacesHeadMap(d, "smart_routing"); ok { + smartRouting := teo.SmartRouting{} + if v, ok := dMap["switch"]; ok { + smartRouting.Switch = helper.String(v.(string)) + } + + request.SmartRouting = &smartRouting + } + + if dMap, ok := helper.InterfacesHeadMap(d, "web_socket"); ok { + webSocket := teo.WebSocket{} + if v, ok := dMap["switch"]; ok { + webSocket.Switch = helper.String(v.(string)) + } + if v, ok := dMap["timeout"]; ok { + webSocket.Timeout = helper.IntInt64(v.(int)) + } + + request.WebSocket = &webSocket + } + + if dMap, ok := helper.InterfacesHeadMap(d, "client_ip_header"); ok { + clientIp := teo.ClientIp{} + if v, ok := dMap["switch"]; ok { + clientIp.Switch = helper.String(v.(string)) + } + if v, ok := dMap["header_name"]; ok { + clientIp.HeaderName = helper.String(v.(string)) + } + + request.ClientIpHeader = &clientIp + } + + if dMap, ok := helper.InterfacesHeadMap(d, "cache_prefresh"); ok { + cachePrefresh := teo.CachePrefresh{} + if v, ok := dMap["switch"]; ok { + cachePrefresh.Switch = helper.String(v.(string)) + } + if v, ok := dMap["percent"]; ok { + cachePrefresh.Percent = helper.IntInt64(v.(int)) + } + + request.CachePrefresh = &cachePrefresh + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseTeoClient().ModifyZoneSetting(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo zoneSetting failed, reason:%+v", logId, err) + return err + } + + return resourceTencentCloudTeoZoneSettingRead(d, meta) +} + +func resourceTencentCloudTeoZoneSettingDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_teo_zone_setting.delete")() + defer inconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/resource_tc_teo_zone_setting_test.go b/tencentcloud/resource_tc_teo_zone_setting_test.go new file mode 100644 index 0000000000..237672d263 --- /dev/null +++ b/tencentcloud/resource_tc_teo_zone_setting_test.go @@ -0,0 +1,127 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoZoneSetting_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoZoneSetting, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_zone_setting.zone_setting", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_zone_setting.zone_setting", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoZoneSetting = ` + +resource "tencentcloud_teo_zone_setting" "zone_setting" { + zone_id = tencentcloud_teo_zone.zone.id + + cache { + follow_origin { + switch = "off" + } + + no_cache { + switch = "off" + } + } + + cache_key { + full_url_cache = "off" + ignore_case = "on" + + query_string { + action = "excludeCustom" + switch = "on" + value = ["test", "apple"] + } + } + + cache_prefresh { + percent = 90 + switch = "off" + } + + client_ip_header { + switch = "off" + } + + compression { + switch = "off" + } + + force_redirect { + redirect_status_code = 302 + switch = "on" + } + + https { + http2 = "on" + ocsp_stapling = "off" + tls_version = [ + "TLSv1.2", + "TLSv1.3", + ] + + hsts { + include_sub_domains = "off" + max_age = 0 + preload = "off" + switch = "off" + } + } + + max_age { + follow_origin = "off" + max_age_time = 600 + } + + offline_cache { + switch = "off" + } + + origin { + origin_pull_protocol = "follow" + } + + post_max_size { + max_size = 524288000 + switch = "on" + } + + quic { + switch = "on" + } + + smart_routing { + switch = "on" + } + + upstream_http2 { + switch = "off" + } + + web_socket { + switch = "off" + timeout = 30 + } +} + +` diff --git a/tencentcloud/resource_tc_teo_zone_test.go b/tencentcloud/resource_tc_teo_zone_test.go new file mode 100644 index 0000000000..0292cbda47 --- /dev/null +++ b/tencentcloud/resource_tc_teo_zone_test.go @@ -0,0 +1,46 @@ +package tencentcloud + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccTencentCloudNeedFixTeoZone_basic(t *testing.T) { + t.Parallel() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoZone, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("tencentcloud_teo_zone.zone", "id"), + ), + }, + { + ResourceName: "tencentcloud_teo_zone.zone", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccTeoZone = ` + +resource "tencentcloud_teo_zone" "zone" { + name = "sfurnace.work" + plan_type = "ent_cm_with_bot" + type = "full" + paused = false + cname_speed_up = "enabled" + + # vanity_name_servers { + # switch = "on" + # servers = ["2.2.2.2"] + # } +} + +` diff --git a/tencentcloud/service_tencentcloud_teo.go b/tencentcloud/service_tencentcloud_teo.go new file mode 100644 index 0000000000..e224a2ef20 --- /dev/null +++ b/tencentcloud/service_tencentcloud_teo.go @@ -0,0 +1,758 @@ +package tencentcloud + +import ( + "context" + "log" + "strconv" + + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" + + teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/connectivity" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/ratelimit" +) + +type TeoService struct { + client *connectivity.TencentCloudClient +} + +func (me *TeoService) DescribeTeoZone(ctx context.Context, zoneId string) (zone *teo.DescribeZoneDetailsResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeZoneDetailsRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.Id = &zoneId + + response, err := me.client.UseTeoClient().DescribeZoneDetails(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + zone = response.Response + return +} + +func (me *TeoService) DeleteTeoZoneById(ctx context.Context, zoneId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteZoneRequest() + request.Id = &zoneId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteZone(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoDnsRecord(ctx context.Context, zoneId, name string) (dnsRecord *teo.DnsRecord, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeDnsRecordsRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + + request.ZoneId = &zoneId + request.Filters = append( + request.Filters, + &teo.DnsRecordFilter{ + Name: helper.String("name"), + Values: []*string{&name}, + }, + ) + ratelimit.Check(request.GetAction()) + + var offset int64 = 0 + var pageSize int64 = 100 + instances := make([]*teo.DnsRecord, 0) + + for { + request.Offset = &offset + request.Limit = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DescribeDnsRecords(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || len(response.Response.Records) < 1 { + break + } + instances = append(instances, response.Response.Records...) + if len(response.Response.Records) < int(pageSize) { + break + } + offset += pageSize + } + + if len(instances) < 1 { + return + } + dnsRecord = instances[0] + + return + +} + +func (me *TeoService) DeleteTeoDnsRecordById(ctx context.Context, zoneId, dnsRecordId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteDnsRecordsRequest() + request.Ids = []*string{&dnsRecordId} + request.ZoneId = &zoneId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteDnsRecords(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoLoadBalancing(ctx context.Context, zoneId string, loadBalancingId string) (loadBalancing *teo.DescribeLoadBalancingDetailResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeLoadBalancingDetailRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + request.LoadBalancingId = &loadBalancingId + + response, err := me.client.UseTeoClient().DescribeLoadBalancingDetail(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + loadBalancing = response.Response + return +} + +func (me *TeoService) DeleteTeoLoadBalancingById(ctx context.Context, zoneId string, loadBalancingId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteLoadBalancingRequest() + request.ZoneId = &zoneId + request.LoadBalancingId = &loadBalancingId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteLoadBalancing(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoOriginGroup(ctx context.Context, zoneId string, originGroupId string) (originGroup *teo.DescribeOriginGroupDetailResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeOriginGroupDetailRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + request.OriginId = &originGroupId + + response, err := me.client.UseTeoClient().DescribeOriginGroupDetail(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + originGroup = response.Response + return +} + +func (me *TeoService) DeleteTeoOriginGroupById(ctx context.Context, zoneId string, originGroupId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteOriginGroupRequest() + request.ZoneId = &zoneId + request.OriginId = &originGroupId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteOriginGroup(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoRuleEngine(ctx context.Context, zoneId, ruleId string) (ruleEngine *teo.RuleSettingDetail, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeRulesRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + + request.ZoneId = &zoneId + request.Filters = append( + request.Filters, + &teo.RuleFilter{ + Name: helper.String("RULE_ID"), + Values: []*string{&ruleId}, + }, + ) + ratelimit.Check(request.GetAction()) + + response, err := me.client.UseTeoClient().DescribeRules(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + instances := response.Response.RuleList + + if len(instances) < 1 { + return + } + ruleEngine = instances[0] + + return + +} + +func (me *TeoService) DeleteTeoRuleEngineById(ctx context.Context, zoneId, ruleId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteRulesRequest() + + request.ZoneId = &zoneId + request.RuleIds = []*string{&ruleId} + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteRules(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoApplicationProxy(ctx context.Context, zoneId, proxyId string) (applicationProxy *teo.DescribeApplicationProxyDetailResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeApplicationProxyDetailRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + request.ProxyId = &proxyId + + response, err := me.client.UseTeoClient().DescribeApplicationProxyDetail(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + applicationProxy = response.Response + return +} + +func (me *TeoService) DeleteTeoApplicationProxyById(ctx context.Context, zoneId, proxyId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteApplicationProxyRequest() + + request.ZoneId = &zoneId + request.ProxyId = &proxyId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteApplicationProxy(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoApplicationProxyRule(ctx context.Context, zoneId, proxyId, ruleId string) (applicationProxyRule *teo.ApplicationProxyRule, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeApplicationProxyDetailRequest() + ) + + rules := make([]*teo.ApplicationProxyRule, 0) + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + request.ProxyId = &proxyId + + response, err := me.client.UseTeoClient().DescribeApplicationProxyDetail(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + rules = response.Response.Rule + for _, rule := range rules { + if *rule.RuleId == ruleId { + applicationProxyRule = rule + return + } + } + return +} + +func (me *TeoService) DeleteTeoApplicationProxyRuleById(ctx context.Context, zoneId, proxyId, ruleId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewDeleteApplicationProxyRuleRequest() + + request.ZoneId = &zoneId + request.ProxyId = &proxyId + request.RuleId = &ruleId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DeleteApplicationProxyRule(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeTeoZoneSetting(ctx context.Context, zoneId string) (zoneSetting *teo.DescribeZoneSettingResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeZoneSettingRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + + response, err := me.client.UseTeoClient().DescribeZoneSetting(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + zoneSetting = response.Response + return +} + +func (me *TeoService) DescribeTeoSecurityPolicy(ctx context.Context, zoneId, entity string) (securityPolicy *teo.DescribeSecurityPolicyResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeSecurityPolicyRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + request.Entity = &entity + + response, err := me.client.UseTeoClient().DescribeSecurityPolicy(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + securityPolicy = response.Response + return +} + +func (me *TeoService) DescribeTeoHostCertificate(ctx context.Context, zoneId, host string) (hostCertificate *teo.HostCertSetting, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeHostsCertificateRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + + request.ZoneId = &zoneId + + request.Filters = append( + request.Filters, + &teo.CertFilter{ + Name: helper.String("host"), + Values: []*string{&host}, + }, + ) + ratelimit.Check(request.GetAction()) + + var offset int64 = 0 + var pageSize int64 = 100 + instances := make([]*teo.HostCertSetting, 0) + + for { + request.Offset = &offset + request.Limit = &pageSize + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().DescribeHostsCertificate(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if response == nil || len(response.Response.Hosts) < 1 { + break + } + instances = append(instances, response.Response.Hosts...) + if len(response.Response.Hosts) < int(pageSize) { + break + } + offset += pageSize + } + + if len(instances) < 1 { + return + } + hostCertificate = instances[0] + + return +} + +func (me *TeoService) DescribeTeoDnsSec(ctx context.Context, zoneId string) (dnsSec *teo.DescribeDnssecResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeDnssecRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.Id = &zoneId + + response, err := me.client.UseTeoClient().DescribeDnssec(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + dnsSec = response.Response + return +} + +func (me *TeoService) DescribeTeoDefaultCertificate(ctx context.Context, zoneId string) (defaultCertificate *teo.DefaultServerCertInfo, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeDefaultCertificatesRequest() + ) + + defaultCertificates := make([]*teo.DefaultServerCertInfo, 0) + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + request.ZoneId = &zoneId + + response, err := me.client.UseTeoClient().DescribeDefaultCertificates(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + defaultCertificates = response.Response.CertInfo + + for _, cert := range defaultCertificates { + if *cert.CertId != "" { + defaultCertificate = cert + return + } + } + return +} + +func (me *TeoService) DescribeTeoDdosPolicy(ctx context.Context, zoneId, policyId string) (ddosPolicy *teo.DescribeDDoSPolicyResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeDDoSPolicyRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + + policyId64, errRet := strconv.ParseInt(policyId, 10, 64) + if errRet != nil { + log.Printf("[DEBUG]%s api[%s] error, Type conversion failed, [%s] conversion int64 failed\n", + logId, request.GetAction(), policyId) + return nil, errRet + } + + request.ZoneId = &zoneId + request.PolicyId = &policyId64 + + response, err := me.client.UseTeoClient().DescribeDDoSPolicy(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + ddosPolicy = response.Response + return +} + +func (me *TeoService) DescribeZoneDDoSPolicy(ctx context.Context, zoneId string) (ddosPolicy *teo.DescribeZoneDDoSPolicyResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeZoneDDoSPolicyRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + + if zoneId != "" { + request.ZoneId = &zoneId + } + + response, err := me.client.UseTeoClient().DescribeZoneDDoSPolicy(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + ddosPolicy = response.Response + return +} + +func (me *TeoService) DeleteTeoDdosPolicyById(ctx context.Context, zoneId, policyId string) (errRet error) { + logId := getLogId(ctx) + + request := teo.NewModifyDDoSPolicyRequest() + + policyId64, errRet := strconv.ParseInt(policyId, 10, 64) + if errRet != nil { + log.Printf("[DEBUG]%s api[%s] error, Type conversion failed, [%s] conversion int64 failed\n", + logId, request.GetAction(), policyId) + return errRet + } + + request.ZoneId = &zoneId + request.PolicyId = &policyId64 + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "delete object", request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseTeoClient().ModifyDDoSPolicy(request) + if err != nil { + errRet = err + return err + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + +func (me *TeoService) DescribeAvailablePlans(ctx context.Context) (availablePlans *teo.DescribeAvailablePlansResponseParams, errRet error) { + var ( + logId = getLogId(ctx) + request = teo.NewDescribeAvailablePlansRequest() + ) + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, "query object", request.ToJsonString(), errRet.Error()) + } + }() + + response, err := me.client.UseTeoClient().DescribeAvailablePlans(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + availablePlans = response.Response + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go index f636d5a44d..c0e8aba3be 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go @@ -121,7 +121,7 @@ func (c *Client) sendWithoutSignature(request tchttp.Request, response tchttp.Re if c.region != "" { headers["X-TC-Region"] = c.region } - if c.credential.GetToken() != "" { + if c.credential != nil && c.credential.GetToken() != "" { headers["X-TC-Token"] = c.credential.GetToken() } if request.GetHttpMethod() == "GET" { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go index 78b619bbf7..6c0b2f976f 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -265,7 +265,7 @@ func CompleteCommonParams(request Request, region string) { params["Action"] = request.GetAction() params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) params["Nonce"] = strconv.Itoa(rand.Int()) - params["RequestClient"] = "SDK_GO_1.0.480" + params["RequestClient"] = "SDK_GO_1.0.486" } func ConstructParams(req Request) (err error) { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/oidc_role_arn_provider.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/oidc_role_arn_provider.go new file mode 100644 index 0000000000..8f42fb6430 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/oidc_role_arn_provider.go @@ -0,0 +1,135 @@ +package common + +import ( + "encoding/json" + "errors" + "io/ioutil" + "os" + "strconv" + "time" + + tcerr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +) + +type OIDCRoleArnProvider struct { + region string + providerId string + webIdentityToken string + roleArn string + roleSessionName string + durationSeconds int64 +} + +type oidcStsRsp struct { + Response struct { + Credentials struct { + Token string `json:"Token"` + TmpSecretId string `json:"TmpSecretId"` + TmpSecretKey string `json:"TmpSecretKey"` + } `json:"Credentials"` + ExpiredTime int `json:"ExpiredTime"` + Expiration time.Time `json:"Expiration"` + RequestId string `json:"RequestId"` + } `json:"Response"` +} + +func NewOIDCRoleArnProvider(region, providerId, webIdentityToken, roleArn, roleSessionName string, durationSeconds int64) *OIDCRoleArnProvider { + return &OIDCRoleArnProvider{ + region: region, + providerId: providerId, + webIdentityToken: webIdentityToken, + roleArn: roleArn, + roleSessionName: roleSessionName, + durationSeconds: durationSeconds, + } +} + +// DefaultTkeOIDCRoleArnProvider returns a OIDCRoleArnProvider with some default options: +// 1. providerId will be environment var TKE_PROVIDER_ID +// 2. webIdentityToken will be the content of file specified by env TKE_IDENTITY_TOKEN_FILE +// 3. roleArn will be env TKE_ROLE_ARN +// 4. roleSessionName will be "tencentcloud-go-sdk-" + timestamp +// 5. durationSeconds will be 7200s +func DefaultTkeOIDCRoleArnProvider() (*OIDCRoleArnProvider, error) { + reg := os.Getenv("TKE_REGION") + if reg == "" { + return nil, errors.New("env TKE_REGION not exist") + } + + providerId := os.Getenv("TKE_PROVIDER_ID") + if providerId == "" { + return nil, errors.New("env TKE_PROVIDER_ID not exist") + } + + tokenFile := os.Getenv("TKE_IDENTITY_TOKEN_FILE") + if tokenFile == "" { + return nil, errors.New("env TKE_IDENTITY_TOKEN_FILE not exist") + } + tokenBytes, err := ioutil.ReadFile(tokenFile) + if err != nil { + return nil, err + } + + roleArn := os.Getenv("TKE_ROLE_ARN") + if roleArn == "" { + return nil, errors.New("env TKE_ROLE_ARN not exist") + } + + sessionName := defaultSessionName + strconv.FormatInt(time.Now().UnixNano()/1000, 10) + + return NewOIDCRoleArnProvider(reg, providerId, string(tokenBytes), roleArn, sessionName, defaultDurationSeconds), nil +} + +func (r *OIDCRoleArnProvider) GetCredential() (CredentialIface, error) { + const ( + service = "sts" + version = "2018-08-13" + action = "AssumeRoleWithWebIdentity" + ) + if r.durationSeconds > 43200 || r.durationSeconds <= 0 { + return nil, tcerr.NewTencentCloudSDKError(creErr, "AssumeRoleWithWebIdentity durationSeconds should be in the range of 0~43200s", "") + } + cpf := profile.NewClientProfile() + cpf.HttpProfile.Endpoint = endpoint + cpf.HttpProfile.ReqMethod = "POST" + + client := NewCommonClient(nil, r.region, cpf) + request := tchttp.NewCommonRequest(service, version, action) + request.SetSkipSign(true) + + params := map[string]interface{}{ + "ProviderId": r.providerId, + "WebIdentityToken": r.webIdentityToken, + "RoleArn": r.roleArn, + "RoleSessionName": r.roleSessionName, + "DurationSeconds": r.durationSeconds, + } + err := request.SetActionParameters(params) + if err != nil { + return nil, err + } + + response := tchttp.NewCommonResponse() + err = client.Send(request, response) + if err != nil { + return nil, err + } + rspSt := new(oidcStsRsp) + + if err = json.Unmarshal(response.GetBody(), rspSt); err != nil { + return nil, tcerr.NewTencentCloudSDKError(creErr, err.Error(), "") + } + + return &RoleArnCredential{ + roleArn: r.roleArn, + roleSessionName: r.roleSessionName, + durationSeconds: r.durationSeconds, + expiredTime: int64(rspSt.Response.ExpiredTime), + token: rspSt.Response.Credentials.Token, + tmpSecretId: rspSt.Response.Credentials.TmpSecretId, + tmpSecretKey: rspSt.Response.Credentials.TmpSecretKey, + source: r, + }, nil +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/role_arn_credential.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/role_arn_credential.go index 392c337834..3f71a02171 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/role_arn_credential.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/role_arn_credential.go @@ -13,7 +13,7 @@ type RoleArnCredential struct { token string tmpSecretId string tmpSecretKey string - source *RoleArnProvider + source Provider } func (c *RoleArnCredential) GetSecretId() string { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/LICENSE b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/LICENSE new file mode 100644 index 0000000000..efc75a2253 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2017-2018 Tencent Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/client.go new file mode 100644 index 0000000000..946461b88f --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/client.go @@ -0,0 +1,5002 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20220106 + +import ( + "context" + "errors" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" +) + +const APIVersion = "2022-01-06" + +type Client struct { + common.Client +} + +// Deprecated +func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { + cpf := profile.NewClientProfile() + client = &Client{} + client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf) + return +} + +func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error) { + client = &Client{} + client.Init(region). + WithCredential(credential). + WithProfile(clientProfile) + return +} + + +func NewCheckCertificateRequest() (request *CheckCertificateRequest) { + request = &CheckCertificateRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CheckCertificate") + + + return +} + +func NewCheckCertificateResponse() (response *CheckCertificateResponse) { + response = &CheckCertificateResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CheckCertificate +// 校验证书 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDCERTINFO = "InvalidParameter.InvalidCertInfo" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) CheckCertificate(request *CheckCertificateRequest) (response *CheckCertificateResponse, err error) { + return c.CheckCertificateWithContext(context.Background(), request) +} + +// CheckCertificate +// 校验证书 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDCERTINFO = "InvalidParameter.InvalidCertInfo" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) CheckCertificateWithContext(ctx context.Context, request *CheckCertificateRequest) (response *CheckCertificateResponse, err error) { + if request == nil { + request = NewCheckCertificateRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CheckCertificate require credential") + } + + request.SetContext(ctx) + + response = NewCheckCertificateResponse() + err = c.Send(request, response) + return +} + +func NewCreateApplicationProxyRequest() (request *CreateApplicationProxyRequest) { + request = &CreateApplicationProxyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateApplicationProxy") + + + return +} + +func NewCreateApplicationProxyResponse() (response *CreateApplicationProxyResponse) { + response = &CreateApplicationProxyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateApplicationProxy +// 创建应用代理 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// LIMITEXCEEDED = "LimitExceeded" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINSUFFICIENT = "ResourceInsufficient" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) CreateApplicationProxy(request *CreateApplicationProxyRequest) (response *CreateApplicationProxyResponse, err error) { + return c.CreateApplicationProxyWithContext(context.Background(), request) +} + +// CreateApplicationProxy +// 创建应用代理 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// LIMITEXCEEDED = "LimitExceeded" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINSUFFICIENT = "ResourceInsufficient" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) CreateApplicationProxyWithContext(ctx context.Context, request *CreateApplicationProxyRequest) (response *CreateApplicationProxyResponse, err error) { + if request == nil { + request = NewCreateApplicationProxyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateApplicationProxy require credential") + } + + request.SetContext(ctx) + + response = NewCreateApplicationProxyResponse() + err = c.Send(request, response) + return +} + +func NewCreateApplicationProxyRuleRequest() (request *CreateApplicationProxyRuleRequest) { + request = &CreateApplicationProxyRuleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateApplicationProxyRule") + + + return +} + +func NewCreateApplicationProxyRuleResponse() (response *CreateApplicationProxyRuleResponse) { + response = &CreateApplicationProxyRuleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateApplicationProxyRule +// 创建应用代理规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) CreateApplicationProxyRule(request *CreateApplicationProxyRuleRequest) (response *CreateApplicationProxyRuleResponse, err error) { + return c.CreateApplicationProxyRuleWithContext(context.Background(), request) +} + +// CreateApplicationProxyRule +// 创建应用代理规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) CreateApplicationProxyRuleWithContext(ctx context.Context, request *CreateApplicationProxyRuleRequest) (response *CreateApplicationProxyRuleResponse, err error) { + if request == nil { + request = NewCreateApplicationProxyRuleRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateApplicationProxyRule require credential") + } + + request.SetContext(ctx) + + response = NewCreateApplicationProxyRuleResponse() + err = c.Send(request, response) + return +} + +func NewCreateApplicationProxyRulesRequest() (request *CreateApplicationProxyRulesRequest) { + request = &CreateApplicationProxyRulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateApplicationProxyRules") + + + return +} + +func NewCreateApplicationProxyRulesResponse() (response *CreateApplicationProxyRulesResponse) { + response = &CreateApplicationProxyRulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateApplicationProxyRules +// 批量创建应用代理规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) CreateApplicationProxyRules(request *CreateApplicationProxyRulesRequest) (response *CreateApplicationProxyRulesResponse, err error) { + return c.CreateApplicationProxyRulesWithContext(context.Background(), request) +} + +// CreateApplicationProxyRules +// 批量创建应用代理规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) CreateApplicationProxyRulesWithContext(ctx context.Context, request *CreateApplicationProxyRulesRequest) (response *CreateApplicationProxyRulesResponse, err error) { + if request == nil { + request = NewCreateApplicationProxyRulesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateApplicationProxyRules require credential") + } + + request.SetContext(ctx) + + response = NewCreateApplicationProxyRulesResponse() + err = c.Send(request, response) + return +} + +func NewCreateCustomErrorPageRequest() (request *CreateCustomErrorPageRequest) { + request = &CreateCustomErrorPageRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateCustomErrorPage") + + + return +} + +func NewCreateCustomErrorPageResponse() (response *CreateCustomErrorPageResponse) { + response = &CreateCustomErrorPageResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateCustomErrorPage +// 创建自定义规则的自定义页 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) CreateCustomErrorPage(request *CreateCustomErrorPageRequest) (response *CreateCustomErrorPageResponse, err error) { + return c.CreateCustomErrorPageWithContext(context.Background(), request) +} + +// CreateCustomErrorPage +// 创建自定义规则的自定义页 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) CreateCustomErrorPageWithContext(ctx context.Context, request *CreateCustomErrorPageRequest) (response *CreateCustomErrorPageResponse, err error) { + if request == nil { + request = NewCreateCustomErrorPageRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateCustomErrorPage require credential") + } + + request.SetContext(ctx) + + response = NewCreateCustomErrorPageResponse() + err = c.Send(request, response) + return +} + +func NewCreateDnsRecordRequest() (request *CreateDnsRecordRequest) { + request = &CreateDnsRecordRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateDnsRecord") + + + return +} + +func NewCreateDnsRecordResponse() (response *CreateDnsRecordResponse) { + response = &CreateDnsRecordResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateDnsRecord +// 创建 DNS 记录 +// +// 可能返回的错误码: +// INVALIDPARAMETERVALUE_CONFLICTRECORD = "InvalidParameterValue.ConflictRecord" +// INVALIDPARAMETERVALUE_CONFLICTWITHDNSSEC = "InvalidParameterValue.ConflictWithDNSSEC" +// INVALIDPARAMETERVALUE_CONFLICTWITHLBRECORD = "InvalidParameterValue.ConflictWithLBRecord" +// INVALIDPARAMETERVALUE_CONFLICTWITHNSRECORD = "InvalidParameterValue.ConflictWithNSRecord" +// INVALIDPARAMETERVALUE_INVALIDDNSCONTENT = "InvalidParameterValue.InvalidDNSContent" +// INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" +// INVALIDPARAMETERVALUE_INVALIDPROXYNAME = "InvalidParameterValue.InvalidProxyName" +// INVALIDPARAMETERVALUE_INVALIDPROXYORIGIN = "InvalidParameterValue.InvalidProxyOrigin" +// INVALIDPARAMETERVALUE_RECORDALREADYEXISTS = "InvalidParameterValue.RecordAlreadyExists" +// INVALIDPARAMETERVALUE_RECORDNOTALLOWED = "InvalidParameterValue.RecordNotAllowed" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_DOMAINNOICP = "OperationDenied.DomainNoICP" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreateDnsRecord(request *CreateDnsRecordRequest) (response *CreateDnsRecordResponse, err error) { + return c.CreateDnsRecordWithContext(context.Background(), request) +} + +// CreateDnsRecord +// 创建 DNS 记录 +// +// 可能返回的错误码: +// INVALIDPARAMETERVALUE_CONFLICTRECORD = "InvalidParameterValue.ConflictRecord" +// INVALIDPARAMETERVALUE_CONFLICTWITHDNSSEC = "InvalidParameterValue.ConflictWithDNSSEC" +// INVALIDPARAMETERVALUE_CONFLICTWITHLBRECORD = "InvalidParameterValue.ConflictWithLBRecord" +// INVALIDPARAMETERVALUE_CONFLICTWITHNSRECORD = "InvalidParameterValue.ConflictWithNSRecord" +// INVALIDPARAMETERVALUE_INVALIDDNSCONTENT = "InvalidParameterValue.InvalidDNSContent" +// INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" +// INVALIDPARAMETERVALUE_INVALIDPROXYNAME = "InvalidParameterValue.InvalidProxyName" +// INVALIDPARAMETERVALUE_INVALIDPROXYORIGIN = "InvalidParameterValue.InvalidProxyOrigin" +// INVALIDPARAMETERVALUE_RECORDALREADYEXISTS = "InvalidParameterValue.RecordAlreadyExists" +// INVALIDPARAMETERVALUE_RECORDNOTALLOWED = "InvalidParameterValue.RecordNotAllowed" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_DOMAINNOICP = "OperationDenied.DomainNoICP" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreateDnsRecordWithContext(ctx context.Context, request *CreateDnsRecordRequest) (response *CreateDnsRecordResponse, err error) { + if request == nil { + request = NewCreateDnsRecordRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateDnsRecord require credential") + } + + request.SetContext(ctx) + + response = NewCreateDnsRecordResponse() + err = c.Send(request, response) + return +} + +func NewCreateLoadBalancingRequest() (request *CreateLoadBalancingRequest) { + request = &CreateLoadBalancingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateLoadBalancing") + + + return +} + +func NewCreateLoadBalancingResponse() (response *CreateLoadBalancingResponse) { + response = &CreateLoadBalancingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateLoadBalancing +// 创建负载均衡 +// +// 可能返回的错误码: +// LIMITEXCEEDED = "LimitExceeded" +func (c *Client) CreateLoadBalancing(request *CreateLoadBalancingRequest) (response *CreateLoadBalancingResponse, err error) { + return c.CreateLoadBalancingWithContext(context.Background(), request) +} + +// CreateLoadBalancing +// 创建负载均衡 +// +// 可能返回的错误码: +// LIMITEXCEEDED = "LimitExceeded" +func (c *Client) CreateLoadBalancingWithContext(ctx context.Context, request *CreateLoadBalancingRequest) (response *CreateLoadBalancingResponse, err error) { + if request == nil { + request = NewCreateLoadBalancingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateLoadBalancing require credential") + } + + request.SetContext(ctx) + + response = NewCreateLoadBalancingResponse() + err = c.Send(request, response) + return +} + +func NewCreateOriginGroupRequest() (request *CreateOriginGroupRequest) { + request = &CreateOriginGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateOriginGroup") + + + return +} + +func NewCreateOriginGroupResponse() (response *CreateOriginGroupResponse) { + response = &CreateOriginGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateOriginGroup +// 源站组创建 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) CreateOriginGroup(request *CreateOriginGroupRequest) (response *CreateOriginGroupResponse, err error) { + return c.CreateOriginGroupWithContext(context.Background(), request) +} + +// CreateOriginGroup +// 源站组创建 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) CreateOriginGroupWithContext(ctx context.Context, request *CreateOriginGroupRequest) (response *CreateOriginGroupResponse, err error) { + if request == nil { + request = NewCreateOriginGroupRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateOriginGroup require credential") + } + + request.SetContext(ctx) + + response = NewCreateOriginGroupResponse() + err = c.Send(request, response) + return +} + +func NewCreatePlanForZoneRequest() (request *CreatePlanForZoneRequest) { + request = &CreatePlanForZoneRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreatePlanForZone") + + + return +} + +func NewCreatePlanForZoneResponse() (response *CreatePlanForZoneResponse) { + response = &CreatePlanForZoneResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreatePlanForZone +// 为未购买套餐的站点购买套餐 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) CreatePlanForZone(request *CreatePlanForZoneRequest) (response *CreatePlanForZoneResponse, err error) { + return c.CreatePlanForZoneWithContext(context.Background(), request) +} + +// CreatePlanForZone +// 为未购买套餐的站点购买套餐 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) CreatePlanForZoneWithContext(ctx context.Context, request *CreatePlanForZoneRequest) (response *CreatePlanForZoneResponse, err error) { + if request == nil { + request = NewCreatePlanForZoneRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreatePlanForZone require credential") + } + + request.SetContext(ctx) + + response = NewCreatePlanForZoneResponse() + err = c.Send(request, response) + return +} + +func NewCreatePrefetchTaskRequest() (request *CreatePrefetchTaskRequest) { + request = &CreatePrefetchTaskRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreatePrefetchTask") + + + return +} + +func NewCreatePrefetchTaskResponse() (response *CreatePrefetchTaskResponse) { + response = &CreatePrefetchTaskResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreatePrefetchTask +// 创建预热任务 +// +// 可能返回的错误码: +// INTERNALERROR_BACKENDERROR = "InternalError.BackendError" +// INTERNALERROR_DOMAINCONFIG = "InternalError.DomainConfig" +// INTERNALERROR_FAILEDTOGENERATEURL = "InternalError.FailedToGenerateUrl" +// INTERNALERROR_QUOTASYSTEM = "InternalError.QuotaSystem" +// INVALIDPARAMETER_DOMAINNOTFOUND = "InvalidParameter.DomainNotFound" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// INVALIDPARAMETER_TARGET = "InvalidParameter.Target" +// INVALIDPARAMETER_TASKNOTGENERATED = "InvalidParameter.TaskNotGenerated" +// INVALIDPARAMETER_UPLOADURL = "InvalidParameter.UploadUrl" +// LIMITEXCEEDED_BATCHQUOTA = "LimitExceeded.BatchQuota" +// LIMITEXCEEDED_DAILYQUOTA = "LimitExceeded.DailyQuota" +func (c *Client) CreatePrefetchTask(request *CreatePrefetchTaskRequest) (response *CreatePrefetchTaskResponse, err error) { + return c.CreatePrefetchTaskWithContext(context.Background(), request) +} + +// CreatePrefetchTask +// 创建预热任务 +// +// 可能返回的错误码: +// INTERNALERROR_BACKENDERROR = "InternalError.BackendError" +// INTERNALERROR_DOMAINCONFIG = "InternalError.DomainConfig" +// INTERNALERROR_FAILEDTOGENERATEURL = "InternalError.FailedToGenerateUrl" +// INTERNALERROR_QUOTASYSTEM = "InternalError.QuotaSystem" +// INVALIDPARAMETER_DOMAINNOTFOUND = "InvalidParameter.DomainNotFound" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// INVALIDPARAMETER_TARGET = "InvalidParameter.Target" +// INVALIDPARAMETER_TASKNOTGENERATED = "InvalidParameter.TaskNotGenerated" +// INVALIDPARAMETER_UPLOADURL = "InvalidParameter.UploadUrl" +// LIMITEXCEEDED_BATCHQUOTA = "LimitExceeded.BatchQuota" +// LIMITEXCEEDED_DAILYQUOTA = "LimitExceeded.DailyQuota" +func (c *Client) CreatePrefetchTaskWithContext(ctx context.Context, request *CreatePrefetchTaskRequest) (response *CreatePrefetchTaskResponse, err error) { + if request == nil { + request = NewCreatePrefetchTaskRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreatePrefetchTask require credential") + } + + request.SetContext(ctx) + + response = NewCreatePrefetchTaskResponse() + err = c.Send(request, response) + return +} + +func NewCreatePurgeTaskRequest() (request *CreatePurgeTaskRequest) { + request = &CreatePurgeTaskRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreatePurgeTask") + + + return +} + +func NewCreatePurgeTaskResponse() (response *CreatePurgeTaskResponse) { + response = &CreatePurgeTaskResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreatePurgeTask +// 创建清除缓存任务 +// +// 可能返回的错误码: +// INTERNALERROR_BACKENDERROR = "InternalError.BackendError" +// INTERNALERROR_DOMAINCONFIG = "InternalError.DomainConfig" +// INTERNALERROR_QUOTASYSTEM = "InternalError.QuotaSystem" +// INVALIDPARAMETER_DOMAINNOTFOUND = "InvalidParameter.DomainNotFound" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// INVALIDPARAMETER_TARGET = "InvalidParameter.Target" +// INVALIDPARAMETER_TASKNOTGENERATED = "InvalidParameter.TaskNotGenerated" +// INVALIDPARAMETER_UPLOADURL = "InvalidParameter.UploadUrl" +// LIMITEXCEEDED_BATCHQUOTA = "LimitExceeded.BatchQuota" +// LIMITEXCEEDED_DAILYQUOTA = "LimitExceeded.DailyQuota" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreatePurgeTask(request *CreatePurgeTaskRequest) (response *CreatePurgeTaskResponse, err error) { + return c.CreatePurgeTaskWithContext(context.Background(), request) +} + +// CreatePurgeTask +// 创建清除缓存任务 +// +// 可能返回的错误码: +// INTERNALERROR_BACKENDERROR = "InternalError.BackendError" +// INTERNALERROR_DOMAINCONFIG = "InternalError.DomainConfig" +// INTERNALERROR_QUOTASYSTEM = "InternalError.QuotaSystem" +// INVALIDPARAMETER_DOMAINNOTFOUND = "InvalidParameter.DomainNotFound" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// INVALIDPARAMETER_TARGET = "InvalidParameter.Target" +// INVALIDPARAMETER_TASKNOTGENERATED = "InvalidParameter.TaskNotGenerated" +// INVALIDPARAMETER_UPLOADURL = "InvalidParameter.UploadUrl" +// LIMITEXCEEDED_BATCHQUOTA = "LimitExceeded.BatchQuota" +// LIMITEXCEEDED_DAILYQUOTA = "LimitExceeded.DailyQuota" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreatePurgeTaskWithContext(ctx context.Context, request *CreatePurgeTaskRequest) (response *CreatePurgeTaskResponse, err error) { + if request == nil { + request = NewCreatePurgeTaskRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreatePurgeTask require credential") + } + + request.SetContext(ctx) + + response = NewCreatePurgeTaskResponse() + err = c.Send(request, response) + return +} + +func NewCreateRuleRequest() (request *CreateRuleRequest) { + request = &CreateRuleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateRule") + + + return +} + +func NewCreateRuleResponse() (response *CreateRuleResponse) { + response = &CreateRuleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateRule +// 规则引擎创建规则。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDRULEENGINETARGET = "InvalidParameter.InvalidRuleEngineTarget" +func (c *Client) CreateRule(request *CreateRuleRequest) (response *CreateRuleResponse, err error) { + return c.CreateRuleWithContext(context.Background(), request) +} + +// CreateRule +// 规则引擎创建规则。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDRULEENGINETARGET = "InvalidParameter.InvalidRuleEngineTarget" +func (c *Client) CreateRuleWithContext(ctx context.Context, request *CreateRuleRequest) (response *CreateRuleResponse, err error) { + if request == nil { + request = NewCreateRuleRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateRule require credential") + } + + request.SetContext(ctx) + + response = NewCreateRuleResponse() + err = c.Send(request, response) + return +} + +func NewCreateZoneRequest() (request *CreateZoneRequest) { + request = &CreateZoneRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateZone") + + + return +} + +func NewCreateZoneResponse() (response *CreateZoneResponse) { + response = &CreateZoneResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// CreateZone +// 用于用户接入新的站点 +// +// 可能返回的错误码: +// DRYRUNOPERATION = "DryRunOperation" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCEINUSE_OTHERS = "ResourceInUse.Others" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreateZone(request *CreateZoneRequest) (response *CreateZoneResponse, err error) { + return c.CreateZoneWithContext(context.Background(), request) +} + +// CreateZone +// 用于用户接入新的站点 +// +// 可能返回的错误码: +// DRYRUNOPERATION = "DryRunOperation" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCEINUSE_OTHERS = "ResourceInUse.Others" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreateZoneWithContext(ctx context.Context, request *CreateZoneRequest) (response *CreateZoneResponse, err error) { + if request == nil { + request = NewCreateZoneRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("CreateZone require credential") + } + + request.SetContext(ctx) + + response = NewCreateZoneResponse() + err = c.Send(request, response) + return +} + +func NewDeleteApplicationProxyRequest() (request *DeleteApplicationProxyRequest) { + request = &DeleteApplicationProxyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteApplicationProxy") + + + return +} + +func NewDeleteApplicationProxyResponse() (response *DeleteApplicationProxyResponse) { + response = &DeleteApplicationProxyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteApplicationProxy +// 删除应用代理 +// +// 可能返回的错误码: +// DRYRUNOPERATION = "DryRunOperation" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCEINUSE_OTHERS = "ResourceInUse.Others" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DeleteApplicationProxy(request *DeleteApplicationProxyRequest) (response *DeleteApplicationProxyResponse, err error) { + return c.DeleteApplicationProxyWithContext(context.Background(), request) +} + +// DeleteApplicationProxy +// 删除应用代理 +// +// 可能返回的错误码: +// DRYRUNOPERATION = "DryRunOperation" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCEINUSE_OTHERS = "ResourceInUse.Others" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DeleteApplicationProxyWithContext(ctx context.Context, request *DeleteApplicationProxyRequest) (response *DeleteApplicationProxyResponse, err error) { + if request == nil { + request = NewDeleteApplicationProxyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteApplicationProxy require credential") + } + + request.SetContext(ctx) + + response = NewDeleteApplicationProxyResponse() + err = c.Send(request, response) + return +} + +func NewDeleteApplicationProxyRuleRequest() (request *DeleteApplicationProxyRuleRequest) { + request = &DeleteApplicationProxyRuleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteApplicationProxyRule") + + + return +} + +func NewDeleteApplicationProxyRuleResponse() (response *DeleteApplicationProxyRuleResponse) { + response = &DeleteApplicationProxyRuleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteApplicationProxyRule +// 删除应用代理规则 +// +// 可能返回的错误码: +// DRYRUNOPERATION = "DryRunOperation" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCEINUSE_OTHERS = "ResourceInUse.Others" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DeleteApplicationProxyRule(request *DeleteApplicationProxyRuleRequest) (response *DeleteApplicationProxyRuleResponse, err error) { + return c.DeleteApplicationProxyRuleWithContext(context.Background(), request) +} + +// DeleteApplicationProxyRule +// 删除应用代理规则 +// +// 可能返回的错误码: +// DRYRUNOPERATION = "DryRunOperation" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCEINUSE_OTHERS = "ResourceInUse.Others" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DeleteApplicationProxyRuleWithContext(ctx context.Context, request *DeleteApplicationProxyRuleRequest) (response *DeleteApplicationProxyRuleResponse, err error) { + if request == nil { + request = NewDeleteApplicationProxyRuleRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteApplicationProxyRule require credential") + } + + request.SetContext(ctx) + + response = NewDeleteApplicationProxyRuleResponse() + err = c.Send(request, response) + return +} + +func NewDeleteDnsRecordsRequest() (request *DeleteDnsRecordsRequest) { + request = &DeleteDnsRecordsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteDnsRecords") + + + return +} + +func NewDeleteDnsRecordsResponse() (response *DeleteDnsRecordsResponse) { + response = &DeleteDnsRecordsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteDnsRecords +// 批量删除 DNS 记录 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteDnsRecords(request *DeleteDnsRecordsRequest) (response *DeleteDnsRecordsResponse, err error) { + return c.DeleteDnsRecordsWithContext(context.Background(), request) +} + +// DeleteDnsRecords +// 批量删除 DNS 记录 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteDnsRecordsWithContext(ctx context.Context, request *DeleteDnsRecordsRequest) (response *DeleteDnsRecordsResponse, err error) { + if request == nil { + request = NewDeleteDnsRecordsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteDnsRecords require credential") + } + + request.SetContext(ctx) + + response = NewDeleteDnsRecordsResponse() + err = c.Send(request, response) + return +} + +func NewDeleteLoadBalancingRequest() (request *DeleteLoadBalancingRequest) { + request = &DeleteLoadBalancingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteLoadBalancing") + + + return +} + +func NewDeleteLoadBalancingResponse() (response *DeleteLoadBalancingResponse) { + response = &DeleteLoadBalancingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteLoadBalancing +// 删除负载均衡 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteLoadBalancing(request *DeleteLoadBalancingRequest) (response *DeleteLoadBalancingResponse, err error) { + return c.DeleteLoadBalancingWithContext(context.Background(), request) +} + +// DeleteLoadBalancing +// 删除负载均衡 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteLoadBalancingWithContext(ctx context.Context, request *DeleteLoadBalancingRequest) (response *DeleteLoadBalancingResponse, err error) { + if request == nil { + request = NewDeleteLoadBalancingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteLoadBalancing require credential") + } + + request.SetContext(ctx) + + response = NewDeleteLoadBalancingResponse() + err = c.Send(request, response) + return +} + +func NewDeleteOriginGroupRequest() (request *DeleteOriginGroupRequest) { + request = &DeleteOriginGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteOriginGroup") + + + return +} + +func NewDeleteOriginGroupResponse() (response *DeleteOriginGroupResponse) { + response = &DeleteOriginGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteOriginGroup +// 源站组删除 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteOriginGroup(request *DeleteOriginGroupRequest) (response *DeleteOriginGroupResponse, err error) { + return c.DeleteOriginGroupWithContext(context.Background(), request) +} + +// DeleteOriginGroup +// 源站组删除 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteOriginGroupWithContext(ctx context.Context, request *DeleteOriginGroupRequest) (response *DeleteOriginGroupResponse, err error) { + if request == nil { + request = NewDeleteOriginGroupRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteOriginGroup require credential") + } + + request.SetContext(ctx) + + response = NewDeleteOriginGroupResponse() + err = c.Send(request, response) + return +} + +func NewDeleteRulesRequest() (request *DeleteRulesRequest) { + request = &DeleteRulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteRules") + + + return +} + +func NewDeleteRulesResponse() (response *DeleteRulesResponse) { + response = &DeleteRulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteRules +// 批量删除规则引擎规则。 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteRules(request *DeleteRulesRequest) (response *DeleteRulesResponse, err error) { + return c.DeleteRulesWithContext(context.Background(), request) +} + +// DeleteRules +// 批量删除规则引擎规则。 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteRulesWithContext(ctx context.Context, request *DeleteRulesRequest) (response *DeleteRulesResponse, err error) { + if request == nil { + request = NewDeleteRulesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteRules require credential") + } + + request.SetContext(ctx) + + response = NewDeleteRulesResponse() + err = c.Send(request, response) + return +} + +func NewDeleteZoneRequest() (request *DeleteZoneRequest) { + request = &DeleteZoneRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteZone") + + + return +} + +func NewDeleteZoneResponse() (response *DeleteZoneResponse) { + response = &DeleteZoneResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteZone +// 删除站点 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteZone(request *DeleteZoneRequest) (response *DeleteZoneResponse, err error) { + return c.DeleteZoneWithContext(context.Background(), request) +} + +// DeleteZone +// 删除站点 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DeleteZoneWithContext(ctx context.Context, request *DeleteZoneRequest) (response *DeleteZoneResponse, err error) { + if request == nil { + request = NewDeleteZoneRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteZone require credential") + } + + request.SetContext(ctx) + + response = NewDeleteZoneResponse() + err = c.Send(request, response) + return +} + +func NewDescribeApplicationProxyRequest() (request *DescribeApplicationProxyRequest) { + request = &DescribeApplicationProxyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeApplicationProxy") + + + return +} + +func NewDescribeApplicationProxyResponse() (response *DescribeApplicationProxyResponse) { + response = &DescribeApplicationProxyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeApplicationProxy +// 获取应用代理列表 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeApplicationProxy(request *DescribeApplicationProxyRequest) (response *DescribeApplicationProxyResponse, err error) { + return c.DescribeApplicationProxyWithContext(context.Background(), request) +} + +// DescribeApplicationProxy +// 获取应用代理列表 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeApplicationProxyWithContext(ctx context.Context, request *DescribeApplicationProxyRequest) (response *DescribeApplicationProxyResponse, err error) { + if request == nil { + request = NewDescribeApplicationProxyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeApplicationProxy require credential") + } + + request.SetContext(ctx) + + response = NewDescribeApplicationProxyResponse() + err = c.Send(request, response) + return +} + +func NewDescribeApplicationProxyDetailRequest() (request *DescribeApplicationProxyDetailRequest) { + request = &DescribeApplicationProxyDetailRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeApplicationProxyDetail") + + + return +} + +func NewDescribeApplicationProxyDetailResponse() (response *DescribeApplicationProxyDetailResponse) { + response = &DescribeApplicationProxyDetailResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeApplicationProxyDetail +// 获取应用代理详细信息 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeApplicationProxyDetail(request *DescribeApplicationProxyDetailRequest) (response *DescribeApplicationProxyDetailResponse, err error) { + return c.DescribeApplicationProxyDetailWithContext(context.Background(), request) +} + +// DescribeApplicationProxyDetail +// 获取应用代理详细信息 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeApplicationProxyDetailWithContext(ctx context.Context, request *DescribeApplicationProxyDetailRequest) (response *DescribeApplicationProxyDetailResponse, err error) { + if request == nil { + request = NewDescribeApplicationProxyDetailRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeApplicationProxyDetail require credential") + } + + request.SetContext(ctx) + + response = NewDescribeApplicationProxyDetailResponse() + err = c.Send(request, response) + return +} + +func NewDescribeAvailablePlansRequest() (request *DescribeAvailablePlansRequest) { + request = &DescribeAvailablePlansRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeAvailablePlans") + + + return +} + +func NewDescribeAvailablePlansResponse() (response *DescribeAvailablePlansResponse) { + response = &DescribeAvailablePlansResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeAvailablePlans +// 查询当前账户可用套餐信息列表 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeAvailablePlans(request *DescribeAvailablePlansRequest) (response *DescribeAvailablePlansResponse, err error) { + return c.DescribeAvailablePlansWithContext(context.Background(), request) +} + +// DescribeAvailablePlans +// 查询当前账户可用套餐信息列表 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeAvailablePlansWithContext(ctx context.Context, request *DescribeAvailablePlansRequest) (response *DescribeAvailablePlansResponse, err error) { + if request == nil { + request = NewDescribeAvailablePlansRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeAvailablePlans require credential") + } + + request.SetContext(ctx) + + response = NewDescribeAvailablePlansResponse() + err = c.Send(request, response) + return +} + +func NewDescribeBotLogRequest() (request *DescribeBotLogRequest) { + request = &DescribeBotLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeBotLog") + + + return +} + +func NewDescribeBotLogResponse() (response *DescribeBotLogResponse) { + response = &DescribeBotLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeBotLog +// 查询Bot攻击日志 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeBotLog(request *DescribeBotLogRequest) (response *DescribeBotLogResponse, err error) { + return c.DescribeBotLogWithContext(context.Background(), request) +} + +// DescribeBotLog +// 查询Bot攻击日志 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeBotLogWithContext(ctx context.Context, request *DescribeBotLogRequest) (response *DescribeBotLogResponse, err error) { + if request == nil { + request = NewDescribeBotLogRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeBotLog require credential") + } + + request.SetContext(ctx) + + response = NewDescribeBotLogResponse() + err = c.Send(request, response) + return +} + +func NewDescribeBotManagedRulesRequest() (request *DescribeBotManagedRulesRequest) { + request = &DescribeBotManagedRulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeBotManagedRules") + + + return +} + +func NewDescribeBotManagedRulesResponse() (response *DescribeBotManagedRulesResponse) { + response = &DescribeBotManagedRulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeBotManagedRules +// 分页查询Bot托管规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) DescribeBotManagedRules(request *DescribeBotManagedRulesRequest) (response *DescribeBotManagedRulesResponse, err error) { + return c.DescribeBotManagedRulesWithContext(context.Background(), request) +} + +// DescribeBotManagedRules +// 分页查询Bot托管规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) DescribeBotManagedRulesWithContext(ctx context.Context, request *DescribeBotManagedRulesRequest) (response *DescribeBotManagedRulesResponse, err error) { + if request == nil { + request = NewDescribeBotManagedRulesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeBotManagedRules require credential") + } + + request.SetContext(ctx) + + response = NewDescribeBotManagedRulesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeCnameStatusRequest() (request *DescribeCnameStatusRequest) { + request = &DescribeCnameStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeCnameStatus") + + + return +} + +func NewDescribeCnameStatusResponse() (response *DescribeCnameStatusResponse) { + response = &DescribeCnameStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeCnameStatus +// 查询域名 CNAME 状态 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeCnameStatus(request *DescribeCnameStatusRequest) (response *DescribeCnameStatusResponse, err error) { + return c.DescribeCnameStatusWithContext(context.Background(), request) +} + +// DescribeCnameStatus +// 查询域名 CNAME 状态 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeCnameStatusWithContext(ctx context.Context, request *DescribeCnameStatusRequest) (response *DescribeCnameStatusResponse, err error) { + if request == nil { + request = NewDescribeCnameStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeCnameStatus require credential") + } + + request.SetContext(ctx) + + response = NewDescribeCnameStatusResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDoSPolicyRequest() (request *DescribeDDoSPolicyRequest) { + request = &DescribeDDoSPolicyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDoSPolicy") + + + return +} + +func NewDescribeDDoSPolicyResponse() (response *DescribeDDoSPolicyResponse) { + response = &DescribeDDoSPolicyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDoSPolicy +// 查询DDoS防护配置详情 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDoSPolicy(request *DescribeDDoSPolicyRequest) (response *DescribeDDoSPolicyResponse, err error) { + return c.DescribeDDoSPolicyWithContext(context.Background(), request) +} + +// DescribeDDoSPolicy +// 查询DDoS防护配置详情 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDoSPolicyWithContext(ctx context.Context, request *DescribeDDoSPolicyRequest) (response *DescribeDDoSPolicyResponse, err error) { + if request == nil { + request = NewDescribeDDoSPolicyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDoSPolicy require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDoSPolicyResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDosAttackDataRequest() (request *DescribeDDosAttackDataRequest) { + request = &DescribeDDosAttackDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDosAttackData") + + + return +} + +func NewDescribeDDosAttackDataResponse() (response *DescribeDDosAttackDataResponse) { + response = &DescribeDDosAttackDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDosAttackData +// 查询DDos攻击时序数据 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackData(request *DescribeDDosAttackDataRequest) (response *DescribeDDosAttackDataResponse, err error) { + return c.DescribeDDosAttackDataWithContext(context.Background(), request) +} + +// DescribeDDosAttackData +// 查询DDos攻击时序数据 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackDataWithContext(ctx context.Context, request *DescribeDDosAttackDataRequest) (response *DescribeDDosAttackDataResponse, err error) { + if request == nil { + request = NewDescribeDDosAttackDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDosAttackData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDosAttackDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDosAttackEventRequest() (request *DescribeDDosAttackEventRequest) { + request = &DescribeDDosAttackEventRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDosAttackEvent") + + + return +} + +func NewDescribeDDosAttackEventResponse() (response *DescribeDDosAttackEventResponse) { + response = &DescribeDDosAttackEventResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDosAttackEvent +// 查询DDos攻击事件 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackEvent(request *DescribeDDosAttackEventRequest) (response *DescribeDDosAttackEventResponse, err error) { + return c.DescribeDDosAttackEventWithContext(context.Background(), request) +} + +// DescribeDDosAttackEvent +// 查询DDos攻击事件 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackEventWithContext(ctx context.Context, request *DescribeDDosAttackEventRequest) (response *DescribeDDosAttackEventResponse, err error) { + if request == nil { + request = NewDescribeDDosAttackEventRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDosAttackEvent require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDosAttackEventResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDosAttackEventDetailRequest() (request *DescribeDDosAttackEventDetailRequest) { + request = &DescribeDDosAttackEventDetailRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDosAttackEventDetail") + + + return +} + +func NewDescribeDDosAttackEventDetailResponse() (response *DescribeDDosAttackEventDetailResponse) { + response = &DescribeDDosAttackEventDetailResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDosAttackEventDetail +// 查询DDos攻击事件详情 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackEventDetail(request *DescribeDDosAttackEventDetailRequest) (response *DescribeDDosAttackEventDetailResponse, err error) { + return c.DescribeDDosAttackEventDetailWithContext(context.Background(), request) +} + +// DescribeDDosAttackEventDetail +// 查询DDos攻击事件详情 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackEventDetailWithContext(ctx context.Context, request *DescribeDDosAttackEventDetailRequest) (response *DescribeDDosAttackEventDetailResponse, err error) { + if request == nil { + request = NewDescribeDDosAttackEventDetailRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDosAttackEventDetail require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDosAttackEventDetailResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDosAttackSourceEventRequest() (request *DescribeDDosAttackSourceEventRequest) { + request = &DescribeDDosAttackSourceEventRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDosAttackSourceEvent") + + + return +} + +func NewDescribeDDosAttackSourceEventResponse() (response *DescribeDDosAttackSourceEventResponse) { + response = &DescribeDDosAttackSourceEventResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDosAttackSourceEvent +// 查询DDos攻击源信息 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackSourceEvent(request *DescribeDDosAttackSourceEventRequest) (response *DescribeDDosAttackSourceEventResponse, err error) { + return c.DescribeDDosAttackSourceEventWithContext(context.Background(), request) +} + +// DescribeDDosAttackSourceEvent +// 查询DDos攻击源信息 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackSourceEventWithContext(ctx context.Context, request *DescribeDDosAttackSourceEventRequest) (response *DescribeDDosAttackSourceEventResponse, err error) { + if request == nil { + request = NewDescribeDDosAttackSourceEventRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDosAttackSourceEvent require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDosAttackSourceEventResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDosAttackTopDataRequest() (request *DescribeDDosAttackTopDataRequest) { + request = &DescribeDDosAttackTopDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDosAttackTopData") + + + return +} + +func NewDescribeDDosAttackTopDataResponse() (response *DescribeDDosAttackTopDataResponse) { + response = &DescribeDDosAttackTopDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDosAttackTopData +// 查询DDos攻击Top数据 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackTopData(request *DescribeDDosAttackTopDataRequest) (response *DescribeDDosAttackTopDataResponse, err error) { + return c.DescribeDDosAttackTopDataWithContext(context.Background(), request) +} + +// DescribeDDosAttackTopData +// 查询DDos攻击Top数据 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosAttackTopDataWithContext(ctx context.Context, request *DescribeDDosAttackTopDataRequest) (response *DescribeDDosAttackTopDataResponse, err error) { + if request == nil { + request = NewDescribeDDosAttackTopDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDosAttackTopData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDosAttackTopDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDDosMajorAttackEventRequest() (request *DescribeDDosMajorAttackEventRequest) { + request = &DescribeDDosMajorAttackEventRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDDosMajorAttackEvent") + + + return +} + +func NewDescribeDDosMajorAttackEventResponse() (response *DescribeDDosMajorAttackEventResponse) { + response = &DescribeDDosMajorAttackEventResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDDosMajorAttackEvent +// 查询DDos主攻击事件 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// LIMITEXCEEDED = "LimitExceeded" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosMajorAttackEvent(request *DescribeDDosMajorAttackEventRequest) (response *DescribeDDosMajorAttackEventResponse, err error) { + return c.DescribeDDosMajorAttackEventWithContext(context.Background(), request) +} + +// DescribeDDosMajorAttackEvent +// 查询DDos主攻击事件 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// LIMITEXCEEDED = "LimitExceeded" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDDosMajorAttackEventWithContext(ctx context.Context, request *DescribeDDosMajorAttackEventRequest) (response *DescribeDDosMajorAttackEventResponse, err error) { + if request == nil { + request = NewDescribeDDosMajorAttackEventRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDDosMajorAttackEvent require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDDosMajorAttackEventResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDefaultCertificatesRequest() (request *DescribeDefaultCertificatesRequest) { + request = &DescribeDefaultCertificatesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDefaultCertificates") + + + return +} + +func NewDescribeDefaultCertificatesResponse() (response *DescribeDefaultCertificatesResponse) { + response = &DescribeDefaultCertificatesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDefaultCertificates +// 查询默认证书列表 +// +// 可能返回的错误码: +// INTERNALERROR_DBERROR = "InternalError.DBError" +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeDefaultCertificates(request *DescribeDefaultCertificatesRequest) (response *DescribeDefaultCertificatesResponse, err error) { + return c.DescribeDefaultCertificatesWithContext(context.Background(), request) +} + +// DescribeDefaultCertificates +// 查询默认证书列表 +// +// 可能返回的错误码: +// INTERNALERROR_DBERROR = "InternalError.DBError" +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeDefaultCertificatesWithContext(ctx context.Context, request *DescribeDefaultCertificatesRequest) (response *DescribeDefaultCertificatesResponse, err error) { + if request == nil { + request = NewDescribeDefaultCertificatesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDefaultCertificates require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDefaultCertificatesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDnsDataRequest() (request *DescribeDnsDataRequest) { + request = &DescribeDnsDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDnsData") + + + return +} + +func NewDescribeDnsDataResponse() (response *DescribeDnsDataResponse) { + response = &DescribeDnsDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDnsData +// 获取DNS请求数统计曲线 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDnsData(request *DescribeDnsDataRequest) (response *DescribeDnsDataResponse, err error) { + return c.DescribeDnsDataWithContext(context.Background(), request) +} + +// DescribeDnsData +// 获取DNS请求数统计曲线 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDnsDataWithContext(ctx context.Context, request *DescribeDnsDataRequest) (response *DescribeDnsDataResponse, err error) { + if request == nil { + request = NewDescribeDnsDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDnsData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDnsDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDnsRecordsRequest() (request *DescribeDnsRecordsRequest) { + request = &DescribeDnsRecordsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDnsRecords") + + + return +} + +func NewDescribeDnsRecordsResponse() (response *DescribeDnsRecordsResponse) { + response = &DescribeDnsRecordsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDnsRecords +// 查询 DNS 记录列表,支持搜索、分页、排序、过滤。 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDnsRecords(request *DescribeDnsRecordsRequest) (response *DescribeDnsRecordsResponse, err error) { + return c.DescribeDnsRecordsWithContext(context.Background(), request) +} + +// DescribeDnsRecords +// 查询 DNS 记录列表,支持搜索、分页、排序、过滤。 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDnsRecordsWithContext(ctx context.Context, request *DescribeDnsRecordsRequest) (response *DescribeDnsRecordsResponse, err error) { + if request == nil { + request = NewDescribeDnsRecordsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDnsRecords require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDnsRecordsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeDnssecRequest() (request *DescribeDnssecRequest) { + request = &DescribeDnssecRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeDnssec") + + + return +} + +func NewDescribeDnssecResponse() (response *DescribeDnssecResponse) { + response = &DescribeDnssecResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeDnssec +// 用于查询 DNSSEC 相关信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDnssec(request *DescribeDnssecRequest) (response *DescribeDnssecResponse, err error) { + return c.DescribeDnssecWithContext(context.Background(), request) +} + +// DescribeDnssec +// 用于查询 DNSSEC 相关信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeDnssecWithContext(ctx context.Context, request *DescribeDnssecRequest) (response *DescribeDnssecResponse, err error) { + if request == nil { + request = NewDescribeDnssecRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeDnssec require credential") + } + + request.SetContext(ctx) + + response = NewDescribeDnssecResponse() + err = c.Send(request, response) + return +} + +func NewDescribeHostsCertificateRequest() (request *DescribeHostsCertificateRequest) { + request = &DescribeHostsCertificateRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeHostsCertificate") + + + return +} + +func NewDescribeHostsCertificateResponse() (response *DescribeHostsCertificateResponse) { + response = &DescribeHostsCertificateResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeHostsCertificate +// 查询域名证书列表,支持搜索、分页、排序、过滤。 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeHostsCertificate(request *DescribeHostsCertificateRequest) (response *DescribeHostsCertificateResponse, err error) { + return c.DescribeHostsCertificateWithContext(context.Background(), request) +} + +// DescribeHostsCertificate +// 查询域名证书列表,支持搜索、分页、排序、过滤。 +// +// 可能返回的错误码: +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeHostsCertificateWithContext(ctx context.Context, request *DescribeHostsCertificateRequest) (response *DescribeHostsCertificateResponse, err error) { + if request == nil { + request = NewDescribeHostsCertificateRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeHostsCertificate require credential") + } + + request.SetContext(ctx) + + response = NewDescribeHostsCertificateResponse() + err = c.Send(request, response) + return +} + +func NewDescribeHostsSettingRequest() (request *DescribeHostsSettingRequest) { + request = &DescribeHostsSettingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeHostsSetting") + + + return +} + +func NewDescribeHostsSettingResponse() (response *DescribeHostsSettingResponse) { + response = &DescribeHostsSettingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeHostsSetting +// 用于查询域名配置信息 +// +// 可能返回的错误码: +// INVALIDPARAMETER = "InvalidParameter" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeHostsSetting(request *DescribeHostsSettingRequest) (response *DescribeHostsSettingResponse, err error) { + return c.DescribeHostsSettingWithContext(context.Background(), request) +} + +// DescribeHostsSetting +// 用于查询域名配置信息 +// +// 可能返回的错误码: +// INVALIDPARAMETER = "InvalidParameter" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeHostsSettingWithContext(ctx context.Context, request *DescribeHostsSettingRequest) (response *DescribeHostsSettingResponse, err error) { + if request == nil { + request = NewDescribeHostsSettingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeHostsSetting require credential") + } + + request.SetContext(ctx) + + response = NewDescribeHostsSettingResponse() + err = c.Send(request, response) + return +} + +func NewDescribeIdentificationRequest() (request *DescribeIdentificationRequest) { + request = &DescribeIdentificationRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeIdentification") + + + return +} + +func NewDescribeIdentificationResponse() (response *DescribeIdentificationResponse) { + response = &DescribeIdentificationResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeIdentification +// 查询验证结果 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeIdentification(request *DescribeIdentificationRequest) (response *DescribeIdentificationResponse, err error) { + return c.DescribeIdentificationWithContext(context.Background(), request) +} + +// DescribeIdentification +// 查询验证结果 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeIdentificationWithContext(ctx context.Context, request *DescribeIdentificationRequest) (response *DescribeIdentificationResponse, err error) { + if request == nil { + request = NewDescribeIdentificationRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeIdentification require credential") + } + + request.SetContext(ctx) + + response = NewDescribeIdentificationResponse() + err = c.Send(request, response) + return +} + +func NewDescribeLoadBalancingRequest() (request *DescribeLoadBalancingRequest) { + request = &DescribeLoadBalancingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeLoadBalancing") + + + return +} + +func NewDescribeLoadBalancingResponse() (response *DescribeLoadBalancingResponse) { + response = &DescribeLoadBalancingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeLoadBalancing +// 获取负载均衡列表 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeLoadBalancing(request *DescribeLoadBalancingRequest) (response *DescribeLoadBalancingResponse, err error) { + return c.DescribeLoadBalancingWithContext(context.Background(), request) +} + +// DescribeLoadBalancing +// 获取负载均衡列表 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeLoadBalancingWithContext(ctx context.Context, request *DescribeLoadBalancingRequest) (response *DescribeLoadBalancingResponse, err error) { + if request == nil { + request = NewDescribeLoadBalancingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeLoadBalancing require credential") + } + + request.SetContext(ctx) + + response = NewDescribeLoadBalancingResponse() + err = c.Send(request, response) + return +} + +func NewDescribeLoadBalancingDetailRequest() (request *DescribeLoadBalancingDetailRequest) { + request = &DescribeLoadBalancingDetailRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeLoadBalancingDetail") + + + return +} + +func NewDescribeLoadBalancingDetailResponse() (response *DescribeLoadBalancingDetailResponse) { + response = &DescribeLoadBalancingDetailResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeLoadBalancingDetail +// 获取负载均衡详细信息 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeLoadBalancingDetail(request *DescribeLoadBalancingDetailRequest) (response *DescribeLoadBalancingDetailResponse, err error) { + return c.DescribeLoadBalancingDetailWithContext(context.Background(), request) +} + +// DescribeLoadBalancingDetail +// 获取负载均衡详细信息 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeLoadBalancingDetailWithContext(ctx context.Context, request *DescribeLoadBalancingDetailRequest) (response *DescribeLoadBalancingDetailResponse, err error) { + if request == nil { + request = NewDescribeLoadBalancingDetailRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeLoadBalancingDetail require credential") + } + + request.SetContext(ctx) + + response = NewDescribeLoadBalancingDetailResponse() + err = c.Send(request, response) + return +} + +func NewDescribeOriginGroupRequest() (request *DescribeOriginGroupRequest) { + request = &DescribeOriginGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeOriginGroup") + + + return +} + +func NewDescribeOriginGroupResponse() (response *DescribeOriginGroupResponse) { + response = &DescribeOriginGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeOriginGroup +// 获取源站组信息列表 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeOriginGroup(request *DescribeOriginGroupRequest) (response *DescribeOriginGroupResponse, err error) { + return c.DescribeOriginGroupWithContext(context.Background(), request) +} + +// DescribeOriginGroup +// 获取源站组信息列表 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeOriginGroupWithContext(ctx context.Context, request *DescribeOriginGroupRequest) (response *DescribeOriginGroupResponse, err error) { + if request == nil { + request = NewDescribeOriginGroupRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeOriginGroup require credential") + } + + request.SetContext(ctx) + + response = NewDescribeOriginGroupResponse() + err = c.Send(request, response) + return +} + +func NewDescribeOriginGroupDetailRequest() (request *DescribeOriginGroupDetailRequest) { + request = &DescribeOriginGroupDetailRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeOriginGroupDetail") + + + return +} + +func NewDescribeOriginGroupDetailResponse() (response *DescribeOriginGroupDetailResponse) { + response = &DescribeOriginGroupDetailResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeOriginGroupDetail +// 获取源站组详细信息 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeOriginGroupDetail(request *DescribeOriginGroupDetailRequest) (response *DescribeOriginGroupDetailResponse, err error) { + return c.DescribeOriginGroupDetailWithContext(context.Background(), request) +} + +// DescribeOriginGroupDetail +// 获取源站组详细信息 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeOriginGroupDetailWithContext(ctx context.Context, request *DescribeOriginGroupDetailRequest) (response *DescribeOriginGroupDetailResponse, err error) { + if request == nil { + request = NewDescribeOriginGroupDetailRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeOriginGroupDetail require credential") + } + + request.SetContext(ctx) + + response = NewDescribeOriginGroupDetailResponse() + err = c.Send(request, response) + return +} + +func NewDescribeOverviewL7DataRequest() (request *DescribeOverviewL7DataRequest) { + request = &DescribeOverviewL7DataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeOverviewL7Data") + + + return +} + +func NewDescribeOverviewL7DataResponse() (response *DescribeOverviewL7DataResponse) { + response = &DescribeOverviewL7DataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeOverviewL7Data +// 查询七层监控类时序流量数据 +// +// 可能返回的错误码: +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeOverviewL7Data(request *DescribeOverviewL7DataRequest) (response *DescribeOverviewL7DataResponse, err error) { + return c.DescribeOverviewL7DataWithContext(context.Background(), request) +} + +// DescribeOverviewL7Data +// 查询七层监控类时序流量数据 +// +// 可能返回的错误码: +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeOverviewL7DataWithContext(ctx context.Context, request *DescribeOverviewL7DataRequest) (response *DescribeOverviewL7DataResponse, err error) { + if request == nil { + request = NewDescribeOverviewL7DataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeOverviewL7Data require credential") + } + + request.SetContext(ctx) + + response = NewDescribeOverviewL7DataResponse() + err = c.Send(request, response) + return +} + +func NewDescribePrefetchTasksRequest() (request *DescribePrefetchTasksRequest) { + request = &DescribePrefetchTasksRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribePrefetchTasks") + + + return +} + +func NewDescribePrefetchTasksResponse() (response *DescribePrefetchTasksResponse) { + response = &DescribePrefetchTasksResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribePrefetchTasks +// 查询预热任务状态 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_DOMAINEMPTY = "UnauthorizedOperation.DomainEmpty" +func (c *Client) DescribePrefetchTasks(request *DescribePrefetchTasksRequest) (response *DescribePrefetchTasksResponse, err error) { + return c.DescribePrefetchTasksWithContext(context.Background(), request) +} + +// DescribePrefetchTasks +// 查询预热任务状态 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_DOMAINEMPTY = "UnauthorizedOperation.DomainEmpty" +func (c *Client) DescribePrefetchTasksWithContext(ctx context.Context, request *DescribePrefetchTasksRequest) (response *DescribePrefetchTasksResponse, err error) { + if request == nil { + request = NewDescribePrefetchTasksRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribePrefetchTasks require credential") + } + + request.SetContext(ctx) + + response = NewDescribePrefetchTasksResponse() + err = c.Send(request, response) + return +} + +func NewDescribePurgeTasksRequest() (request *DescribePurgeTasksRequest) { + request = &DescribePurgeTasksRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribePurgeTasks") + + + return +} + +func NewDescribePurgeTasksResponse() (response *DescribePurgeTasksResponse) { + response = &DescribePurgeTasksResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribePurgeTasks +// 查询清除缓存历史记录 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribePurgeTasks(request *DescribePurgeTasksRequest) (response *DescribePurgeTasksResponse, err error) { + return c.DescribePurgeTasksWithContext(context.Background(), request) +} + +// DescribePurgeTasks +// 查询清除缓存历史记录 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribePurgeTasksWithContext(ctx context.Context, request *DescribePurgeTasksRequest) (response *DescribePurgeTasksResponse, err error) { + if request == nil { + request = NewDescribePurgeTasksRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribePurgeTasks require credential") + } + + request.SetContext(ctx) + + response = NewDescribePurgeTasksResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRulesRequest() (request *DescribeRulesRequest) { + request = &DescribeRulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeRules") + + + return +} + +func NewDescribeRulesResponse() (response *DescribeRulesResponse) { + response = &DescribeRulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeRules +// 查询规则引擎规则。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeRules(request *DescribeRulesRequest) (response *DescribeRulesResponse, err error) { + return c.DescribeRulesWithContext(context.Background(), request) +} + +// DescribeRules +// 查询规则引擎规则。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeRulesWithContext(ctx context.Context, request *DescribeRulesRequest) (response *DescribeRulesResponse, err error) { + if request == nil { + request = NewDescribeRulesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeRules require credential") + } + + request.SetContext(ctx) + + response = NewDescribeRulesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeRulesSettingRequest() (request *DescribeRulesSettingRequest) { + request = &DescribeRulesSettingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeRulesSetting") + + + return +} + +func NewDescribeRulesSettingResponse() (response *DescribeRulesSettingResponse) { + response = &DescribeRulesSettingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeRulesSetting +// 返回规则引擎可应用匹配请求的设置列表及其详细建议配置信息 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeRulesSetting(request *DescribeRulesSettingRequest) (response *DescribeRulesSettingResponse, err error) { + return c.DescribeRulesSettingWithContext(context.Background(), request) +} + +// DescribeRulesSetting +// 返回规则引擎可应用匹配请求的设置列表及其详细建议配置信息 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeRulesSettingWithContext(ctx context.Context, request *DescribeRulesSettingRequest) (response *DescribeRulesSettingResponse, err error) { + if request == nil { + request = NewDescribeRulesSettingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeRulesSetting require credential") + } + + request.SetContext(ctx) + + response = NewDescribeRulesSettingResponse() + err = c.Send(request, response) + return +} + +func NewDescribeSecurityPolicyRequest() (request *DescribeSecurityPolicyRequest) { + request = &DescribeSecurityPolicyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeSecurityPolicy") + + + return +} + +func NewDescribeSecurityPolicyResponse() (response *DescribeSecurityPolicyResponse) { + response = &DescribeSecurityPolicyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeSecurityPolicy +// 查询安全防护配置详情 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeSecurityPolicy(request *DescribeSecurityPolicyRequest) (response *DescribeSecurityPolicyResponse, err error) { + return c.DescribeSecurityPolicyWithContext(context.Background(), request) +} + +// DescribeSecurityPolicy +// 查询安全防护配置详情 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeSecurityPolicyWithContext(ctx context.Context, request *DescribeSecurityPolicyRequest) (response *DescribeSecurityPolicyResponse, err error) { + if request == nil { + request = NewDescribeSecurityPolicyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeSecurityPolicy require credential") + } + + request.SetContext(ctx) + + response = NewDescribeSecurityPolicyResponse() + err = c.Send(request, response) + return +} + +func NewDescribeSecurityPolicyListRequest() (request *DescribeSecurityPolicyListRequest) { + request = &DescribeSecurityPolicyListRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeSecurityPolicyList") + + + return +} + +func NewDescribeSecurityPolicyListResponse() (response *DescribeSecurityPolicyListResponse) { + response = &DescribeSecurityPolicyListResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeSecurityPolicyList +// 查询全部安全实例 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeSecurityPolicyList(request *DescribeSecurityPolicyListRequest) (response *DescribeSecurityPolicyListResponse, err error) { + return c.DescribeSecurityPolicyListWithContext(context.Background(), request) +} + +// DescribeSecurityPolicyList +// 查询全部安全实例 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeSecurityPolicyListWithContext(ctx context.Context, request *DescribeSecurityPolicyListRequest) (response *DescribeSecurityPolicyListResponse, err error) { + if request == nil { + request = NewDescribeSecurityPolicyListRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeSecurityPolicyList require credential") + } + + request.SetContext(ctx) + + response = NewDescribeSecurityPolicyListResponse() + err = c.Send(request, response) + return +} + +func NewDescribeSecurityPolicyManagedRulesRequest() (request *DescribeSecurityPolicyManagedRulesRequest) { + request = &DescribeSecurityPolicyManagedRulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeSecurityPolicyManagedRules") + + + return +} + +func NewDescribeSecurityPolicyManagedRulesResponse() (response *DescribeSecurityPolicyManagedRulesResponse) { + response = &DescribeSecurityPolicyManagedRulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeSecurityPolicyManagedRules +// 分页查询门神规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) DescribeSecurityPolicyManagedRules(request *DescribeSecurityPolicyManagedRulesRequest) (response *DescribeSecurityPolicyManagedRulesResponse, err error) { + return c.DescribeSecurityPolicyManagedRulesWithContext(context.Background(), request) +} + +// DescribeSecurityPolicyManagedRules +// 分页查询门神规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) DescribeSecurityPolicyManagedRulesWithContext(ctx context.Context, request *DescribeSecurityPolicyManagedRulesRequest) (response *DescribeSecurityPolicyManagedRulesResponse, err error) { + if request == nil { + request = NewDescribeSecurityPolicyManagedRulesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeSecurityPolicyManagedRules require credential") + } + + request.SetContext(ctx) + + response = NewDescribeSecurityPolicyManagedRulesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeSecurityPolicyManagedRulesIdRequest() (request *DescribeSecurityPolicyManagedRulesIdRequest) { + request = &DescribeSecurityPolicyManagedRulesIdRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeSecurityPolicyManagedRulesId") + + + return +} + +func NewDescribeSecurityPolicyManagedRulesIdResponse() (response *DescribeSecurityPolicyManagedRulesIdResponse) { + response = &DescribeSecurityPolicyManagedRulesIdResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeSecurityPolicyManagedRulesId +// 规则id查询门神规则详情 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) DescribeSecurityPolicyManagedRulesId(request *DescribeSecurityPolicyManagedRulesIdRequest) (response *DescribeSecurityPolicyManagedRulesIdResponse, err error) { + return c.DescribeSecurityPolicyManagedRulesIdWithContext(context.Background(), request) +} + +// DescribeSecurityPolicyManagedRulesId +// 规则id查询门神规则详情 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) DescribeSecurityPolicyManagedRulesIdWithContext(ctx context.Context, request *DescribeSecurityPolicyManagedRulesIdRequest) (response *DescribeSecurityPolicyManagedRulesIdResponse, err error) { + if request == nil { + request = NewDescribeSecurityPolicyManagedRulesIdRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeSecurityPolicyManagedRulesId require credential") + } + + request.SetContext(ctx) + + response = NewDescribeSecurityPolicyManagedRulesIdResponse() + err = c.Send(request, response) + return +} + +func NewDescribeSecurityPolicyRegionsRequest() (request *DescribeSecurityPolicyRegionsRequest) { + request = &DescribeSecurityPolicyRegionsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeSecurityPolicyRegions") + + + return +} + +func NewDescribeSecurityPolicyRegionsResponse() (response *DescribeSecurityPolicyRegionsResponse) { + response = &DescribeSecurityPolicyRegionsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeSecurityPolicyRegions +// 查询所有地域信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeSecurityPolicyRegions(request *DescribeSecurityPolicyRegionsRequest) (response *DescribeSecurityPolicyRegionsResponse, err error) { + return c.DescribeSecurityPolicyRegionsWithContext(context.Background(), request) +} + +// DescribeSecurityPolicyRegions +// 查询所有地域信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) DescribeSecurityPolicyRegionsWithContext(ctx context.Context, request *DescribeSecurityPolicyRegionsRequest) (response *DescribeSecurityPolicyRegionsResponse, err error) { + if request == nil { + request = NewDescribeSecurityPolicyRegionsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeSecurityPolicyRegions require credential") + } + + request.SetContext(ctx) + + response = NewDescribeSecurityPolicyRegionsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeSecurityPortraitRulesRequest() (request *DescribeSecurityPortraitRulesRequest) { + request = &DescribeSecurityPortraitRulesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeSecurityPortraitRules") + + + return +} + +func NewDescribeSecurityPortraitRulesResponse() (response *DescribeSecurityPortraitRulesResponse) { + response = &DescribeSecurityPortraitRulesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeSecurityPortraitRules +// 查询Bot用户画像规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeSecurityPortraitRules(request *DescribeSecurityPortraitRulesRequest) (response *DescribeSecurityPortraitRulesResponse, err error) { + return c.DescribeSecurityPortraitRulesWithContext(context.Background(), request) +} + +// DescribeSecurityPortraitRules +// 查询Bot用户画像规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeSecurityPortraitRulesWithContext(ctx context.Context, request *DescribeSecurityPortraitRulesRequest) (response *DescribeSecurityPortraitRulesResponse, err error) { + if request == nil { + request = NewDescribeSecurityPortraitRulesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeSecurityPortraitRules require credential") + } + + request.SetContext(ctx) + + response = NewDescribeSecurityPortraitRulesResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTimingL4DataRequest() (request *DescribeTimingL4DataRequest) { + request = &DescribeTimingL4DataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeTimingL4Data") + + + return +} + +func NewDescribeTimingL4DataResponse() (response *DescribeTimingL4DataResponse) { + response = &DescribeTimingL4DataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTimingL4Data +// 四层时序流量数据查询 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTimingL4Data(request *DescribeTimingL4DataRequest) (response *DescribeTimingL4DataResponse, err error) { + return c.DescribeTimingL4DataWithContext(context.Background(), request) +} + +// DescribeTimingL4Data +// 四层时序流量数据查询 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTimingL4DataWithContext(ctx context.Context, request *DescribeTimingL4DataRequest) (response *DescribeTimingL4DataResponse, err error) { + if request == nil { + request = NewDescribeTimingL4DataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTimingL4Data require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTimingL4DataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTimingL7AnalysisDataRequest() (request *DescribeTimingL7AnalysisDataRequest) { + request = &DescribeTimingL7AnalysisDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeTimingL7AnalysisData") + + + return +} + +func NewDescribeTimingL7AnalysisDataResponse() (response *DescribeTimingL7AnalysisDataResponse) { + response = &DescribeTimingL7AnalysisDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTimingL7AnalysisData +// 查询七层数据分析类时序流量数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTimingL7AnalysisData(request *DescribeTimingL7AnalysisDataRequest) (response *DescribeTimingL7AnalysisDataResponse, err error) { + return c.DescribeTimingL7AnalysisDataWithContext(context.Background(), request) +} + +// DescribeTimingL7AnalysisData +// 查询七层数据分析类时序流量数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTimingL7AnalysisDataWithContext(ctx context.Context, request *DescribeTimingL7AnalysisDataRequest) (response *DescribeTimingL7AnalysisDataResponse, err error) { + if request == nil { + request = NewDescribeTimingL7AnalysisDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTimingL7AnalysisData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTimingL7AnalysisDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTimingL7CacheDataRequest() (request *DescribeTimingL7CacheDataRequest) { + request = &DescribeTimingL7CacheDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeTimingL7CacheData") + + + return +} + +func NewDescribeTimingL7CacheDataResponse() (response *DescribeTimingL7CacheDataResponse) { + response = &DescribeTimingL7CacheDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTimingL7CacheData +// 七层查询缓存分析时序类流量数据 +// +// 可能返回的错误码: +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTimingL7CacheData(request *DescribeTimingL7CacheDataRequest) (response *DescribeTimingL7CacheDataResponse, err error) { + return c.DescribeTimingL7CacheDataWithContext(context.Background(), request) +} + +// DescribeTimingL7CacheData +// 七层查询缓存分析时序类流量数据 +// +// 可能返回的错误码: +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTimingL7CacheDataWithContext(ctx context.Context, request *DescribeTimingL7CacheDataRequest) (response *DescribeTimingL7CacheDataResponse, err error) { + if request == nil { + request = NewDescribeTimingL7CacheDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTimingL7CacheData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTimingL7CacheDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTopL7AnalysisDataRequest() (request *DescribeTopL7AnalysisDataRequest) { + request = &DescribeTopL7AnalysisDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeTopL7AnalysisData") + + + return +} + +func NewDescribeTopL7AnalysisDataResponse() (response *DescribeTopL7AnalysisDataResponse) { + response = &DescribeTopL7AnalysisDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTopL7AnalysisData +// 查询top类流量数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTopL7AnalysisData(request *DescribeTopL7AnalysisDataRequest) (response *DescribeTopL7AnalysisDataResponse, err error) { + return c.DescribeTopL7AnalysisDataWithContext(context.Background(), request) +} + +// DescribeTopL7AnalysisData +// 查询top类流量数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTopL7AnalysisDataWithContext(ctx context.Context, request *DescribeTopL7AnalysisDataRequest) (response *DescribeTopL7AnalysisDataResponse, err error) { + if request == nil { + request = NewDescribeTopL7AnalysisDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTopL7AnalysisData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTopL7AnalysisDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTopL7CacheDataRequest() (request *DescribeTopL7CacheDataRequest) { + request = &DescribeTopL7CacheDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeTopL7CacheData") + + + return +} + +func NewDescribeTopL7CacheDataResponse() (response *DescribeTopL7CacheDataResponse) { + response = &DescribeTopL7CacheDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTopL7CacheData +// 七层查询缓存分析top类流量数据 +// +// 可能返回的错误码: +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTopL7CacheData(request *DescribeTopL7CacheDataRequest) (response *DescribeTopL7CacheDataResponse, err error) { + return c.DescribeTopL7CacheDataWithContext(context.Background(), request) +} + +// DescribeTopL7CacheData +// 七层查询缓存分析top类流量数据 +// +// 可能返回的错误码: +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeTopL7CacheDataWithContext(ctx context.Context, request *DescribeTopL7CacheDataRequest) (response *DescribeTopL7CacheDataResponse, err error) { + if request == nil { + request = NewDescribeTopL7CacheDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeTopL7CacheData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeTopL7CacheDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebManagedRulesAttackEventsRequest() (request *DescribeWebManagedRulesAttackEventsRequest) { + request = &DescribeWebManagedRulesAttackEventsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebManagedRulesAttackEvents") + + + return +} + +func NewDescribeWebManagedRulesAttackEventsResponse() (response *DescribeWebManagedRulesAttackEventsResponse) { + response = &DescribeWebManagedRulesAttackEventsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebManagedRulesAttackEvents +// 查询Web托管攻击事件 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebManagedRulesAttackEvents(request *DescribeWebManagedRulesAttackEventsRequest) (response *DescribeWebManagedRulesAttackEventsResponse, err error) { + return c.DescribeWebManagedRulesAttackEventsWithContext(context.Background(), request) +} + +// DescribeWebManagedRulesAttackEvents +// 查询Web托管攻击事件 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebManagedRulesAttackEventsWithContext(ctx context.Context, request *DescribeWebManagedRulesAttackEventsRequest) (response *DescribeWebManagedRulesAttackEventsResponse, err error) { + if request == nil { + request = NewDescribeWebManagedRulesAttackEventsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebManagedRulesAttackEvents require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebManagedRulesAttackEventsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebManagedRulesDataRequest() (request *DescribeWebManagedRulesDataRequest) { + request = &DescribeWebManagedRulesDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebManagedRulesData") + + + return +} + +func NewDescribeWebManagedRulesDataResponse() (response *DescribeWebManagedRulesDataResponse) { + response = &DescribeWebManagedRulesDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebManagedRulesData +// 查询waf攻击时序数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebManagedRulesData(request *DescribeWebManagedRulesDataRequest) (response *DescribeWebManagedRulesDataResponse, err error) { + return c.DescribeWebManagedRulesDataWithContext(context.Background(), request) +} + +// DescribeWebManagedRulesData +// 查询waf攻击时序数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebManagedRulesDataWithContext(ctx context.Context, request *DescribeWebManagedRulesDataRequest) (response *DescribeWebManagedRulesDataResponse, err error) { + if request == nil { + request = NewDescribeWebManagedRulesDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebManagedRulesData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebManagedRulesDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebManagedRulesLogRequest() (request *DescribeWebManagedRulesLogRequest) { + request = &DescribeWebManagedRulesLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebManagedRulesLog") + + + return +} + +func NewDescribeWebManagedRulesLogResponse() (response *DescribeWebManagedRulesLogResponse) { + response = &DescribeWebManagedRulesLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebManagedRulesLog +// 查询waf攻击日志 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeWebManagedRulesLog(request *DescribeWebManagedRulesLogRequest) (response *DescribeWebManagedRulesLogResponse, err error) { + return c.DescribeWebManagedRulesLogWithContext(context.Background(), request) +} + +// DescribeWebManagedRulesLog +// 查询waf攻击日志 +// +// 可能返回的错误码: +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeWebManagedRulesLogWithContext(ctx context.Context, request *DescribeWebManagedRulesLogRequest) (response *DescribeWebManagedRulesLogResponse, err error) { + if request == nil { + request = NewDescribeWebManagedRulesLogRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebManagedRulesLog require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebManagedRulesLogResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebManagedRulesTopDataRequest() (request *DescribeWebManagedRulesTopDataRequest) { + request = &DescribeWebManagedRulesTopDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebManagedRulesTopData") + + + return +} + +func NewDescribeWebManagedRulesTopDataResponse() (response *DescribeWebManagedRulesTopDataResponse) { + response = &DescribeWebManagedRulesTopDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebManagedRulesTopData +// 查询waf攻击top数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// LIMITEXCEEDED = "LimitExceeded" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeWebManagedRulesTopData(request *DescribeWebManagedRulesTopDataRequest) (response *DescribeWebManagedRulesTopDataResponse, err error) { + return c.DescribeWebManagedRulesTopDataWithContext(context.Background(), request) +} + +// DescribeWebManagedRulesTopData +// 查询waf攻击top数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// LIMITEXCEEDED = "LimitExceeded" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeWebManagedRulesTopDataWithContext(ctx context.Context, request *DescribeWebManagedRulesTopDataRequest) (response *DescribeWebManagedRulesTopDataResponse, err error) { + if request == nil { + request = NewDescribeWebManagedRulesTopDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebManagedRulesTopData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebManagedRulesTopDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebProtectionAttackEventsRequest() (request *DescribeWebProtectionAttackEventsRequest) { + request = &DescribeWebProtectionAttackEventsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebProtectionAttackEvents") + + + return +} + +func NewDescribeWebProtectionAttackEventsResponse() (response *DescribeWebProtectionAttackEventsResponse) { + response = &DescribeWebProtectionAttackEventsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebProtectionAttackEvents +// 查询web防护攻击事件 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebProtectionAttackEvents(request *DescribeWebProtectionAttackEventsRequest) (response *DescribeWebProtectionAttackEventsResponse, err error) { + return c.DescribeWebProtectionAttackEventsWithContext(context.Background(), request) +} + +// DescribeWebProtectionAttackEvents +// 查询web防护攻击事件 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebProtectionAttackEventsWithContext(ctx context.Context, request *DescribeWebProtectionAttackEventsRequest) (response *DescribeWebProtectionAttackEventsResponse, err error) { + if request == nil { + request = NewDescribeWebProtectionAttackEventsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebProtectionAttackEvents require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebProtectionAttackEventsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebProtectionDataRequest() (request *DescribeWebProtectionDataRequest) { + request = &DescribeWebProtectionDataRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebProtectionData") + + + return +} + +func NewDescribeWebProtectionDataResponse() (response *DescribeWebProtectionDataResponse) { + response = &DescribeWebProtectionDataResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebProtectionData +// 查询CC防护时序数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebProtectionData(request *DescribeWebProtectionDataRequest) (response *DescribeWebProtectionDataResponse, err error) { + return c.DescribeWebProtectionDataWithContext(context.Background(), request) +} + +// DescribeWebProtectionData +// 查询CC防护时序数据 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) DescribeWebProtectionDataWithContext(ctx context.Context, request *DescribeWebProtectionDataRequest) (response *DescribeWebProtectionDataResponse, err error) { + if request == nil { + request = NewDescribeWebProtectionDataRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebProtectionData require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebProtectionDataResponse() + err = c.Send(request, response) + return +} + +func NewDescribeWebProtectionLogRequest() (request *DescribeWebProtectionLogRequest) { + request = &DescribeWebProtectionLogRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeWebProtectionLog") + + + return +} + +func NewDescribeWebProtectionLogResponse() (response *DescribeWebProtectionLogResponse) { + response = &DescribeWebProtectionLogResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeWebProtectionLog +// 查询CC防护日志 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeWebProtectionLog(request *DescribeWebProtectionLogRequest) (response *DescribeWebProtectionLogResponse, err error) { + return c.DescribeWebProtectionLogWithContext(context.Background(), request) +} + +// DescribeWebProtectionLog +// 查询CC防护日志 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeWebProtectionLogWithContext(ctx context.Context, request *DescribeWebProtectionLogRequest) (response *DescribeWebProtectionLogResponse, err error) { + if request == nil { + request = NewDescribeWebProtectionLogRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeWebProtectionLog require credential") + } + + request.SetContext(ctx) + + response = NewDescribeWebProtectionLogResponse() + err = c.Send(request, response) + return +} + +func NewDescribeZoneDDoSPolicyRequest() (request *DescribeZoneDDoSPolicyRequest) { + request = &DescribeZoneDDoSPolicyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeZoneDDoSPolicy") + + + return +} + +func NewDescribeZoneDDoSPolicyResponse() (response *DescribeZoneDDoSPolicyResponse) { + response = &DescribeZoneDDoSPolicyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeZoneDDoSPolicy +// 查询所有DDoS防护分区 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeZoneDDoSPolicy(request *DescribeZoneDDoSPolicyRequest) (response *DescribeZoneDDoSPolicyResponse, err error) { + return c.DescribeZoneDDoSPolicyWithContext(context.Background(), request) +} + +// DescribeZoneDDoSPolicy +// 查询所有DDoS防护分区 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeZoneDDoSPolicyWithContext(ctx context.Context, request *DescribeZoneDDoSPolicyRequest) (response *DescribeZoneDDoSPolicyResponse, err error) { + if request == nil { + request = NewDescribeZoneDDoSPolicyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeZoneDDoSPolicy require credential") + } + + request.SetContext(ctx) + + response = NewDescribeZoneDDoSPolicyResponse() + err = c.Send(request, response) + return +} + +func NewDescribeZoneDetailsRequest() (request *DescribeZoneDetailsRequest) { + request = &DescribeZoneDetailsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeZoneDetails") + + + return +} + +func NewDescribeZoneDetailsResponse() (response *DescribeZoneDetailsResponse) { + response = &DescribeZoneDetailsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeZoneDetails +// 根据站点 ID 查询站点的详细信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeZoneDetails(request *DescribeZoneDetailsRequest) (response *DescribeZoneDetailsResponse, err error) { + return c.DescribeZoneDetailsWithContext(context.Background(), request) +} + +// DescribeZoneDetails +// 根据站点 ID 查询站点的详细信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DescribeZoneDetailsWithContext(ctx context.Context, request *DescribeZoneDetailsRequest) (response *DescribeZoneDetailsResponse, err error) { + if request == nil { + request = NewDescribeZoneDetailsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeZoneDetails require credential") + } + + request.SetContext(ctx) + + response = NewDescribeZoneDetailsResponse() + err = c.Send(request, response) + return +} + +func NewDescribeZoneSettingRequest() (request *DescribeZoneSettingRequest) { + request = &DescribeZoneSettingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeZoneSetting") + + + return +} + +func NewDescribeZoneSettingResponse() (response *DescribeZoneSettingResponse) { + response = &DescribeZoneSettingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeZoneSetting +// 用于查询站点的所有配置信息。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SETTINGINVALIDPARAM = "InvalidParameter.SettingInvalidParam" +// INVALIDPARAMETER_ZONENOTFOUND = "InvalidParameter.ZoneNotFound" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeZoneSetting(request *DescribeZoneSettingRequest) (response *DescribeZoneSettingResponse, err error) { + return c.DescribeZoneSettingWithContext(context.Background(), request) +} + +// DescribeZoneSetting +// 用于查询站点的所有配置信息。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SETTINGINVALIDPARAM = "InvalidParameter.SettingInvalidParam" +// INVALIDPARAMETER_ZONENOTFOUND = "InvalidParameter.ZoneNotFound" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeZoneSettingWithContext(ctx context.Context, request *DescribeZoneSettingRequest) (response *DescribeZoneSettingResponse, err error) { + if request == nil { + request = NewDescribeZoneSettingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeZoneSetting require credential") + } + + request.SetContext(ctx) + + response = NewDescribeZoneSettingResponse() + err = c.Send(request, response) + return +} + +func NewDescribeZonesRequest() (request *DescribeZonesRequest) { + request = &DescribeZonesRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeZones") + + + return +} + +func NewDescribeZonesResponse() (response *DescribeZonesResponse) { + response = &DescribeZonesResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeZones +// 用户查询用户站点信息列表,支持分页 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeZones(request *DescribeZonesRequest) (response *DescribeZonesResponse, err error) { + return c.DescribeZonesWithContext(context.Background(), request) +} + +// DescribeZones +// 用户查询用户站点信息列表,支持分页 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) DescribeZonesWithContext(ctx context.Context, request *DescribeZonesRequest) (response *DescribeZonesResponse, err error) { + if request == nil { + request = NewDescribeZonesRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeZones require credential") + } + + request.SetContext(ctx) + + response = NewDescribeZonesResponse() + err = c.Send(request, response) + return +} + +func NewDownloadL7LogsRequest() (request *DownloadL7LogsRequest) { + request = &DownloadL7LogsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DownloadL7Logs") + + + return +} + +func NewDownloadL7LogsResponse() (response *DownloadL7LogsResponse) { + response = &DownloadL7LogsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DownloadL7Logs +// 查询七层离线日志 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DownloadL7Logs(request *DownloadL7LogsRequest) (response *DownloadL7LogsResponse, err error) { + return c.DownloadL7LogsWithContext(context.Background(), request) +} + +// DownloadL7Logs +// 查询七层离线日志 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DownloadL7LogsWithContext(ctx context.Context, request *DownloadL7LogsRequest) (response *DownloadL7LogsResponse, err error) { + if request == nil { + request = NewDownloadL7LogsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DownloadL7Logs require credential") + } + + request.SetContext(ctx) + + response = NewDownloadL7LogsResponse() + err = c.Send(request, response) + return +} + +func NewIdentifyZoneRequest() (request *IdentifyZoneRequest) { + request = &IdentifyZoneRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "IdentifyZone") + + + return +} + +func NewIdentifyZoneResponse() (response *IdentifyZoneResponse) { + response = &IdentifyZoneResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// IdentifyZone +// 用于验证站点所有权 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) IdentifyZone(request *IdentifyZoneRequest) (response *IdentifyZoneResponse, err error) { + return c.IdentifyZoneWithContext(context.Background(), request) +} + +// IdentifyZone +// 用于验证站点所有权 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) IdentifyZoneWithContext(ctx context.Context, request *IdentifyZoneRequest) (response *IdentifyZoneResponse, err error) { + if request == nil { + request = NewIdentifyZoneRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("IdentifyZone require credential") + } + + request.SetContext(ctx) + + response = NewIdentifyZoneResponse() + err = c.Send(request, response) + return +} + +func NewImportDnsRecordsRequest() (request *ImportDnsRecordsRequest) { + request = &ImportDnsRecordsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ImportDnsRecords") + + + return +} + +func NewImportDnsRecordsResponse() (response *ImportDnsRecordsResponse) { + response = &ImportDnsRecordsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ImportDnsRecords +// 导入 DNS 记录 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ImportDnsRecords(request *ImportDnsRecordsRequest) (response *ImportDnsRecordsResponse, err error) { + return c.ImportDnsRecordsWithContext(context.Background(), request) +} + +// ImportDnsRecords +// 导入 DNS 记录 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ImportDnsRecordsWithContext(ctx context.Context, request *ImportDnsRecordsRequest) (response *ImportDnsRecordsResponse, err error) { + if request == nil { + request = NewImportDnsRecordsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ImportDnsRecords require credential") + } + + request.SetContext(ctx) + + response = NewImportDnsRecordsResponse() + err = c.Send(request, response) + return +} + +func NewModifyApplicationProxyRequest() (request *ModifyApplicationProxyRequest) { + request = &ModifyApplicationProxyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyApplicationProxy") + + + return +} + +func NewModifyApplicationProxyResponse() (response *ModifyApplicationProxyResponse) { + response = &ModifyApplicationProxyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyApplicationProxy +// 修改应用代理 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ModifyApplicationProxy(request *ModifyApplicationProxyRequest) (response *ModifyApplicationProxyResponse, err error) { + return c.ModifyApplicationProxyWithContext(context.Background(), request) +} + +// ModifyApplicationProxy +// 修改应用代理 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ModifyApplicationProxyWithContext(ctx context.Context, request *ModifyApplicationProxyRequest) (response *ModifyApplicationProxyResponse, err error) { + if request == nil { + request = NewModifyApplicationProxyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyApplicationProxy require credential") + } + + request.SetContext(ctx) + + response = NewModifyApplicationProxyResponse() + err = c.Send(request, response) + return +} + +func NewModifyApplicationProxyRuleRequest() (request *ModifyApplicationProxyRuleRequest) { + request = &ModifyApplicationProxyRuleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyApplicationProxyRule") + + + return +} + +func NewModifyApplicationProxyRuleResponse() (response *ModifyApplicationProxyRuleResponse) { + response = &ModifyApplicationProxyRuleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyApplicationProxyRule +// 修改应用代理规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) ModifyApplicationProxyRule(request *ModifyApplicationProxyRuleRequest) (response *ModifyApplicationProxyRuleResponse, err error) { + return c.ModifyApplicationProxyRuleWithContext(context.Background(), request) +} + +// ModifyApplicationProxyRule +// 修改应用代理规则 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) ModifyApplicationProxyRuleWithContext(ctx context.Context, request *ModifyApplicationProxyRuleRequest) (response *ModifyApplicationProxyRuleResponse, err error) { + if request == nil { + request = NewModifyApplicationProxyRuleRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyApplicationProxyRule require credential") + } + + request.SetContext(ctx) + + response = NewModifyApplicationProxyRuleResponse() + err = c.Send(request, response) + return +} + +func NewModifyApplicationProxyRuleStatusRequest() (request *ModifyApplicationProxyRuleStatusRequest) { + request = &ModifyApplicationProxyRuleStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyApplicationProxyRuleStatus") + + + return +} + +func NewModifyApplicationProxyRuleStatusResponse() (response *ModifyApplicationProxyRuleStatusResponse) { + response = &ModifyApplicationProxyRuleStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyApplicationProxyRuleStatus +// 修改应用代理规则的状态 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) ModifyApplicationProxyRuleStatus(request *ModifyApplicationProxyRuleStatusRequest) (response *ModifyApplicationProxyRuleStatusResponse, err error) { + return c.ModifyApplicationProxyRuleStatusWithContext(context.Background(), request) +} + +// ModifyApplicationProxyRuleStatus +// 修改应用代理规则的状态 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) ModifyApplicationProxyRuleStatusWithContext(ctx context.Context, request *ModifyApplicationProxyRuleStatusRequest) (response *ModifyApplicationProxyRuleStatusResponse, err error) { + if request == nil { + request = NewModifyApplicationProxyRuleStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyApplicationProxyRuleStatus require credential") + } + + request.SetContext(ctx) + + response = NewModifyApplicationProxyRuleStatusResponse() + err = c.Send(request, response) + return +} + +func NewModifyApplicationProxyStatusRequest() (request *ModifyApplicationProxyStatusRequest) { + request = &ModifyApplicationProxyStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyApplicationProxyStatus") + + + return +} + +func NewModifyApplicationProxyStatusResponse() (response *ModifyApplicationProxyStatusResponse) { + response = &ModifyApplicationProxyStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyApplicationProxyStatus +// 修改应用代理的状态 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) ModifyApplicationProxyStatus(request *ModifyApplicationProxyStatusRequest) (response *ModifyApplicationProxyStatusResponse, err error) { + return c.ModifyApplicationProxyStatusWithContext(context.Background(), request) +} + +// ModifyApplicationProxyStatus +// 修改应用代理的状态 +// +// 可能返回的错误码: +// INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" +func (c *Client) ModifyApplicationProxyStatusWithContext(ctx context.Context, request *ModifyApplicationProxyStatusRequest) (response *ModifyApplicationProxyStatusResponse, err error) { + if request == nil { + request = NewModifyApplicationProxyStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyApplicationProxyStatus require credential") + } + + request.SetContext(ctx) + + response = NewModifyApplicationProxyStatusResponse() + err = c.Send(request, response) + return +} + +func NewModifyDDoSPolicyRequest() (request *ModifyDDoSPolicyRequest) { + request = &ModifyDDoSPolicyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyDDoSPolicy") + + + return +} + +func NewModifyDDoSPolicyResponse() (response *ModifyDDoSPolicyResponse) { + response = &ModifyDDoSPolicyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyDDoSPolicy +// 修改DDoS防护分区配置 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) ModifyDDoSPolicy(request *ModifyDDoSPolicyRequest) (response *ModifyDDoSPolicyResponse, err error) { + return c.ModifyDDoSPolicyWithContext(context.Background(), request) +} + +// ModifyDDoSPolicy +// 修改DDoS防护分区配置 +// +// 可能返回的错误码: +// INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" +func (c *Client) ModifyDDoSPolicyWithContext(ctx context.Context, request *ModifyDDoSPolicyRequest) (response *ModifyDDoSPolicyResponse, err error) { + if request == nil { + request = NewModifyDDoSPolicyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyDDoSPolicy require credential") + } + + request.SetContext(ctx) + + response = NewModifyDDoSPolicyResponse() + err = c.Send(request, response) + return +} + +func NewModifyDDoSPolicyHostRequest() (request *ModifyDDoSPolicyHostRequest) { + request = &ModifyDDoSPolicyHostRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyDDoSPolicyHost") + + + return +} + +func NewModifyDDoSPolicyHostResponse() (response *ModifyDDoSPolicyHostResponse) { + response = &ModifyDDoSPolicyHostResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyDDoSPolicyHost +// 域名DDoS高可用开关 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +func (c *Client) ModifyDDoSPolicyHost(request *ModifyDDoSPolicyHostRequest) (response *ModifyDDoSPolicyHostResponse, err error) { + return c.ModifyDDoSPolicyHostWithContext(context.Background(), request) +} + +// ModifyDDoSPolicyHost +// 域名DDoS高可用开关 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +func (c *Client) ModifyDDoSPolicyHostWithContext(ctx context.Context, request *ModifyDDoSPolicyHostRequest) (response *ModifyDDoSPolicyHostResponse, err error) { + if request == nil { + request = NewModifyDDoSPolicyHostRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyDDoSPolicyHost require credential") + } + + request.SetContext(ctx) + + response = NewModifyDDoSPolicyHostResponse() + err = c.Send(request, response) + return +} + +func NewModifyDefaultCertificateRequest() (request *ModifyDefaultCertificateRequest) { + request = &ModifyDefaultCertificateRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyDefaultCertificate") + + + return +} + +func NewModifyDefaultCertificateResponse() (response *ModifyDefaultCertificateResponse) { + response = &ModifyDefaultCertificateResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyDefaultCertificate +// 修改默认证书状态 +// +// 可能返回的错误码: +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE_CERTNOTFOUND = "ResourceUnavailable.CertNotFound" +func (c *Client) ModifyDefaultCertificate(request *ModifyDefaultCertificateRequest) (response *ModifyDefaultCertificateResponse, err error) { + return c.ModifyDefaultCertificateWithContext(context.Background(), request) +} + +// ModifyDefaultCertificate +// 修改默认证书状态 +// +// 可能返回的错误码: +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE_CERTNOTFOUND = "ResourceUnavailable.CertNotFound" +func (c *Client) ModifyDefaultCertificateWithContext(ctx context.Context, request *ModifyDefaultCertificateRequest) (response *ModifyDefaultCertificateResponse, err error) { + if request == nil { + request = NewModifyDefaultCertificateRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyDefaultCertificate require credential") + } + + request.SetContext(ctx) + + response = NewModifyDefaultCertificateResponse() + err = c.Send(request, response) + return +} + +func NewModifyDnsRecordRequest() (request *ModifyDnsRecordRequest) { + request = &ModifyDnsRecordRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyDnsRecord") + + + return +} + +func NewModifyDnsRecordResponse() (response *ModifyDnsRecordResponse) { + response = &ModifyDnsRecordResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyDnsRecord +// 修改 DNS 记录 +// +// 可能返回的错误码: +// INVALIDPARAMETERVALUE_INVALIDDNSCONTENT = "InvalidParameterValue.InvalidDNSContent" +// INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" +// INVALIDPARAMETERVALUE_RECORDALREADYEXISTS = "InvalidParameterValue.RecordAlreadyExists" +// INVALIDPARAMETERVALUE_RECORDNOTALLOWED = "InvalidParameterValue.RecordNotAllowed" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) ModifyDnsRecord(request *ModifyDnsRecordRequest) (response *ModifyDnsRecordResponse, err error) { + return c.ModifyDnsRecordWithContext(context.Background(), request) +} + +// ModifyDnsRecord +// 修改 DNS 记录 +// +// 可能返回的错误码: +// INVALIDPARAMETERVALUE_INVALIDDNSCONTENT = "InvalidParameterValue.InvalidDNSContent" +// INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" +// INVALIDPARAMETERVALUE_RECORDALREADYEXISTS = "InvalidParameterValue.RecordAlreadyExists" +// INVALIDPARAMETERVALUE_RECORDNOTALLOWED = "InvalidParameterValue.RecordNotAllowed" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEINUSE = "ResourceInUse" +// RESOURCENOTFOUND = "ResourceNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) ModifyDnsRecordWithContext(ctx context.Context, request *ModifyDnsRecordRequest) (response *ModifyDnsRecordResponse, err error) { + if request == nil { + request = NewModifyDnsRecordRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyDnsRecord require credential") + } + + request.SetContext(ctx) + + response = NewModifyDnsRecordResponse() + err = c.Send(request, response) + return +} + +func NewModifyDnssecRequest() (request *ModifyDnssecRequest) { + request = &ModifyDnssecRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyDnssec") + + + return +} + +func NewModifyDnssecResponse() (response *ModifyDnssecResponse) { + response = &ModifyDnssecResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyDnssec +// 修改 DNSSEC 状态 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +func (c *Client) ModifyDnssec(request *ModifyDnssecRequest) (response *ModifyDnssecResponse, err error) { + return c.ModifyDnssecWithContext(context.Background(), request) +} + +// ModifyDnssec +// 修改 DNSSEC 状态 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +func (c *Client) ModifyDnssecWithContext(ctx context.Context, request *ModifyDnssecRequest) (response *ModifyDnssecResponse, err error) { + if request == nil { + request = NewModifyDnssecRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyDnssec require credential") + } + + request.SetContext(ctx) + + response = NewModifyDnssecResponse() + err = c.Send(request, response) + return +} + +func NewModifyHostsCertificateRequest() (request *ModifyHostsCertificateRequest) { + request = &ModifyHostsCertificateRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyHostsCertificate") + + + return +} + +func NewModifyHostsCertificateResponse() (response *ModifyHostsCertificateResponse) { + response = &ModifyHostsCertificateResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyHostsCertificate +// 用于修改域名证书 +// +// 可能返回的错误码: +// FAILEDOPERATION_CERTIFICATENOTFOUND = "FailedOperation.CertificateNotFound" +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INVALIDPARAMETER_INVALIDCERTINFO = "InvalidParameter.InvalidCertInfo" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE_HOSTNOTFOUND = "ResourceUnavailable.HostNotFound" +func (c *Client) ModifyHostsCertificate(request *ModifyHostsCertificateRequest) (response *ModifyHostsCertificateResponse, err error) { + return c.ModifyHostsCertificateWithContext(context.Background(), request) +} + +// ModifyHostsCertificate +// 用于修改域名证书 +// +// 可能返回的错误码: +// FAILEDOPERATION_CERTIFICATENOTFOUND = "FailedOperation.CertificateNotFound" +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INVALIDPARAMETER_INVALIDCERTINFO = "InvalidParameter.InvalidCertInfo" +// OPERATIONDENIED = "OperationDenied" +// RESOURCEUNAVAILABLE_HOSTNOTFOUND = "ResourceUnavailable.HostNotFound" +func (c *Client) ModifyHostsCertificateWithContext(ctx context.Context, request *ModifyHostsCertificateRequest) (response *ModifyHostsCertificateResponse, err error) { + if request == nil { + request = NewModifyHostsCertificateRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyHostsCertificate require credential") + } + + request.SetContext(ctx) + + response = NewModifyHostsCertificateResponse() + err = c.Send(request, response) + return +} + +func NewModifyLoadBalancingRequest() (request *ModifyLoadBalancingRequest) { + request = &ModifyLoadBalancingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyLoadBalancing") + + + return +} + +func NewModifyLoadBalancingResponse() (response *ModifyLoadBalancingResponse) { + response = &ModifyLoadBalancingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyLoadBalancing +// 修改负载均衡 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) ModifyLoadBalancing(request *ModifyLoadBalancingRequest) (response *ModifyLoadBalancingResponse, err error) { + return c.ModifyLoadBalancingWithContext(context.Background(), request) +} + +// ModifyLoadBalancing +// 修改负载均衡 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) ModifyLoadBalancingWithContext(ctx context.Context, request *ModifyLoadBalancingRequest) (response *ModifyLoadBalancingResponse, err error) { + if request == nil { + request = NewModifyLoadBalancingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyLoadBalancing require credential") + } + + request.SetContext(ctx) + + response = NewModifyLoadBalancingResponse() + err = c.Send(request, response) + return +} + +func NewModifyLoadBalancingStatusRequest() (request *ModifyLoadBalancingStatusRequest) { + request = &ModifyLoadBalancingStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyLoadBalancingStatus") + + + return +} + +func NewModifyLoadBalancingStatusResponse() (response *ModifyLoadBalancingStatusResponse) { + response = &ModifyLoadBalancingStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyLoadBalancingStatus +// 修改负载均衡状态 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) ModifyLoadBalancingStatus(request *ModifyLoadBalancingStatusRequest) (response *ModifyLoadBalancingStatusResponse, err error) { + return c.ModifyLoadBalancingStatusWithContext(context.Background(), request) +} + +// ModifyLoadBalancingStatus +// 修改负载均衡状态 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) ModifyLoadBalancingStatusWithContext(ctx context.Context, request *ModifyLoadBalancingStatusRequest) (response *ModifyLoadBalancingStatusResponse, err error) { + if request == nil { + request = NewModifyLoadBalancingStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyLoadBalancingStatus require credential") + } + + request.SetContext(ctx) + + response = NewModifyLoadBalancingStatusResponse() + err = c.Send(request, response) + return +} + +func NewModifyOriginGroupRequest() (request *ModifyOriginGroupRequest) { + request = &ModifyOriginGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyOriginGroup") + + + return +} + +func NewModifyOriginGroupResponse() (response *ModifyOriginGroupResponse) { + response = &ModifyOriginGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyOriginGroup +// 源站组修改 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) ModifyOriginGroup(request *ModifyOriginGroupRequest) (response *ModifyOriginGroupResponse, err error) { + return c.ModifyOriginGroupWithContext(context.Background(), request) +} + +// ModifyOriginGroup +// 源站组修改 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +func (c *Client) ModifyOriginGroupWithContext(ctx context.Context, request *ModifyOriginGroupRequest) (response *ModifyOriginGroupResponse, err error) { + if request == nil { + request = NewModifyOriginGroupRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyOriginGroup require credential") + } + + request.SetContext(ctx) + + response = NewModifyOriginGroupResponse() + err = c.Send(request, response) + return +} + +func NewModifyRuleRequest() (request *ModifyRuleRequest) { + request = &ModifyRuleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyRule") + + + return +} + +func NewModifyRuleResponse() (response *ModifyRuleResponse) { + response = &ModifyRuleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyRule +// 修改规则引擎规则。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDRULEENGINETARGETSEXTENSION = "InvalidParameter.InvalidRuleEngineTargetsExtension" +func (c *Client) ModifyRule(request *ModifyRuleRequest) (response *ModifyRuleResponse, err error) { + return c.ModifyRuleWithContext(context.Background(), request) +} + +// ModifyRule +// 修改规则引擎规则。 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDRULEENGINETARGETSEXTENSION = "InvalidParameter.InvalidRuleEngineTargetsExtension" +func (c *Client) ModifyRuleWithContext(ctx context.Context, request *ModifyRuleRequest) (response *ModifyRuleResponse, err error) { + if request == nil { + request = NewModifyRuleRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyRule require credential") + } + + request.SetContext(ctx) + + response = NewModifyRuleResponse() + err = c.Send(request, response) + return +} + +func NewModifyRulePriorityRequest() (request *ModifyRulePriorityRequest) { + request = &ModifyRulePriorityRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyRulePriority") + + + return +} + +func NewModifyRulePriorityResponse() (response *ModifyRulePriorityResponse) { + response = &ModifyRulePriorityResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyRulePriority +// 修改规则引擎规则优先级 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDRULEENGINETARGETSEXTENSION = "InvalidParameter.InvalidRuleEngineTargetsExtension" +func (c *Client) ModifyRulePriority(request *ModifyRulePriorityRequest) (response *ModifyRulePriorityResponse, err error) { + return c.ModifyRulePriorityWithContext(context.Background(), request) +} + +// ModifyRulePriority +// 修改规则引擎规则优先级 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDRULEENGINETARGETSEXTENSION = "InvalidParameter.InvalidRuleEngineTargetsExtension" +func (c *Client) ModifyRulePriorityWithContext(ctx context.Context, request *ModifyRulePriorityRequest) (response *ModifyRulePriorityResponse, err error) { + if request == nil { + request = NewModifyRulePriorityRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyRulePriority require credential") + } + + request.SetContext(ctx) + + response = NewModifyRulePriorityResponse() + err = c.Send(request, response) + return +} + +func NewModifySecurityPolicyRequest() (request *ModifySecurityPolicyRequest) { + request = &ModifySecurityPolicyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifySecurityPolicy") + + + return +} + +func NewModifySecurityPolicyResponse() (response *ModifySecurityPolicyResponse) { + response = &ModifySecurityPolicyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifySecurityPolicy +// 修改Web&Bot安全配置 +// +// 可能返回的错误码: +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) ModifySecurityPolicy(request *ModifySecurityPolicyRequest) (response *ModifySecurityPolicyResponse, err error) { + return c.ModifySecurityPolicyWithContext(context.Background(), request) +} + +// ModifySecurityPolicy +// 修改Web&Bot安全配置 +// +// 可能返回的错误码: +// INTERNALERROR_ROUTEERROR = "InternalError.RouteError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) ModifySecurityPolicyWithContext(ctx context.Context, request *ModifySecurityPolicyRequest) (response *ModifySecurityPolicyResponse, err error) { + if request == nil { + request = NewModifySecurityPolicyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifySecurityPolicy require credential") + } + + request.SetContext(ctx) + + response = NewModifySecurityPolicyResponse() + err = c.Send(request, response) + return +} + +func NewModifyZoneRequest() (request *ModifyZoneRequest) { + request = &ModifyZoneRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyZone") + + + return +} + +func NewModifyZoneResponse() (response *ModifyZoneResponse) { + response = &ModifyZoneResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyZone +// 用该站点信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ModifyZone(request *ModifyZoneRequest) (response *ModifyZoneResponse, err error) { + return c.ModifyZoneWithContext(context.Background(), request) +} + +// ModifyZone +// 用该站点信息 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ModifyZoneWithContext(ctx context.Context, request *ModifyZoneRequest) (response *ModifyZoneResponse, err error) { + if request == nil { + request = NewModifyZoneRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyZone require credential") + } + + request.SetContext(ctx) + + response = NewModifyZoneResponse() + err = c.Send(request, response) + return +} + +func NewModifyZoneCnameSpeedUpRequest() (request *ModifyZoneCnameSpeedUpRequest) { + request = &ModifyZoneCnameSpeedUpRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyZoneCnameSpeedUp") + + + return +} + +func NewModifyZoneCnameSpeedUpResponse() (response *ModifyZoneCnameSpeedUpResponse) { + response = &ModifyZoneCnameSpeedUpResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyZoneCnameSpeedUp +// 开启,关闭 CNAME 加速 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ModifyZoneCnameSpeedUp(request *ModifyZoneCnameSpeedUpRequest) (response *ModifyZoneCnameSpeedUpResponse, err error) { + return c.ModifyZoneCnameSpeedUpWithContext(context.Background(), request) +} + +// ModifyZoneCnameSpeedUp +// 开启,关闭 CNAME 加速 +// +// 可能返回的错误码: +// OPERATIONDENIED = "OperationDenied" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ModifyZoneCnameSpeedUpWithContext(ctx context.Context, request *ModifyZoneCnameSpeedUpRequest) (response *ModifyZoneCnameSpeedUpResponse, err error) { + if request == nil { + request = NewModifyZoneCnameSpeedUpRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyZoneCnameSpeedUp require credential") + } + + request.SetContext(ctx) + + response = NewModifyZoneCnameSpeedUpResponse() + err = c.Send(request, response) + return +} + +func NewModifyZoneSettingRequest() (request *ModifyZoneSettingRequest) { + request = &ModifyZoneSettingRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyZoneSetting") + + + return +} + +func NewModifyZoneSettingResponse() (response *ModifyZoneSettingResponse) { + response = &ModifyZoneSettingResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyZoneSetting +// 用于修改站点配置 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDCACHEONLYONSWITCH = "InvalidParameter.InvalidCacheOnlyOnSwitch" +// INVALIDPARAMETER_INVALIDCLIENTIPHEADERNAME = "InvalidParameter.InvalidClientIpHeaderName" +// INVALIDPARAMETER_INVALIDDYNAMICROUTINEBILLING = "InvalidParameter.InvalidDynamicRoutineBilling" +// INVALIDPARAMETER_INVALIDORIGIN = "InvalidParameter.InvalidOrigin" +// INVALIDPARAMETER_INVALIDPOSTMAXSIZEBILLING = "InvalidParameter.InvalidPostMaxSizeBilling" +// INVALIDPARAMETER_INVALIDREQUESTHEADERNAME = "InvalidParameter.InvalidRequestHeaderName" +// INVALIDPARAMETER_INVALIDRESOURCEIDBILLING = "InvalidParameter.InvalidResourceIdBilling" +// INVALIDPARAMETER_INVALIDWEBSOCKETTIMEOUT = "InvalidParameter.InvalidWebSocketTimeout" +// INVALIDPARAMETER_SETTINGINVALIDPARAM = "InvalidParameter.SettingInvalidParam" +// INVALIDPARAMETER_ZONENOTFOUND = "InvalidParameter.ZoneNotFound" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) ModifyZoneSetting(request *ModifyZoneSettingRequest) (response *ModifyZoneSettingResponse, err error) { + return c.ModifyZoneSettingWithContext(context.Background(), request) +} + +// ModifyZoneSetting +// 用于修改站点配置 +// +// 可能返回的错误码: +// INVALIDPARAMETER_INVALIDCACHEONLYONSWITCH = "InvalidParameter.InvalidCacheOnlyOnSwitch" +// INVALIDPARAMETER_INVALIDCLIENTIPHEADERNAME = "InvalidParameter.InvalidClientIpHeaderName" +// INVALIDPARAMETER_INVALIDDYNAMICROUTINEBILLING = "InvalidParameter.InvalidDynamicRoutineBilling" +// INVALIDPARAMETER_INVALIDORIGIN = "InvalidParameter.InvalidOrigin" +// INVALIDPARAMETER_INVALIDPOSTMAXSIZEBILLING = "InvalidParameter.InvalidPostMaxSizeBilling" +// INVALIDPARAMETER_INVALIDREQUESTHEADERNAME = "InvalidParameter.InvalidRequestHeaderName" +// INVALIDPARAMETER_INVALIDRESOURCEIDBILLING = "InvalidParameter.InvalidResourceIdBilling" +// INVALIDPARAMETER_INVALIDWEBSOCKETTIMEOUT = "InvalidParameter.InvalidWebSocketTimeout" +// INVALIDPARAMETER_SETTINGINVALIDPARAM = "InvalidParameter.SettingInvalidParam" +// INVALIDPARAMETER_ZONENOTFOUND = "InvalidParameter.ZoneNotFound" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) ModifyZoneSettingWithContext(ctx context.Context, request *ModifyZoneSettingRequest) (response *ModifyZoneSettingResponse, err error) { + if request == nil { + request = NewModifyZoneSettingRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyZoneSetting require credential") + } + + request.SetContext(ctx) + + response = NewModifyZoneSettingResponse() + err = c.Send(request, response) + return +} + +func NewModifyZoneStatusRequest() (request *ModifyZoneStatusRequest) { + request = &ModifyZoneStatusRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyZoneStatus") + + + return +} + +func NewModifyZoneStatusResponse() (response *ModifyZoneStatusResponse) { + response = &ModifyZoneStatusResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ModifyZoneStatus +// 用于开启,关闭站点 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ModifyZoneStatus(request *ModifyZoneStatusRequest) (response *ModifyZoneStatusResponse, err error) { + return c.ModifyZoneStatusWithContext(context.Background(), request) +} + +// ModifyZoneStatus +// 用于开启,关闭站点 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ModifyZoneStatusWithContext(ctx context.Context, request *ModifyZoneStatusRequest) (response *ModifyZoneStatusResponse, err error) { + if request == nil { + request = NewModifyZoneStatusRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyZoneStatus require credential") + } + + request.SetContext(ctx) + + response = NewModifyZoneStatusResponse() + err = c.Send(request, response) + return +} + +func NewReclaimZoneRequest() (request *ReclaimZoneRequest) { + request = &ReclaimZoneRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ReclaimZone") + + + return +} + +func NewReclaimZoneResponse() (response *ReclaimZoneResponse) { + response = &ReclaimZoneResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ReclaimZone +// 站点被其他用户接入后,验证了站点所有权之后,可以找回该站点 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ReclaimZone(request *ReclaimZoneRequest) (response *ReclaimZoneResponse, err error) { + return c.ReclaimZoneWithContext(context.Background(), request) +} + +// ReclaimZone +// 站点被其他用户接入后,验证了站点所有权之后,可以找回该站点 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ReclaimZoneWithContext(ctx context.Context, request *ReclaimZoneRequest) (response *ReclaimZoneResponse, err error) { + if request == nil { + request = NewReclaimZoneRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ReclaimZone require credential") + } + + request.SetContext(ctx) + + response = NewReclaimZoneResponse() + err = c.Send(request, response) + return +} + +func NewScanDnsRecordsRequest() (request *ScanDnsRecordsRequest) { + request = &ScanDnsRecordsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ScanDnsRecords") + + + return +} + +func NewScanDnsRecordsResponse() (response *ScanDnsRecordsResponse) { + response = &ScanDnsRecordsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// ScanDnsRecords +// 扫描站点历史解析记录 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ScanDnsRecords(request *ScanDnsRecordsRequest) (response *ScanDnsRecordsResponse, err error) { + return c.ScanDnsRecordsWithContext(context.Background(), request) +} + +// ScanDnsRecords +// 扫描站点历史解析记录 +// +// 可能返回的错误码: +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +func (c *Client) ScanDnsRecordsWithContext(ctx context.Context, request *ScanDnsRecordsRequest) (response *ScanDnsRecordsResponse, err error) { + if request == nil { + request = NewScanDnsRecordsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ScanDnsRecords require credential") + } + + request.SetContext(ctx) + + response = NewScanDnsRecordsResponse() + err = c.Send(request, response) + return +} diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/errors.go new file mode 100644 index 0000000000..ced4592f31 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/errors.go @@ -0,0 +1,196 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20220106 + +const ( + // 此产品的特有错误码 + + // DryRun 操作,代表请求将会是成功的,只是多传了 DryRun 参数。 + DRYRUNOPERATION = "DryRunOperation" + + // 操作失败。 + FAILEDOPERATION = "FailedOperation" + + // 证书不存在。 + FAILEDOPERATION_CERTIFICATENOTFOUND = "FailedOperation.CertificateNotFound" + + // 内部错误。 + INTERNALERROR = "InternalError" + + // 后台处理出错。 + INTERNALERROR_BACKENDERROR = "InternalError.BackendError" + + // 数据库错误。 + INTERNALERROR_DBERROR = "InternalError.DBError" + + // 获取配置失败。 + INTERNALERROR_DOMAINCONFIG = "InternalError.DomainConfig" + + // 上传链接生成失败。 + INTERNALERROR_FAILEDTOGENERATEURL = "InternalError.FailedToGenerateUrl" + + // 获取角色失败。 + INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" + + // 后端服务器发生未知错误。 + INTERNALERROR_PROXYSERVER = "InternalError.ProxyServer" + + // 配额系统处理失败。 + INTERNALERROR_QUOTASYSTEM = "InternalError.QuotaSystem" + + // 后端服务路由地址错误。 + INTERNALERROR_ROUTEERROR = "InternalError.RouteError" + + // 内部错误。 + INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" + + // 参数错误。 + INVALIDPARAMETER = "InvalidParameter" + + // 域名不存在或不属于该账号。 + INVALIDPARAMETER_DOMAINNOTFOUND = "InvalidParameter.DomainNotFound" + + // 无效的节点缓存。 + INVALIDPARAMETER_INVALIDCACHEONLYONSWITCH = "InvalidParameter.InvalidCacheOnlyOnSwitch" + + // 证书信息错误。 + INVALIDPARAMETER_INVALIDCERTINFO = "InvalidParameter.InvalidCertInfo" + + // 无效的客户端IP请求头。 + INVALIDPARAMETER_INVALIDCLIENTIPHEADERNAME = "InvalidParameter.InvalidClientIpHeaderName" + + // 套餐包不支持智能加速配置。 + INVALIDPARAMETER_INVALIDDYNAMICROUTINEBILLING = "InvalidParameter.InvalidDynamicRoutineBilling" + + // 无效的源站。 + INVALIDPARAMETER_INVALIDORIGIN = "InvalidParameter.InvalidOrigin" + + // 套餐包不支持最大上传大小。 + INVALIDPARAMETER_INVALIDPOSTMAXSIZEBILLING = "InvalidParameter.InvalidPostMaxSizeBilling" + + // 无效的请求头header。 + INVALIDPARAMETER_INVALIDREQUESTHEADERNAME = "InvalidParameter.InvalidRequestHeaderName" + + // 无套餐包。 + INVALIDPARAMETER_INVALIDRESOURCEIDBILLING = "InvalidParameter.InvalidResourceIdBilling" + + // 无效的规则引擎条件。 + INVALIDPARAMETER_INVALIDRULEENGINETARGET = "InvalidParameter.InvalidRuleEngineTarget" + + // 无效的规则引擎文件后缀条件。 + INVALIDPARAMETER_INVALIDRULEENGINETARGETSEXTENSION = "InvalidParameter.InvalidRuleEngineTargetsExtension" + + // 无效的WebSocket。 + INVALIDPARAMETER_INVALIDWEBSOCKETTIMEOUT = "InvalidParameter.InvalidWebSocketTimeout" + + // 参数错误。 + INVALIDPARAMETER_PARAMETERERROR = "InvalidParameter.ParameterError" + + // 参数错误 + INVALIDPARAMETER_SECURITY = "InvalidParameter.Security" + + // 域名配置错误。 + INVALIDPARAMETER_SETTINGINVALIDPARAM = "InvalidParameter.SettingInvalidParam" + + // 资源存在错误。 + INVALIDPARAMETER_TARGET = "InvalidParameter.Target" + + // 任务无法生成。 + INVALIDPARAMETER_TASKNOTGENERATED = "InvalidParameter.TaskNotGenerated" + + // 文件上传链接存在问题。 + INVALIDPARAMETER_UPLOADURL = "InvalidParameter.UploadUrl" + + // 站点不存在。 + INVALIDPARAMETER_ZONENOTFOUND = "InvalidParameter.ZoneNotFound" + + // 与已经添加的记录冲突。 + INVALIDPARAMETERVALUE_CONFLICTRECORD = "InvalidParameterValue.ConflictRecord" + + // DNS 记录与 DNSSEC 功能冲突。 + INVALIDPARAMETERVALUE_CONFLICTWITHDNSSEC = "InvalidParameterValue.ConflictWithDNSSEC" + + // DNS 记录与 LB 记录冲突。 + INVALIDPARAMETERVALUE_CONFLICTWITHLBRECORD = "InvalidParameterValue.ConflictWithLBRecord" + + // DNS 记录与 NS 记录冲突。 + INVALIDPARAMETERVALUE_CONFLICTWITHNSRECORD = "InvalidParameterValue.ConflictWithNSRecord" + + // DNS 记录内容错误。 + INVALIDPARAMETERVALUE_INVALIDDNSCONTENT = "InvalidParameterValue.InvalidDNSContent" + + // DNS 记录名称错误。 + INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" + + // DNS 代理域名错误。 + INVALIDPARAMETERVALUE_INVALIDPROXYNAME = "InvalidParameterValue.InvalidProxyName" + + // DNS 代理域名源站错误。 + INVALIDPARAMETERVALUE_INVALIDPROXYORIGIN = "InvalidParameterValue.InvalidProxyOrigin" + + // 记录已存在。 + INVALIDPARAMETERVALUE_RECORDALREADYEXISTS = "InvalidParameterValue.RecordAlreadyExists" + + // 记录不允许添加。 + INVALIDPARAMETERVALUE_RECORDNOTALLOWED = "InvalidParameterValue.RecordNotAllowed" + + // 超过配额限制。 + LIMITEXCEEDED = "LimitExceeded" + + // 本次提交的资源数超过上限。 + LIMITEXCEEDED_BATCHQUOTA = "LimitExceeded.BatchQuota" + + // 当天提交的资源数超过上限。 + LIMITEXCEEDED_DAILYQUOTA = "LimitExceeded.DailyQuota" + + // 操作被拒绝。 + OPERATIONDENIED = "OperationDenied" + + // 域名尚未备案。 + OPERATIONDENIED_DOMAINNOICP = "OperationDenied.DomainNoICP" + + // 资源被占用。 + RESOURCEINUSE = "ResourceInUse" + + // 资源被其他用户接入。 + RESOURCEINUSE_OTHERS = "ResourceInUse.Others" + + // 资源不足。 + RESOURCEINSUFFICIENT = "ResourceInsufficient" + + // 资源不存在。 + RESOURCENOTFOUND = "ResourceNotFound" + + // 资源不可用。 + RESOURCEUNAVAILABLE = "ResourceUnavailable" + + // 证书不存在或未授权。 + RESOURCEUNAVAILABLE_CERTNOTFOUND = "ResourceUnavailable.CertNotFound" + + // 域名不存在或未开启代理。 + RESOURCEUNAVAILABLE_HOSTNOTFOUND = "ResourceUnavailable.HostNotFound" + + // 站点不存在或不属于该账号。 + RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" + + // Cam 未授权。 + UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" + + // 鉴权错误。 + UNAUTHORIZEDOPERATION_DOMAINEMPTY = "UnauthorizedOperation.DomainEmpty" + + // 子账户没有操作权限,请添加权限后继续操作。 + UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +) diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/models.go new file mode 100644 index 0000000000..4dc9141090 --- /dev/null +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106/models.go @@ -0,0 +1,12112 @@ +// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v20220106 + +import ( + "encoding/json" + tcerr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" +) + +type ACLCondition struct { + // 匹配字段 + MatchFrom *string `json:"MatchFrom,omitempty" name:"MatchFrom"` + + // 匹配字符串 + MatchParam *string `json:"MatchParam,omitempty" name:"MatchParam"` + + // 匹配关系 + Operator *string `json:"Operator,omitempty" name:"Operator"` + + // 匹配内容 + MatchContent *string `json:"MatchContent,omitempty" name:"MatchContent"` +} + +type ACLUserRule struct { + // 规则名 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 动作 + Action *string `json:"Action,omitempty" name:"Action"` + + // 状态 + RuleStatus *string `json:"RuleStatus,omitempty" name:"RuleStatus"` + + // ACL规则 + Conditions []*ACLCondition `json:"Conditions,omitempty" name:"Conditions"` + + // 规则优先级 + RulePriority *int64 `json:"RulePriority,omitempty" name:"RulePriority"` + + // 规则id + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleID *int64 `json:"RuleID,omitempty" name:"RuleID"` + + // 更新时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // ip封禁的惩罚时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + PunishTime *int64 `json:"PunishTime,omitempty" name:"PunishTime"` + + // ip封禁的惩罚时间单位 + // 注意:此字段可能返回 null,表示取不到有效值。 + PunishTimeUnit *string `json:"PunishTimeUnit,omitempty" name:"PunishTimeUnit"` + + // 自定义返回页面的名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 自定义返回页面的实例id + // 注意:此字段可能返回 null,表示取不到有效值。 + PageId *int64 `json:"PageId,omitempty" name:"PageId"` + + // 重定向时候的地址,必须为本用户接入的站点子域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + RedirectUrl *string `json:"RedirectUrl,omitempty" name:"RedirectUrl"` + + // 重定向时候的返回码 + // 注意:此字段可能返回 null,表示取不到有效值。 + ResponseCode *int64 `json:"ResponseCode,omitempty" name:"ResponseCode"` +} + +type AclConfig struct { + // 开关 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // ACL用户规则 + UserRules []*ACLUserRule `json:"UserRules,omitempty" name:"UserRules"` +} + +type AiRule struct { + // smart_status_close-关闭;smart_status_open-拦截处置; + // smart_status_observe-观察处置 + // 注意:此字段可能返回 null,表示取不到有效值。 + Mode *string `json:"Mode,omitempty" name:"Mode"` +} + +type ApplicationProxy struct { + // 代理ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 当ProxyType=hostname时,表示域名或子域名; + // 当ProxyType=instance时,表示代理名称。 + ProxyName *string `json:"ProxyName,omitempty" name:"ProxyName"` + + // 调度模式,取值有: + //
  • ip:表示Anycast IP调度;
  • + //
  • domain:表示CNAME调度。
  • + PlatType *string `json:"PlatType,omitempty" name:"PlatType"` + + // 是否开启安全,取值有: + //
  • 0:关闭安全;
  • + //
  • 1:开启安全。
  • + SecurityType *int64 `json:"SecurityType,omitempty" name:"SecurityType"` + + // 是否开启加速,取值有: + //
  • 0:关闭加速;
  • + //
  • 1:开启加速。
  • + AccelerateType *int64 `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 字段已经废弃。 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 字段已经废弃。 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` + + // 规则列表。 + Rule []*ApplicationProxyRule `json:"Rule,omitempty" name:"Rule"` + + // 状态,取值有: + //
  • online:启用;
  • + //
  • offline:停用;
  • + //
  • progress:部署中;
  • + //
  • stopping:停用中;
  • + //
  • fail:部署失败/停用失败。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 调度信息。 + ScheduleValue []*string `json:"ScheduleValue,omitempty" name:"ScheduleValue"` + + // 更新时间。 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称。 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 会话保持时间。 + SessionPersistTime *uint64 `json:"SessionPersistTime,omitempty" name:"SessionPersistTime"` + + // 四层代理模式,取值有: + //
  • hostname:表示子域名模式;
  • + //
  • instance:表示实例模式。
  • + ProxyType *string `json:"ProxyType,omitempty" name:"ProxyType"` + + // 当ProxyType=hostname时: + // 表示代理加速唯一标识。 + HostId *string `json:"HostId,omitempty" name:"HostId"` + + // Ipv6访问配置。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + // 默认值:overseas + Area *string `json:"Area,omitempty" name:"Area"` + + // 封禁状态,取值有: + //
  • banned:已封禁;
  • + //
  • banning:封禁中;
  • + //
  • recover:已解封;
  • + //
  • recovering:解封禁中。
  • + BanStatus *string `json:"BanStatus,omitempty" name:"BanStatus"` +} + +type ApplicationProxyRule struct { + // 协议,取值有: + //
  • TCP:TCP协议;
  • + //
  • UDP:UDP协议。
  • + Proto *string `json:"Proto,omitempty" name:"Proto"` + + // 端口,支持格式: + // 单个端口,如:80。 + // 端口段,如:81-82。表示81,82两个端口。 + // 注意:一条规则最多可填写20个端口。 + Port []*string `json:"Port,omitempty" name:"Port"` + + // 源站类型,取值有: + //
  • custom:手动添加;
  • + //
  • origins:源站组。
  • + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 源站信息: + // 当OriginType=custom时,表示一个或多个源站,如: + // OriginValue=["8.8.8.8:80","9.9.9.9:80"] + // OriginValue=["test.com:80"]; + // 当OriginType=origins时,要求有且仅有一个元素,表示源站组ID,如: + // OriginValue=["origin-537f5b41-162a-11ed-abaa-525400c5da15"]。 + OriginValue []*string `json:"OriginValue,omitempty" name:"OriginValue"` + + // 规则ID。 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 状态,取值有: + //
  • online:启用;
  • + //
  • offline:停用;
  • + //
  • progress:部署中;
  • + //
  • stopping:停用中;
  • + //
  • fail:部署失败/停用失败。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 传递客户端IP,取值有: + //
  • TOA:TOA(仅Proto=TCP时可选);
  • + //
  • PPV1:Proxy Protocol传递,协议版本V1(仅Proto=TCP时可选);
  • + //
  • PPV2:Proxy Protocol传递,协议版本V2;
  • + //
  • OFF:不传递。
  • + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 是否开启会话保持,取值有: + //
  • true:开启;
  • + //
  • false:关闭。
  • + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` +} + +type BotConfig struct { + // bot开关 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 预置规则 + ManagedRule *BotManagedRule `json:"ManagedRule,omitempty" name:"ManagedRule"` + + // 保留 + UaBotRule *BotManagedRule `json:"UaBotRule,omitempty" name:"UaBotRule"` + + // 保留 + IspBotRule *BotManagedRule `json:"IspBotRule,omitempty" name:"IspBotRule"` + + // 用户画像规则 + PortraitRule *BotPortraitRule `json:"PortraitRule,omitempty" name:"PortraitRule"` + + // Bot智能分析 + // 注意:此字段可能返回 null,表示取不到有效值。 + IntelligenceRule *IntelligenceRule `json:"IntelligenceRule,omitempty" name:"IntelligenceRule"` +} + +type BotLog struct { + // 攻击时间,采用unix秒级时间戳。 + AttackTime *uint64 `json:"AttackTime,omitempty" name:"AttackTime"` + + // 攻击源(客户端)ip。 + AttackIp *string `json:"AttackIp,omitempty" name:"AttackIp"` + + // 受攻击域名。 + Domain *string `json:"Domain,omitempty" name:"Domain"` + + // URI。 + RequestUri *string `json:"RequestUri,omitempty" name:"RequestUri"` + + // 当前该字段无效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 请求方法。 + RequestMethod *string `json:"RequestMethod,omitempty" name:"RequestMethod"` + + // 攻击内容。 + AttackContent *string `json:"AttackContent,omitempty" name:"AttackContent"` + + // 当前该字段无效 。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RiskLevel *string `json:"RiskLevel,omitempty" name:"RiskLevel"` + + // 当前该字段无效 。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleId *uint64 `json:"RuleId,omitempty" name:"RuleId"` + + // IP所在国家iso-3166中alpha-2编码,编码信息请参考[ISO-3166](https://git.woa.com/edgeone/iso-3166/blob/master/all/all.json)。 + SipCountryCode *string `json:"SipCountryCode,omitempty" name:"SipCountryCode"` + + // 请求(事件)ID。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // 该字段当前无效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DisposalMethod *string `json:"DisposalMethod,omitempty" name:"DisposalMethod"` + + // 该字段当前无效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + HttpLog *string `json:"HttpLog,omitempty" name:"HttpLog"` + + // user agent。 + Ua *string `json:"Ua,omitempty" name:"Ua"` + + // 该字段当前无效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DetectionMethod *string `json:"DetectionMethod,omitempty" name:"DetectionMethod"` + + // 该字段当前无效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Confidence *string `json:"Confidence,omitempty" name:"Confidence"` + + // 该字段当前无效。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Maliciousness *string `json:"Maliciousness,omitempty" name:"Maliciousness"` + + // 规则相关信息列表。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleDetailList []*SecRuleRelatedInfo `json:"RuleDetailList,omitempty" name:"RuleDetailList"` + + // Bot标签。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Label *string `json:"Label,omitempty" name:"Label"` +} + +type BotLogData struct { + // Bot攻击日志数据集合。 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*BotLog `json:"List,omitempty" name:"List"` + + // 分页拉取的起始页号。最小值:1。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 分页拉取的最大返回结果数。最大值:1000。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type BotManagedRule struct { + // 想开启的规则id + // 注意:此字段可能返回 null,表示取不到有效值。 + ManagedIds []*int64 `json:"ManagedIds,omitempty" name:"ManagedIds"` + + // 本规则的id + RuleID *int64 `json:"RuleID,omitempty" name:"RuleID"` + + // drop/trans/monitor/alg + Action *string `json:"Action,omitempty" name:"Action"` + + // ip封禁的惩罚时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + PunishTime *int64 `json:"PunishTime,omitempty" name:"PunishTime"` + + // 单位 + // 注意:此字段可能返回 null,表示取不到有效值。 + PunishTimeUnit *string `json:"PunishTimeUnit,omitempty" name:"PunishTimeUnit"` + + // 自定义返回页面的名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 自定义返回页面的实例id + // 注意:此字段可能返回 null,表示取不到有效值。 + PageId *int64 `json:"PageId,omitempty" name:"PageId"` + + // 重定向时候的地址,必须为本用户接入的站点子域名,使用URLENCODE + // 注意:此字段可能返回 null,表示取不到有效值。 + RedirectUrl *string `json:"RedirectUrl,omitempty" name:"RedirectUrl"` + + // 重定向时候的返回码 + // 注意:此字段可能返回 null,表示取不到有效值。 + ResponseCode *int64 `json:"ResponseCode,omitempty" name:"ResponseCode"` + + // 放行的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + TransManagedIds []*int64 `json:"TransManagedIds,omitempty" name:"TransManagedIds"` + + // JS挑战的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + AlgManagedIds []*int64 `json:"AlgManagedIds,omitempty" name:"AlgManagedIds"` + + // 数字验证码的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + CapManagedIds []*int64 `json:"CapManagedIds,omitempty" name:"CapManagedIds"` + + // 观察的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + MonManagedIds []*int64 `json:"MonManagedIds,omitempty" name:"MonManagedIds"` + + // 拦截的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + DropManagedIds []*int64 `json:"DropManagedIds,omitempty" name:"DropManagedIds"` +} + +type BotManagedRuleDetail struct { + // 规则ID + RuleId *int64 `json:"RuleId,omitempty" name:"RuleId"` + + // 规则描述 + Description *string `json:"Description,omitempty" name:"Description"` + + // 规则分类 + RuleTypeName *string `json:"RuleTypeName,omitempty" name:"RuleTypeName"` + + // 该规则开启/关闭 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type BotPortraitRule struct { + // 本规则的id + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleID *int64 `json:"RuleID,omitempty" name:"RuleID"` + + // JS挑战的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + AlgManagedIds []*int64 `json:"AlgManagedIds,omitempty" name:"AlgManagedIds"` + + // 数字验证码的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + CapManagedIds []*int64 `json:"CapManagedIds,omitempty" name:"CapManagedIds"` + + // 观察的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + MonManagedIds []*int64 `json:"MonManagedIds,omitempty" name:"MonManagedIds"` + + // 拦截的规则ID + // 注意:此字段可能返回 null,表示取不到有效值。 + DropManagedIds []*int64 `json:"DropManagedIds,omitempty" name:"DropManagedIds"` + + // 本功能的开关 + // 注意:此字段可能返回 null,表示取不到有效值。 + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type CCInterceptEvent struct { + // 客户端ip + // 注意:此字段可能返回 null,表示取不到有效值。 + ClientIp *string `json:"ClientIp,omitempty" name:"ClientIp"` + + // 拦截次数/min + // 注意:此字段可能返回 null,表示取不到有效值。 + InterceptNum *int64 `json:"InterceptNum,omitempty" name:"InterceptNum"` + + // 速拦截时间,分钟时间/min,单位为s + InterceptTime *int64 `json:"InterceptTime,omitempty" name:"InterceptTime"` +} + +type CCInterceptEventData struct { + // 攻击事件数据集合 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*CCInterceptEvent `json:"List,omitempty" name:"List"` + + // 当前页 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 每页展示条数 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type CCLog struct { + // 攻击请求时间,采用unix秒级时间戳。 + AttackTime *uint64 `json:"AttackTime,omitempty" name:"AttackTime"` + + // 客户端ip。 + AttackSip *string `json:"AttackSip,omitempty" name:"AttackSip"` + + // 受攻击域名。 + AttackDomain *string `json:"AttackDomain,omitempty" name:"AttackDomain"` + + // URI。 + RequestUri *string `json:"RequestUri,omitempty" name:"RequestUri"` + + // 命中次数。 + HitCount *uint64 `json:"HitCount,omitempty" name:"HitCount"` + + // IP所在国家iso-3166中alpha-2编码,编码信息请参考[ISO-3166](https://git.woa.com/edgeone/iso-3166/blob/master/all/all.json)。 + SipCountryCode *string `json:"SipCountryCode,omitempty" name:"SipCountryCode"` + + // 请求(事件)ID。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // 当前该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DisposalMethod *string `json:"DisposalMethod,omitempty" name:"DisposalMethod"` + + // 当前该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + HttpLog *string `json:"HttpLog,omitempty" name:"HttpLog"` + + // 当前该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleId *uint64 `json:"RuleId,omitempty" name:"RuleId"` + + // 当前该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RiskLevel *string `json:"RiskLevel,omitempty" name:"RiskLevel"` + + // User Agent,仅自定义规则日志中存在。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Ua *string `json:"Ua,omitempty" name:"Ua"` + + // 请求方法,仅自定义规则日志中存在。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RequestMethod *string `json:"RequestMethod,omitempty" name:"RequestMethod"` + + // 规则信息列表。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleDetailList []*SecRuleRelatedInfo `json:"RuleDetailList,omitempty" name:"RuleDetailList"` +} + +type CCLogData struct { + // CC拦截日志数据集合。 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*CCLog `json:"List,omitempty" name:"List"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type CacheConfig struct { + // 缓存配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cache *CacheConfigCache `json:"Cache,omitempty" name:"Cache"` + + // 不缓存配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + NoCache *CacheConfigNoCache `json:"NoCache,omitempty" name:"NoCache"` + + // 遵循源站配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + FollowOrigin *CacheConfigFollowOrigin `json:"FollowOrigin,omitempty" name:"FollowOrigin"` +} + +type CacheConfigCache struct { + // 缓存配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 缓存过期时间设置。 + // 单位为秒,最大可设置为 365 天。 + // 注意:此字段可能返回 null,表示取不到有效值。 + CacheTime *int64 `json:"CacheTime,omitempty" name:"CacheTime"` + + // 是否开启强制缓存,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + IgnoreCacheControl *string `json:"IgnoreCacheControl,omitempty" name:"IgnoreCacheControl"` +} + +type CacheConfigFollowOrigin struct { + // 遵循源站配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type CacheConfigNoCache struct { + // 不缓存配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type CacheKey struct { + // 是否开启全路径缓存,取值有: + //
  • on:开启全路径缓存(即关闭参数忽略);
  • + //
  • off:关闭全路径缓存(即开启参数忽略)。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + FullUrlCache *string `json:"FullUrlCache,omitempty" name:"FullUrlCache"` + + // 是否忽略大小写缓存,取值有: + //
  • on:忽略;
  • + //
  • off:不忽略。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + IgnoreCase *string `json:"IgnoreCase,omitempty" name:"IgnoreCase"` + + // CacheKey中包含请求参数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + QueryString *QueryString `json:"QueryString,omitempty" name:"QueryString"` +} + +type CachePrefresh struct { + // 缓存预刷新配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 缓存预刷新百分比,取值范围:1-99。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Percent *int64 `json:"Percent,omitempty" name:"Percent"` +} + +type CertFilter struct { + // 过滤字段名,支持的列表如下: + // - host:域名。 + // - certId: 证书ID + // - certAlias: 证书备用名 + // - certType: default: 默认证书, upload: 上传证书, managed:腾讯云证书 + Name *string `json:"Name,omitempty" name:"Name"` + + // 过滤字段值 + Values []*string `json:"Values,omitempty" name:"Values"` + + // 是否启用模糊查询,仅支持过滤字段名host。 + // 模糊查询时,Value长度最大为1。 + Fuzzy *bool `json:"Fuzzy,omitempty" name:"Fuzzy"` +} + +type CertSort struct { + // 排序字段,当前支持: + // createTime,域名创建时间 + // certExpireTime,证书过期时间 + // certDeployTime, 证书部署时间 + Key *string `json:"Key,omitempty" name:"Key"` + + // asc/desc,默认desc。 + Sequence *string `json:"Sequence,omitempty" name:"Sequence"` +} + +// Predefined struct for user +type CheckCertificateRequestParams struct { + // 证书 + Certificate *string `json:"Certificate,omitempty" name:"Certificate"` + + // 私钥 + PrivateKey *string `json:"PrivateKey,omitempty" name:"PrivateKey"` +} + +type CheckCertificateRequest struct { + *tchttp.BaseRequest + + // 证书 + Certificate *string `json:"Certificate,omitempty" name:"Certificate"` + + // 私钥 + PrivateKey *string `json:"PrivateKey,omitempty" name:"PrivateKey"` +} + +func (r *CheckCertificateRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CheckCertificateRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Certificate") + delete(f, "PrivateKey") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CheckCertificateRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CheckCertificateResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CheckCertificateResponse struct { + *tchttp.BaseResponse + Response *CheckCertificateResponseParams `json:"Response"` +} + +func (r *CheckCertificateResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CheckCertificateResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type ClientIp struct { + // 配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 回源时,存放客户端IP的请求头名称。 + // 为空则使用默认值:X-Forwarded-IP。 + // 注意:此字段可能返回 null,表示取不到有效值。 + HeaderName *string `json:"HeaderName,omitempty" name:"HeaderName"` +} + +type CnameStatus struct { + // 记录名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // CNAME 地址 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cname *string `json:"Cname,omitempty" name:"Cname"` + + // 状态 + // 生效:active + // 不生效:moved + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type Compression struct { + // 智能压缩配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 支持的压缩算法列表,取值有: + //
  • brotli:brotli算法;
  • + //
  • gzip:gzip算法。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + Algorithms []*string `json:"Algorithms,omitempty" name:"Algorithms"` +} + +// Predefined struct for user +type CreateApplicationProxyRequestParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称。 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 当ProxyType=hostname时,表示域名或子域名; + // 当ProxyType=instance时,表示代理名称。 + ProxyName *string `json:"ProxyName,omitempty" name:"ProxyName"` + + // 调度模式,取值有: + //
  • ip:表示Anycast IP调度;
  • + //
  • domain:表示CNAME调度。
  • + PlatType *string `json:"PlatType,omitempty" name:"PlatType"` + + // 是否开启安全,取值有: + //
  • 0:关闭安全;
  • + //
  • 1:开启安全。
  • + SecurityType *int64 `json:"SecurityType,omitempty" name:"SecurityType"` + + // 是否开启加速,取值有: + //
  • 0:关闭加速;
  • + //
  • 1:开启加速。
  • + AccelerateType *int64 `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 字段已经废弃。 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` + + // 字段已经废弃。 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 规则详细信息。 + Rule []*ApplicationProxyRule `json:"Rule,omitempty" name:"Rule"` + + // 四层代理模式,取值有: + //
  • hostname:表示子域名模式;
  • + //
  • instance:表示实例模式。
  • 不填写使用默认值instance。 + ProxyType *string `json:"ProxyType,omitempty" name:"ProxyType"` + + // 会话保持时间,取值范围:30-3600,单位:秒。 + // 不填写使用默认值600。 + SessionPersistTime *uint64 `json:"SessionPersistTime,omitempty" name:"SessionPersistTime"` + + // Ipv6访问配置。 + // 不填写表示关闭Ipv6访问。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` +} + +type CreateApplicationProxyRequest struct { + *tchttp.BaseRequest + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称。 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 当ProxyType=hostname时,表示域名或子域名; + // 当ProxyType=instance时,表示代理名称。 + ProxyName *string `json:"ProxyName,omitempty" name:"ProxyName"` + + // 调度模式,取值有: + //
  • ip:表示Anycast IP调度;
  • + //
  • domain:表示CNAME调度。
  • + PlatType *string `json:"PlatType,omitempty" name:"PlatType"` + + // 是否开启安全,取值有: + //
  • 0:关闭安全;
  • + //
  • 1:开启安全。
  • + SecurityType *int64 `json:"SecurityType,omitempty" name:"SecurityType"` + + // 是否开启加速,取值有: + //
  • 0:关闭加速;
  • + //
  • 1:开启加速。
  • + AccelerateType *int64 `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 字段已经废弃。 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` + + // 字段已经废弃。 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 规则详细信息。 + Rule []*ApplicationProxyRule `json:"Rule,omitempty" name:"Rule"` + + // 四层代理模式,取值有: + //
  • hostname:表示子域名模式;
  • + //
  • instance:表示实例模式。
  • 不填写使用默认值instance。 + ProxyType *string `json:"ProxyType,omitempty" name:"ProxyType"` + + // 会话保持时间,取值范围:30-3600,单位:秒。 + // 不填写使用默认值600。 + SessionPersistTime *uint64 `json:"SessionPersistTime,omitempty" name:"SessionPersistTime"` + + // Ipv6访问配置。 + // 不填写表示关闭Ipv6访问。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` +} + +func (r *CreateApplicationProxyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateApplicationProxyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ZoneName") + delete(f, "ProxyName") + delete(f, "PlatType") + delete(f, "SecurityType") + delete(f, "AccelerateType") + delete(f, "SessionPersist") + delete(f, "ForwardClientIp") + delete(f, "Rule") + delete(f, "ProxyType") + delete(f, "SessionPersistTime") + delete(f, "Ipv6") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateApplicationProxyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateApplicationProxyResponseParams struct { + // 新增的四层代理应用ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateApplicationProxyResponse struct { + *tchttp.BaseResponse + Response *CreateApplicationProxyResponseParams `json:"Response"` +} + +func (r *CreateApplicationProxyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateApplicationProxyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateApplicationProxyRuleRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 协议,取值为TCP或者UDP + Proto *string `json:"Proto,omitempty" name:"Proto"` + + // 端口,支持格式: + // 80:80端口 + // 81-90:81至90端口 + Port []*string `json:"Port,omitempty" name:"Port"` + + // 源站类型,取值: + // custom:手动添加 + // origins:源站组 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 源站信息: + // 当OriginType=custom时,表示多个: + // IP:端口 + // 域名:端口 + // 当OriginType=origins时,包含一个元素,表示源站组ID + OriginValue []*string `json:"OriginValue,omitempty" name:"OriginValue"` + + // 传递客户端IP,当Proto=TCP时,取值: + // TOA:TOA + // PPV1: Proxy Protocol传递,协议版本V1 + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + // 当Proto=UDP时,取值: + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 是否开启会话保持 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` +} + +type CreateApplicationProxyRuleRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 协议,取值为TCP或者UDP + Proto *string `json:"Proto,omitempty" name:"Proto"` + + // 端口,支持格式: + // 80:80端口 + // 81-90:81至90端口 + Port []*string `json:"Port,omitempty" name:"Port"` + + // 源站类型,取值: + // custom:手动添加 + // origins:源站组 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 源站信息: + // 当OriginType=custom时,表示多个: + // IP:端口 + // 域名:端口 + // 当OriginType=origins时,包含一个元素,表示源站组ID + OriginValue []*string `json:"OriginValue,omitempty" name:"OriginValue"` + + // 传递客户端IP,当Proto=TCP时,取值: + // TOA:TOA + // PPV1: Proxy Protocol传递,协议版本V1 + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + // 当Proto=UDP时,取值: + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 是否开启会话保持 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` +} + +func (r *CreateApplicationProxyRuleRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateApplicationProxyRuleRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "Proto") + delete(f, "Port") + delete(f, "OriginType") + delete(f, "OriginValue") + delete(f, "ForwardClientIp") + delete(f, "SessionPersist") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateApplicationProxyRuleRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateApplicationProxyRuleResponseParams struct { + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateApplicationProxyRuleResponse struct { + *tchttp.BaseResponse + Response *CreateApplicationProxyRuleResponseParams `json:"Response"` +} + +func (r *CreateApplicationProxyRuleResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateApplicationProxyRuleResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateApplicationProxyRulesRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则列表 + Rule []*ApplicationProxyRule `json:"Rule,omitempty" name:"Rule"` +} + +type CreateApplicationProxyRulesRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则列表 + Rule []*ApplicationProxyRule `json:"Rule,omitempty" name:"Rule"` +} + +func (r *CreateApplicationProxyRulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateApplicationProxyRulesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "Rule") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateApplicationProxyRulesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateApplicationProxyRulesResponseParams struct { + // 新增的规则ID数组 + RuleId []*string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateApplicationProxyRulesResponse struct { + *tchttp.BaseResponse + Response *CreateApplicationProxyRulesResponseParams `json:"Response"` +} + +func (r *CreateApplicationProxyRulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateApplicationProxyRulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateCustomErrorPageRequestParams struct { + // zone的id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 具体所属实体 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 自定义页面的文件名 + Name *string `json:"Name,omitempty" name:"Name"` + + // 自定义页面的内容 + Content *string `json:"Content,omitempty" name:"Content"` +} + +type CreateCustomErrorPageRequest struct { + *tchttp.BaseRequest + + // zone的id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 具体所属实体 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 自定义页面的文件名 + Name *string `json:"Name,omitempty" name:"Name"` + + // 自定义页面的内容 + Content *string `json:"Content,omitempty" name:"Content"` +} + +func (r *CreateCustomErrorPageRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateCustomErrorPageRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Entity") + delete(f, "Name") + delete(f, "Content") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateCustomErrorPageRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateCustomErrorPageResponseParams struct { + // 自定义页面上传后的唯一id + PageId *int64 `json:"PageId,omitempty" name:"PageId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateCustomErrorPageResponse struct { + *tchttp.BaseResponse + Response *CreateCustomErrorPageResponseParams `json:"Response"` +} + +func (r *CreateCustomErrorPageResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateCustomErrorPageResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateDnsRecordRequestParams struct { + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录名 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录内容 + Content *string `json:"Content,omitempty" name:"Content"` + + // 代理模式,可选值:dns_only, cdn_only, secure_cdn + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 生存时间值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` +} + +type CreateDnsRecordRequest struct { + *tchttp.BaseRequest + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录名 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录内容 + Content *string `json:"Content,omitempty" name:"Content"` + + // 代理模式,可选值:dns_only, cdn_only, secure_cdn + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 生存时间值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` +} + +func (r *CreateDnsRecordRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateDnsRecordRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Type") + delete(f, "Name") + delete(f, "Content") + delete(f, "Mode") + delete(f, "Ttl") + delete(f, "Priority") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateDnsRecordRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateDnsRecordResponseParams struct { + // 记录 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录内容 + Content *string `json:"Content,omitempty" name:"Content"` + + // 生存时间值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` + + // 代理模式 + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 解析状态 + // active: 生效 + // pending: 不生效 + Status *string `json:"Status,omitempty" name:"Status"` + + // 已锁定 + Locked *bool `json:"Locked,omitempty" name:"Locked"` + + // 创建时间 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // CNAME 地址 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cname *string `json:"Cname,omitempty" name:"Cname"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateDnsRecordResponse struct { + *tchttp.BaseResponse + Response *CreateDnsRecordResponseParams `json:"Response"` +} + +func (r *CreateDnsRecordResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateDnsRecordResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateLoadBalancingRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名 + Host *string `json:"Host,omitempty" name:"Host"` + + // 代理模式: + // dns_only: 仅DNS + // proxied: 开启代理 + Type *string `json:"Type,omitempty" name:"Type"` + + // 使用的源站组ID + OriginId []*string `json:"OriginId,omitempty" name:"OriginId"` + + // 当Type=dns_only表示DNS的TTL时间 + TTL *uint64 `json:"TTL,omitempty" name:"TTL"` +} + +type CreateLoadBalancingRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名 + Host *string `json:"Host,omitempty" name:"Host"` + + // 代理模式: + // dns_only: 仅DNS + // proxied: 开启代理 + Type *string `json:"Type,omitempty" name:"Type"` + + // 使用的源站组ID + OriginId []*string `json:"OriginId,omitempty" name:"OriginId"` + + // 当Type=dns_only表示DNS的TTL时间 + TTL *uint64 `json:"TTL,omitempty" name:"TTL"` +} + +func (r *CreateLoadBalancingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateLoadBalancingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Host") + delete(f, "Type") + delete(f, "OriginId") + delete(f, "TTL") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateLoadBalancingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateLoadBalancingResponseParams struct { + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateLoadBalancingResponse struct { + *tchttp.BaseResponse + Response *CreateLoadBalancingResponseParams `json:"Response"` +} + +func (r *CreateLoadBalancingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateLoadBalancingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateOriginGroupRequestParams struct { + // 源站组名称 + OriginName *string `json:"OriginName,omitempty" name:"OriginName"` + + // 配置类型,当OriginType=self 时,需要填写: + // area: 按区域配置 + // weight: 按权重配置 + // 当OriginType=third_party/cos 时,不需要填写 + Type *string `json:"Type,omitempty" name:"Type"` + + // 源站记录 + Record []*OriginRecord `json:"Record,omitempty" name:"Record"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 源站类型 + // self:自有源站 + // third_party:第三方源站 + // cos:腾讯云COS源站 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` +} + +type CreateOriginGroupRequest struct { + *tchttp.BaseRequest + + // 源站组名称 + OriginName *string `json:"OriginName,omitempty" name:"OriginName"` + + // 配置类型,当OriginType=self 时,需要填写: + // area: 按区域配置 + // weight: 按权重配置 + // 当OriginType=third_party/cos 时,不需要填写 + Type *string `json:"Type,omitempty" name:"Type"` + + // 源站记录 + Record []*OriginRecord `json:"Record,omitempty" name:"Record"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 源站类型 + // self:自有源站 + // third_party:第三方源站 + // cos:腾讯云COS源站 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` +} + +func (r *CreateOriginGroupRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateOriginGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "OriginName") + delete(f, "Type") + delete(f, "Record") + delete(f, "ZoneId") + delete(f, "OriginType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateOriginGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateOriginGroupResponseParams struct { + // 新增的源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateOriginGroupResponse struct { + *tchttp.BaseResponse + Response *CreateOriginGroupResponseParams `json:"Response"` +} + +func (r *CreateOriginGroupResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateOriginGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreatePlanForZoneRequestParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 所要购买套餐的类型,取值有: + //
  • sta: 全球内容分发网络(不包括中国大陆)标准版套餐;
  • + //
  • sta_with_bot: 全球内容分发网络(不包括中国大陆)标准版套餐附带bot管理;
  • + //
  • sta_cm: 中国大陆内容分发网络标准版套餐;
  • + //
  • sta_cm_with_bot: 中国大陆内容分发网络标准版套餐附带bot管理;
  • + //
  • ent: 全球内容分发网络(不包括中国大陆)企业版套餐;
  • + //
  • ent_with_bot: 全球内容分发网络(不包括中国大陆)企业版套餐附带bot管理;
  • + //
  • ent_cm: 中国大陆内容分发网络企业版套餐;
  • + //
  • ent_cm_with_bot: 中国大陆内容分发网络企业版套餐附带bot管理。
  • 当前账户可购买套餐类型请以DescribeAvailablePlans返回为准。 + PlanType *string `json:"PlanType,omitempty" name:"PlanType"` +} + +type CreatePlanForZoneRequest struct { + *tchttp.BaseRequest + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 所要购买套餐的类型,取值有: + //
  • sta: 全球内容分发网络(不包括中国大陆)标准版套餐;
  • + //
  • sta_with_bot: 全球内容分发网络(不包括中国大陆)标准版套餐附带bot管理;
  • + //
  • sta_cm: 中国大陆内容分发网络标准版套餐;
  • + //
  • sta_cm_with_bot: 中国大陆内容分发网络标准版套餐附带bot管理;
  • + //
  • ent: 全球内容分发网络(不包括中国大陆)企业版套餐;
  • + //
  • ent_with_bot: 全球内容分发网络(不包括中国大陆)企业版套餐附带bot管理;
  • + //
  • ent_cm: 中国大陆内容分发网络企业版套餐;
  • + //
  • ent_cm_with_bot: 中国大陆内容分发网络企业版套餐附带bot管理。
  • 当前账户可购买套餐类型请以DescribeAvailablePlans返回为准。 + PlanType *string `json:"PlanType,omitempty" name:"PlanType"` +} + +func (r *CreatePlanForZoneRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreatePlanForZoneRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "PlanType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreatePlanForZoneRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreatePlanForZoneResponseParams struct { + // 购买的资源名字列表。 + ResourceNames []*string `json:"ResourceNames,omitempty" name:"ResourceNames"` + + // 购买的订单号列表。 + DealNames []*string `json:"DealNames,omitempty" name:"DealNames"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreatePlanForZoneResponse struct { + *tchttp.BaseResponse + Response *CreatePlanForZoneResponseParams `json:"Response"` +} + +func (r *CreatePlanForZoneResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreatePlanForZoneResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreatePrefetchTaskRequestParams struct { + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 要预热的资源列表,每个元素格式类似如下: + // http://www.example.com/example.txt + Targets []*string `json:"Targets,omitempty" name:"Targets"` + + // 是否对url进行encode + // 若内容含有非 ASCII 字符集的字符,请开启此开关,编码转换(编码规则遵循 RFC3986) + EncodeUrl *bool `json:"EncodeUrl,omitempty" name:"EncodeUrl"` + + // 附带的http头部信息 + Headers []*Header `json:"Headers,omitempty" name:"Headers"` +} + +type CreatePrefetchTaskRequest struct { + *tchttp.BaseRequest + + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 要预热的资源列表,每个元素格式类似如下: + // http://www.example.com/example.txt + Targets []*string `json:"Targets,omitempty" name:"Targets"` + + // 是否对url进行encode + // 若内容含有非 ASCII 字符集的字符,请开启此开关,编码转换(编码规则遵循 RFC3986) + EncodeUrl *bool `json:"EncodeUrl,omitempty" name:"EncodeUrl"` + + // 附带的http头部信息 + Headers []*Header `json:"Headers,omitempty" name:"Headers"` +} + +func (r *CreatePrefetchTaskRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreatePrefetchTaskRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Targets") + delete(f, "EncodeUrl") + delete(f, "Headers") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreatePrefetchTaskRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreatePrefetchTaskResponseParams struct { + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 失败的任务列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + FailedList []*FailReason `json:"FailedList,omitempty" name:"FailedList"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreatePrefetchTaskResponse struct { + *tchttp.BaseResponse + Response *CreatePrefetchTaskResponseParams `json:"Response"` +} + +func (r *CreatePrefetchTaskResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreatePrefetchTaskResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreatePurgeTaskRequestParams struct { + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 类型,当前支持的类型: + // - purge_url:URL + // - purge_prefix:前缀 + // - purge_host:Hostname + // - purge_all:全部缓存 + Type *string `json:"Type,omitempty" name:"Type"` + + // 要刷新的资源列表,每个元素格式依据Type而定 + // 1) Type = purge_host 时 + // 形如:www.example.com 或 foo.bar.example.com + // 2) Type = purge_prefix 时 + // 形如:http://www.example.com/example + // 3) Type = purge_url 时 + // 形如:https://www.example.com/example.jpg + // 4)Type = purge_all 时 + // Targets可为空,不需要填写 + Targets []*string `json:"Targets,omitempty" name:"Targets"` + + // 若有编码转换,仅清除编码转换后匹配的资源 + // 若内容含有非 ASCII 字符集的字符,请开启此开关,编码转换(编码规则遵循 RFC3986) + EncodeUrl *bool `json:"EncodeUrl,omitempty" name:"EncodeUrl"` +} + +type CreatePurgeTaskRequest struct { + *tchttp.BaseRequest + + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 类型,当前支持的类型: + // - purge_url:URL + // - purge_prefix:前缀 + // - purge_host:Hostname + // - purge_all:全部缓存 + Type *string `json:"Type,omitempty" name:"Type"` + + // 要刷新的资源列表,每个元素格式依据Type而定 + // 1) Type = purge_host 时 + // 形如:www.example.com 或 foo.bar.example.com + // 2) Type = purge_prefix 时 + // 形如:http://www.example.com/example + // 3) Type = purge_url 时 + // 形如:https://www.example.com/example.jpg + // 4)Type = purge_all 时 + // Targets可为空,不需要填写 + Targets []*string `json:"Targets,omitempty" name:"Targets"` + + // 若有编码转换,仅清除编码转换后匹配的资源 + // 若内容含有非 ASCII 字符集的字符,请开启此开关,编码转换(编码规则遵循 RFC3986) + EncodeUrl *bool `json:"EncodeUrl,omitempty" name:"EncodeUrl"` +} + +func (r *CreatePurgeTaskRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreatePurgeTaskRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Type") + delete(f, "Targets") + delete(f, "EncodeUrl") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreatePurgeTaskRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreatePurgeTaskResponseParams struct { + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 失败的任务列表及原因 + // 注意:此字段可能返回 null,表示取不到有效值。 + FailedList []*FailReason `json:"FailedList,omitempty" name:"FailedList"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreatePurgeTaskResponse struct { + *tchttp.BaseResponse + Response *CreatePurgeTaskResponseParams `json:"Response"` +} + +func (r *CreatePurgeTaskResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreatePurgeTaskResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateRuleRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则名称,名称字符串长度 1~255。 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 规则状态,取值有: + //
  • enable: 启用;
  • + //
  • disable: 未启用。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 规则内容。 + Rules []*RuleItem `json:"Rules,omitempty" name:"Rules"` +} + +type CreateRuleRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则名称,名称字符串长度 1~255。 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 规则状态,取值有: + //
  • enable: 启用;
  • + //
  • disable: 未启用。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 规则内容。 + Rules []*RuleItem `json:"Rules,omitempty" name:"Rules"` +} + +func (r *CreateRuleRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateRuleRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "RuleName") + delete(f, "Status") + delete(f, "Rules") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateRuleRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateRuleResponseParams struct { + // 规则 ID。 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateRuleResponse struct { + *tchttp.BaseResponse + Response *CreateRuleResponseParams `json:"Response"` +} + +func (r *CreateRuleResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateRuleResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateZoneRequestParams struct { + // 站点名字 + Name *string `json:"Name,omitempty" name:"Name"` + + // 接入方式,默认full + // - full NS接入 + // - partial CNAME接入 + Type *string `json:"Type,omitempty" name:"Type"` + + // 是否跳过站点历史解析记录扫描 + JumpStart *bool `json:"JumpStart,omitempty" name:"JumpStart"` + + // 资源标签 + Tags []*Tag `json:"Tags,omitempty" name:"Tags"` +} + +type CreateZoneRequest struct { + *tchttp.BaseRequest + + // 站点名字 + Name *string `json:"Name,omitempty" name:"Name"` + + // 接入方式,默认full + // - full NS接入 + // - partial CNAME接入 + Type *string `json:"Type,omitempty" name:"Type"` + + // 是否跳过站点历史解析记录扫描 + JumpStart *bool `json:"JumpStart,omitempty" name:"JumpStart"` + + // 资源标签 + Tags []*Tag `json:"Tags,omitempty" name:"Tags"` +} + +func (r *CreateZoneRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateZoneRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Name") + delete(f, "Type") + delete(f, "JumpStart") + delete(f, "Tags") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateZoneRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateZoneResponseParams struct { + // 站点ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 站点接入方式 + Type *string `json:"Type,omitempty" name:"Type"` + + // 站点状态 + // - pending 未切换NS + // - active NS 已切换到分配的 NS + // - moved NS 从腾讯云切走 + Status *string `json:"Status,omitempty" name:"Status"` + + // 当前使用的 NS 列表 + OriginalNameServers []*string `json:"OriginalNameServers,omitempty" name:"OriginalNameServers"` + + // 给用户分配的 NS 列表 + NameServers []*string `json:"NameServers,omitempty" name:"NameServers"` + + // 站点创建时间 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 站点更新时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type CreateZoneResponse struct { + *tchttp.BaseResponse + Response *CreateZoneResponseParams `json:"Response"` +} + +func (r *CreateZoneResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateZoneResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DDoSAcl struct { + // 目的端口结束,取值范围0-65535。 + DportEnd *int64 `json:"DportEnd,omitempty" name:"DportEnd"` + + // 目的端口开始,取值范围0-65535。 + DportStart *int64 `json:"DportStart,omitempty" name:"DportStart"` + + // 源端口结束,取值范围0-65535。 + SportEnd *int64 `json:"SportEnd,omitempty" name:"SportEnd"` + + // 源端口开始,取值范围0-65535。 + SportStart *int64 `json:"SportStart,omitempty" name:"SportStart"` + + // 协议,取值有: + //
  • tcp :tcp协议 ;
  • + //
  • udp :udp协议 ;
  • + //
  • all :全部协议 。
  • + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // 执行动作,取值为: + //
  • drop :丢弃 ;
  • + //
  • transmit :放行 ;
  • + //
  • forward :继续防护 。
  • + Action *string `json:"Action,omitempty" name:"Action"` + + // 是否为系统配置,取值为: + //
  • 0 :修改配置 ;
  • + //
  • 1 :系统默认配置 。
  • + Default *int64 `json:"Default,omitempty" name:"Default"` +} + +type DDoSAntiPly struct { + // tcp协议封禁,取值有: + //
  • off :关闭 ;
  • + //
  • on :开启 。
  • + DropTcp *string `json:"DropTcp,omitempty" name:"DropTcp"` + + // udp协议封禁,取值有: + //
  • off :关闭 ;
  • + //
  • on :开启 。
  • + DropUdp *string `json:"DropUdp,omitempty" name:"DropUdp"` + + // icmp协议封禁,取值有: + //
  • off :关闭 ;
  • + //
  • on :开启 。
  • + DropIcmp *string `json:"DropIcmp,omitempty" name:"DropIcmp"` + + // 其他协议封禁,取值有: + //
  • off :关闭 ;
  • + //
  • on :开启 。
  • + DropOther *string `json:"DropOther,omitempty" name:"DropOther"` + + // 源站每秒新连接限速,取值范围0-4294967295。 + SourceCreateLimit *int64 `json:"SourceCreateLimit,omitempty" name:"SourceCreateLimit"` + + // 源站并发连接控制,取值范围0-4294967295。 + SourceConnectLimit *int64 `json:"SourceConnectLimit,omitempty" name:"SourceConnectLimit"` + + // 目的端口每秒新连接限速,取值范围0-4294967295。 + DestinationCreateLimit *int64 `json:"DestinationCreateLimit,omitempty" name:"DestinationCreateLimit"` + + // 目的端口并发连接控制,取值范围0-4294967295。 + DestinationConnectLimit *int64 `json:"DestinationConnectLimit,omitempty" name:"DestinationConnectLimit"` + + // 每秒异常连接数阈值,取值范围0-4294967295。 + AbnormalConnectNum *int64 `json:"AbnormalConnectNum,omitempty" name:"AbnormalConnectNum"` + + // 异常syn报文百分比阈值,取值范围0-100。 + AbnormalSynRatio *int64 `json:"AbnormalSynRatio,omitempty" name:"AbnormalSynRatio"` + + // 异常syn报文阈值,取值范围0-65535。 + AbnormalSynNum *int64 `json:"AbnormalSynNum,omitempty" name:"AbnormalSynNum"` + + // 每秒连接超时检测,取值范围0-65535。 + ConnectTimeout *int64 `json:"ConnectTimeout,omitempty" name:"ConnectTimeout"` + + // 空连接防护开启,取值有: + //
  • off :关闭 ;
  • + //
  • on :开启 。
  • + EmptyConnectProtect *string `json:"EmptyConnectProtect,omitempty" name:"EmptyConnectProtect"` + + // UDP分片开关,取值有: + //
  • off :关闭 ;
  • + //
  • on :开启 。
  • + UdpShard *string `json:"UdpShard,omitempty" name:"UdpShard"` +} + +type DDoSApplication struct { + // 二级域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Host *string `json:"Host,omitempty" name:"Host"` + + // 域名状态; + // init 待切ns + // offline 需要dns开启站点加速 + // process 在部署中,稍等一会 + // online 正常状态 + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *string `json:"Status,omitempty" name:"Status"` + + // 加速开关;on-开启加速;off-关闭加速(AccelerateType:on,SecurityType:on,安全加速,未开防护增强;AccelerateType:off,SecurityType:on,安全加速,开启防护增强;AccelerateType:on,SecurityType:off,内容加速,未开防护增强) + // 注意:此字段可能返回 null,表示取不到有效值。 + AccelerateType *string `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 安全开关;on-开启安全;off-关闭安全(AccelerateType:on,SecurityType:on,安全加速,未开防护增强;AccelerateType:off,SecurityType:on,安全加速,开启防护增强;AccelerateType:on,SecurityType:off,内容加速,未开防护增强) + // 注意:此字段可能返回 null,表示取不到有效值。 + SecurityType *string `json:"SecurityType,omitempty" name:"SecurityType"` +} + +type DDoSConfig struct { + // 开关 + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type DDoSFeaturesFilter struct { + // 执行动作,取值有: + //
  • drop :丢弃 ;
  • + //
  • transmit :放行 ;
  • + //
  • drop_block :丢弃并拉黑 ;
  • + //
  • forward :继续防护 。
  • + Action *string `json:"Action,omitempty" name:"Action"` + + // 协议,取值有: + //
  • tcp :tcp协议 ;
  • + //
  • udp :udp协议 ;
  • + //
  • icmp :icmp协议 ;
  • + //
  • all :全部协议 。
  • + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // 目标端口开始,取值范围0-65535。 + DportStart *int64 `json:"DportStart,omitempty" name:"DportStart"` + + // 目标端口结束,取值范围0-65535。 + DportEnd *int64 `json:"DportEnd,omitempty" name:"DportEnd"` + + // 最小包长,取值范围0-1500。 + PacketMin *int64 `json:"PacketMin,omitempty" name:"PacketMin"` + + // 最大包长,取值范围0-1500。 + PacketMax *int64 `json:"PacketMax,omitempty" name:"PacketMax"` + + // 源端口开始,取值范围0-65535。 + SportStart *int64 `json:"SportStart,omitempty" name:"SportStart"` + + // 源端口结束,取值范围0-65535。 + SportEnd *int64 `json:"SportEnd,omitempty" name:"SportEnd"` + + // 匹配方式1,【特征1】,取值有: + //
  • pcre :正则匹配 ;
  • + //
  • sunday :字符串匹配 。
  • 默认为空字符串。 + MatchType *string `json:"MatchType,omitempty" name:"MatchType"` + + // 取非判断,该参数对MatchType配合使用,【特征1】,取值有: + //
  • 0 :匹配 ;
  • + //
  • 1 :不匹配 。
  • + IsNot *int64 `json:"IsNot,omitempty" name:"IsNot"` + + // 偏移量1,【特征1】,取值范围0-1500。 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 检测包字符深度,【特征1】,取值范围1-1500。 + Depth *int64 `json:"Depth,omitempty" name:"Depth"` + + // 匹配开始层级,层级参考计算机网络结构,取值有: + //
  • begin_l5 :载荷开始检测 ;
  • + //
  • begin_l4 :tcp/udp首部开始检测 ;
  • + //
  • begin_l3 :ip首部开始检测 。
  • + MatchBegin *string `json:"MatchBegin,omitempty" name:"MatchBegin"` + + // 正则或字符串匹配的内容,【特征1】。 + Str *string `json:"Str,omitempty" name:"Str"` + + // 匹配方式2,【特征2】,取值有: + //
  • pcre :正则匹配 ;
  • + //
  • sunday :字符串匹配 。
  • 默认为空字符串。 + MatchType2 *string `json:"MatchType2,omitempty" name:"MatchType2"` + + // 取非判断2,该参数对MatchType2配合使用,【特征2】,取值有: + //
  • 0 :匹配 ;
  • + //
  • 1 :不匹配 。
  • + IsNot2 *int64 `json:"IsNot2,omitempty" name:"IsNot2"` + + // 偏移量2,【特征2】,取值范围0-1500。 + Offset2 *int64 `json:"Offset2,omitempty" name:"Offset2"` + + // 检测包字符深度,【特征2】,取值范围1-1500。 + Depth2 *int64 `json:"Depth2,omitempty" name:"Depth2"` + + // 匹配开始层级,层级参考计算机网络结构,取值有: + //
  • begin_l5 :载荷开始检测 ;
  • + //
  • begin_l4 :tcp/udp首部开始检测;
  • + //
  • begin_l3 :ip首部开始检测 。
  • + MatchBegin2 *string `json:"MatchBegin2,omitempty" name:"MatchBegin2"` + + // 正则或字符串匹配的内容,【特征2】。 + Str2 *string `json:"Str2,omitempty" name:"Str2"` + + // 多特征关系,仅配置【特征1】时填 none,存在【特征2】配置可不填。 + MatchLogic *string `json:"MatchLogic,omitempty" name:"MatchLogic"` +} + +type DDoSGeoIp struct { + // 区域封禁清空标识,取值有: + //
  • off :清空地域封禁列表 ;
  • + //
  • on :不做处理 。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 地域信息,ID参考[DescribeSecurityPolicyRegions](https://tcloud4api.woa.com/document/product/1657/76031?!preview&!document=1)。 + RegionId []*int64 `json:"RegionId,omitempty" name:"RegionId"` +} + +type DDoSStatusInfo struct { + // 暂不支持,默认值off。 + AiStatus *string `json:"AiStatus,omitempty" name:"AiStatus"` + + // 废弃字段。 + Appid *string `json:"Appid,omitempty" name:"Appid"` + + // 策略等级,取值有: + //
  • low :宽松 ;
  • + //
  • middle :适中 ;
  • + //
  • high : 严格。
  • + PlyLevel *string `json:"PlyLevel,omitempty" name:"PlyLevel"` +} + +type DDoSUserAllowBlockIP struct { + // 客户端IP。 + Ip *string `json:"Ip,omitempty" name:"Ip"` + + // 掩码。 + Mask *int64 `json:"Mask,omitempty" name:"Mask"` + + // 类型,取值有: + //
  • block :丢弃 ;
  • + //
  • allow :允许。
  • + Type *string `json:"Type,omitempty" name:"Type"` + + // 10位时间戳,例如1199116800。 + UpdateTime *int64 `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 客户端IP2,设置IP范围时使用,例如 1.1.1.1-1.1.1.2。 + Ip2 *string `json:"Ip2,omitempty" name:"Ip2"` + + // 掩码2,设置IP网段范围时使用,例如 1.1.1.0/24-1.1.2.0/24。 + Mask2 *int64 `json:"Mask2,omitempty" name:"Mask2"` +} + +type DDosAttackEvent struct { + // ddos 策略组id + // 注意:此字段可能返回 null,表示取不到有效值。 + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 攻击类型(对应交互事件名称) + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 攻击状态 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackStatus *int64 `json:"AttackStatus,omitempty" name:"AttackStatus"` + + // 攻击最大带宽 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackMaxBandWidth *int64 `json:"AttackMaxBandWidth,omitempty" name:"AttackMaxBandWidth"` + + // 攻击包速率峰值 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackPacketMaxRate *int64 `json:"AttackPacketMaxRate,omitempty" name:"AttackPacketMaxRate"` + + // 攻击开始时间 单位为s + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackStartTime *int64 `json:"AttackStartTime,omitempty" name:"AttackStartTime"` + + // 攻击结束时间 单位为s + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackEndTime *int64 `json:"AttackEndTime,omitempty" name:"AttackEndTime"` + + // 事件ID + // 注意:此字段可能返回 null,表示取不到有效值。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // 站点id + // 注意:此字段可能返回 null,表示取不到有效值。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DDosAttackEventData struct { + // 攻击事件数据集合。 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*DDosAttackEvent `json:"List,omitempty" name:"List"` + + // 分页拉取的起始页号。最小值:1。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 分页拉取的最大返回结果数。最大值:1000。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type DDosAttackEventDetailData struct { + // 攻击状态,取值有: + //
  • 1 :观察中 ;
  • + //
  • 2 :攻击开始 ;
  • + //
  • 3 :攻击结束 。
  • + AttackStatus *int64 `json:"AttackStatus,omitempty" name:"AttackStatus"` + + // 攻击类型。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 结束时间。 + EndTime *int64 `json:"EndTime,omitempty" name:"EndTime"` + + // 开始时间。 + StartTime *int64 `json:"StartTime,omitempty" name:"StartTime"` + + // 最大带宽。 + MaxBandWidth *int64 `json:"MaxBandWidth,omitempty" name:"MaxBandWidth"` + + // 最大包速率。 + PacketMaxRate *int64 `json:"PacketMaxRate,omitempty" name:"PacketMaxRate"` + + // 事件Id。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // ddos 策略组id。 + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` +} + +type DDosAttackSourceEvent struct { + // 攻击源ip。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackSourceIp *string `json:"AttackSourceIp,omitempty" name:"AttackSourceIp"` + + // 地区(国家)。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackRegion *string `json:"AttackRegion,omitempty" name:"AttackRegion"` + + // 累计攻击流量。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackFlow *uint64 `json:"AttackFlow,omitempty" name:"AttackFlow"` + + // 累计攻击包量。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackPacketNum *uint64 `json:"AttackPacketNum,omitempty" name:"AttackPacketNum"` +} + +type DDosAttackSourceEventData struct { + // DDos攻击源数据集合。 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*DDosAttackSourceEvent `json:"List,omitempty" name:"List"` + + // 分页拉取的起始页号。最小值:1。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 分页拉取的最大返回结果数。最大值:1000。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type DDosMajorAttackEvent struct { + // ddos 策略组id。 + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 攻击最大带宽。 + AttackMaxBandWidth *int64 `json:"AttackMaxBandWidth,omitempty" name:"AttackMaxBandWidth"` + + // 攻击请求时间,采用unix秒级时间戳。 + AttackTime *int64 `json:"AttackTime,omitempty" name:"AttackTime"` +} + +type DDosMajorAttackEventData struct { + // DDosMajorAttackEvent ddos 攻击事件。 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*DDosMajorAttackEvent `json:"List,omitempty" name:"List"` + + // 分页拉取的起始页号。最小值:1。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 分页拉取的最大返回结果数。最大值:1000。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数。 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type DataItem struct { + // 时间 + Time *string `json:"Time,omitempty" name:"Time"` + + // 数值 + // 注意:此字段可能返回 null,表示取不到有效值。 + Value *uint64 `json:"Value,omitempty" name:"Value"` +} + +type DdosAcls struct { + // 端口过滤规则数组。 + Acl []*DDoSAcl `json:"Acl,omitempty" name:"Acl"` + + // 清空规则标识,取值有: + //
  • off :清空端口过滤规则列表,Acl无需填写。 ;
  • + //
  • on :配置端口过滤规则,需填写Acl参数。
  • 默认值为on。 + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type DdosAllowBlock struct { + // 黑白名单数组。 + UserAllowBlockIp []*DDoSUserAllowBlockIP `json:"UserAllowBlockIp,omitempty" name:"UserAllowBlockIp"` + + // 开关标识防护是否清空,取值有: + //
  • off :清空黑白名单列表,UserAllowBlockIp无需填写。 ;
  • + //
  • on :配置黑白名单,需填写UserAllowBlockIp参数。
  • 默认值为on。 + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type DdosPacketFilter struct { + // 特征过滤规则数组。 + PacketFilter []*DDoSFeaturesFilter `json:"PacketFilter,omitempty" name:"PacketFilter"` + + // 特征过滤清空标识,取值有: + //
  • off :清空特征过滤规则,无需填写 PacketFilter 参数 ;
  • + //
  • on :配置特征过滤规则,需填写 PacketFilter 参数。
  • 默认值为on。 + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type DdosRule struct { + // DDoS防护等级。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosStatusInfo *DDoSStatusInfo `json:"DdosStatusInfo,omitempty" name:"DdosStatusInfo"` + + // DDoS地域封禁。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosGeoIp *DDoSGeoIp `json:"DdosGeoIp,omitempty" name:"DdosGeoIp"` + + // DDoS黑白名单。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosAllowBlock *DdosAllowBlock `json:"DdosAllowBlock,omitempty" name:"DdosAllowBlock"` + + // DDoS 协议封禁+连接防护。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosAntiPly *DDoSAntiPly `json:"DdosAntiPly,omitempty" name:"DdosAntiPly"` + + // DDoS特征过滤。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosPacketFilter *DdosPacketFilter `json:"DdosPacketFilter,omitempty" name:"DdosPacketFilter"` + + // DDoS端口过滤。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosAcl *DdosAcls `json:"DdosAcl,omitempty" name:"DdosAcl"` + + // DDoS开关,取值有: + //
  • on :开启 ;
  • + //
  • off :关闭 。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // UDP分片功能是否支持,取值有: + //
  • on :支持 ;
  • + //
  • off :不支持 。
  • + UdpShardOpen *string `json:"UdpShardOpen,omitempty" name:"UdpShardOpen"` + + // DDoS源站访问速率限制。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosSpeedLimit *DdosSpeedLimit `json:"DdosSpeedLimit,omitempty" name:"DdosSpeedLimit"` +} + +type DdosSpeedLimit struct { + // 源站包量限制,支持单位有pps、Kpps、Mpps、Gpps。支持范围1 pps-10000 Gpps。"0 pps"或其他单位数值为0,即不限包。""为不更新。 + PackageLimit *string `json:"PackageLimit,omitempty" name:"PackageLimit"` + + // 源站流量限制,支持单位有bps、Kbps、Mbps、Gbps,支持范围1 bps-10000 Gbps。"0 bps"或其他单位数值为0,即不限流。""为不更新。 + FluxLimit *string `json:"FluxLimit,omitempty" name:"FluxLimit"` +} + +type DefaultServerCertInfo struct { + // 服务器证书 ID, 默认证书ID, 或在 SSL 证书管理进行证书托管时自动生成 + // 注意:此字段可能返回 null,表示取不到有效值。 + CertId *string `json:"CertId,omitempty" name:"CertId"` + + // 证书备注名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Alias *string `json:"Alias,omitempty" name:"Alias"` + + // 证书类型: + // default: 默认证书 + // upload:用户上传 + // managed:腾讯云托管 + // 注意:此字段可能返回 null,表示取不到有效值。 + Type *string `json:"Type,omitempty" name:"Type"` + + // 证书过期时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + ExpireTime *string `json:"ExpireTime,omitempty" name:"ExpireTime"` + + // 证书生效时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + EffectiveTime *string `json:"EffectiveTime,omitempty" name:"EffectiveTime"` + + // 证书公用名 + // 注意:此字段可能返回 null,表示取不到有效值。 + CommonName *string `json:"CommonName,omitempty" name:"CommonName"` + + // 证书SAN域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + SubjectAltName []*string `json:"SubjectAltName,omitempty" name:"SubjectAltName"` + + // 证书状态: + // applying: 证书申请中 + // failed: 证书(申请)失败 + // processing: 证书部署中 + // deployed: 证书已部署 + // disabled: 证书被禁用 + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *string `json:"Status,omitempty" name:"Status"` + + // Status为失败时,此字段返回失败原因 + // 注意:此字段可能返回 null,表示取不到有效值。 + Message *string `json:"Message,omitempty" name:"Message"` +} + +// Predefined struct for user +type DeleteApplicationProxyRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` +} + +type DeleteApplicationProxyRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` +} + +func (r *DeleteApplicationProxyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteApplicationProxyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteApplicationProxyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteApplicationProxyResponseParams struct { + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteApplicationProxyResponse struct { + *tchttp.BaseResponse + Response *DeleteApplicationProxyResponseParams `json:"Response"` +} + +func (r *DeleteApplicationProxyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteApplicationProxyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteApplicationProxyRuleRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` +} + +type DeleteApplicationProxyRuleRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` +} + +func (r *DeleteApplicationProxyRuleRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteApplicationProxyRuleRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "RuleId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteApplicationProxyRuleRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteApplicationProxyRuleResponseParams struct { + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteApplicationProxyRuleResponse struct { + *tchttp.BaseResponse + Response *DeleteApplicationProxyRuleResponseParams `json:"Response"` +} + +func (r *DeleteApplicationProxyRuleResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteApplicationProxyRuleResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteDnsRecordsRequestParams struct { + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 记录 ID + Ids []*string `json:"Ids,omitempty" name:"Ids"` +} + +type DeleteDnsRecordsRequest struct { + *tchttp.BaseRequest + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 记录 ID + Ids []*string `json:"Ids,omitempty" name:"Ids"` +} + +func (r *DeleteDnsRecordsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteDnsRecordsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Ids") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteDnsRecordsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteDnsRecordsResponseParams struct { + // 记录 ID + Ids []*string `json:"Ids,omitempty" name:"Ids"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteDnsRecordsResponse struct { + *tchttp.BaseResponse + Response *DeleteDnsRecordsResponseParams `json:"Response"` +} + +func (r *DeleteDnsRecordsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteDnsRecordsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteLoadBalancingRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` +} + +type DeleteLoadBalancingRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` +} + +func (r *DeleteLoadBalancingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteLoadBalancingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "LoadBalancingId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteLoadBalancingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteLoadBalancingResponseParams struct { + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteLoadBalancingResponse struct { + *tchttp.BaseResponse + Response *DeleteLoadBalancingResponseParams `json:"Response"` +} + +func (r *DeleteLoadBalancingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteLoadBalancingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteOriginGroupRequestParams struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DeleteOriginGroupRequest struct { + *tchttp.BaseRequest + + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DeleteOriginGroupRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteOriginGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "OriginId") + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteOriginGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteOriginGroupResponseParams struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteOriginGroupResponse struct { + *tchttp.BaseResponse + Response *DeleteOriginGroupResponseParams `json:"Response"` +} + +func (r *DeleteOriginGroupResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteOriginGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteRulesRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 指定删除的规则 ID 列表。 + RuleIds []*string `json:"RuleIds,omitempty" name:"RuleIds"` +} + +type DeleteRulesRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 指定删除的规则 ID 列表。 + RuleIds []*string `json:"RuleIds,omitempty" name:"RuleIds"` +} + +func (r *DeleteRulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteRulesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "RuleIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteRulesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteRulesResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteRulesResponse struct { + *tchttp.BaseResponse + Response *DeleteRulesResponseParams `json:"Response"` +} + +func (r *DeleteRulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteRulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteZoneRequestParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` +} + +type DeleteZoneRequest struct { + *tchttp.BaseRequest + + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` +} + +func (r *DeleteZoneRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteZoneRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteZoneRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteZoneResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DeleteZoneResponse struct { + *tchttp.BaseResponse + Response *DeleteZoneResponseParams `json:"Response"` +} + +func (r *DeleteZoneResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteZoneResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeApplicationProxyDetailRequestParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 实例ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` +} + +type DescribeApplicationProxyDetailRequest struct { + *tchttp.BaseRequest + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 实例ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` +} + +func (r *DescribeApplicationProxyDetailRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeApplicationProxyDetailRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeApplicationProxyDetailRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeApplicationProxyDetailResponseParams struct { + // 实例ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 当ProxyType=hostname时,表示域名或子域名; + // 当ProxyType=instance时,表示代理名称。 + ProxyName *string `json:"ProxyName,omitempty" name:"ProxyName"` + + // 调度模式,取值有: + //
  • ip:表示Anycast IP调度;
  • + //
  • domain:表示CNAME调度。
  • + PlatType *string `json:"PlatType,omitempty" name:"PlatType"` + + // 是否开启安全,取值有: + //
  • 0:关闭安全;
  • + //
  • 1:开启安全。
  • + SecurityType *int64 `json:"SecurityType,omitempty" name:"SecurityType"` + + // 是否开启加速,取值有: + //
  • 0:关闭加速;
  • + //
  • 1:开启加速。
  • + AccelerateType *int64 `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 字段已经废弃。 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 字段已经废弃。 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` + + // 规则列表。 + Rule []*ApplicationProxyRule `json:"Rule,omitempty" name:"Rule"` + + // 状态,取值有: + //
  • online:启用;
  • + //
  • offline:停用;
  • + //
  • progress:部署中。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 调度信息。 + ScheduleValue []*string `json:"ScheduleValue,omitempty" name:"ScheduleValue"` + + // 更新时间。 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称。 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 会话保持时间。 + SessionPersistTime *uint64 `json:"SessionPersistTime,omitempty" name:"SessionPersistTime"` + + // 四层代理模式,取值有: + //
  • hostname:表示子域名模式;
  • + //
  • instance:表示实例模式。
  • + ProxyType *string `json:"ProxyType,omitempty" name:"ProxyType"` + + // 当ProxyType=hostname时: + // 表示代理加速唯一标识。 + HostId *string `json:"HostId,omitempty" name:"HostId"` + + // IPv6访问配置。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeApplicationProxyDetailResponse struct { + *tchttp.BaseResponse + Response *DescribeApplicationProxyDetailResponseParams `json:"Response"` +} + +func (r *DescribeApplicationProxyDetailResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeApplicationProxyDetailResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeApplicationProxyRequestParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页查询偏移量,默认为0。 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目,默认为10,最大可设置为1000。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 代理ID。 + // 当ProxyId为空时,表示查询站点下所有应用代理的列表。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` +} + +type DescribeApplicationProxyRequest struct { + *tchttp.BaseRequest + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页查询偏移量,默认为0。 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目,默认为10,最大可设置为1000。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 代理ID。 + // 当ProxyId为空时,表示查询站点下所有应用代理的列表。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` +} + +func (r *DescribeApplicationProxyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeApplicationProxyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "ProxyId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeApplicationProxyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeApplicationProxyResponseParams struct { + // 应用代理列表。 + Data []*ApplicationProxy `json:"Data,omitempty" name:"Data"` + + // 记录总数。 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 字段已废弃。 + Quota *int64 `json:"Quota,omitempty" name:"Quota"` + + // 当ProxyId为空时,表示套餐内PlatType为ip的Anycast IP的实例数量。 + IpCount *uint64 `json:"IpCount,omitempty" name:"IpCount"` + + // 当ProxyId为空时,表示套餐内PlatType为domain的CNAME的实例数量。 + DomainCount *uint64 `json:"DomainCount,omitempty" name:"DomainCount"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeApplicationProxyResponse struct { + *tchttp.BaseResponse + Response *DescribeApplicationProxyResponseParams `json:"Response"` +} + +func (r *DescribeApplicationProxyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeApplicationProxyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeAvailablePlansRequestParams struct { + +} + +type DescribeAvailablePlansRequest struct { + *tchttp.BaseRequest + +} + +func (r *DescribeAvailablePlansRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeAvailablePlansRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeAvailablePlansRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeAvailablePlansResponseParams struct { + // 当前账户可购买套餐类型及相关信息。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PlanInfoList []*PlanInfo `json:"PlanInfoList,omitempty" name:"PlanInfoList"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeAvailablePlansResponse struct { + *tchttp.BaseResponse + Response *DescribeAvailablePlansResponseParams `json:"Response"` +} + +func (r *DescribeAvailablePlansResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeAvailablePlansResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeBotLogRequestParams struct { + // 起始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点集合,不填默认查询所有站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 域名集合,不填默认查询所有子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 筛选条件,取值有: + //
  • action :执行动作(处置方式);
  • + //
  • sipCountryCode :ip所在国家 ;
  • + //
  • attackIp :攻击ip ;
  • + //
  • ruleId :规则id ;
  • + //
  • eventId :事件id ;
  • + //
  • ua :用户代理 ;
  • + //
  • requestMethod :请求方法 ;
  • + //
  • uri :统一资源标识符 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeBotLogRequest struct { + *tchttp.BaseRequest + + // 起始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点集合,不填默认查询所有站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 域名集合,不填默认查询所有子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 筛选条件,取值有: + //
  • action :执行动作(处置方式);
  • + //
  • sipCountryCode :ip所在国家 ;
  • + //
  • attackIp :攻击ip ;
  • + //
  • ruleId :规则id ;
  • + //
  • eventId :事件id ;
  • + //
  • ua :用户代理 ;
  • + //
  • requestMethod :请求方法 ;
  • + //
  • uri :统一资源标识符 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeBotLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeBotLogRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "QueryCondition") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeBotLogRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeBotLogResponseParams struct { + // Bot攻击数据内容。 + Data *BotLogData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeBotLogResponse struct { + *tchttp.BaseResponse + Response *DescribeBotLogResponseParams `json:"Response"` +} + +func (r *DescribeBotLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeBotLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeBotManagedRulesRequestParams struct { + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 页数 + Page *int64 `json:"Page,omitempty" name:"Page"` + + // 每页数量 + PerPage *int64 `json:"PerPage,omitempty" name:"PerPage"` + + // idcid/sipbot/uabot规则类型,空代表拉取全部 + RuleType *string `json:"RuleType,omitempty" name:"RuleType"` +} + +type DescribeBotManagedRulesRequest struct { + *tchttp.BaseRequest + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 页数 + Page *int64 `json:"Page,omitempty" name:"Page"` + + // 每页数量 + PerPage *int64 `json:"PerPage,omitempty" name:"PerPage"` + + // idcid/sipbot/uabot规则类型,空代表拉取全部 + RuleType *string `json:"RuleType,omitempty" name:"RuleType"` +} + +func (r *DescribeBotManagedRulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeBotManagedRulesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Entity") + delete(f, "Page") + delete(f, "PerPage") + delete(f, "RuleType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeBotManagedRulesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeBotManagedRulesResponseParams struct { + // 本次返回的规则数 + Count *int64 `json:"Count,omitempty" name:"Count"` + + // Bot规则 + Rules []*BotManagedRuleDetail `json:"Rules,omitempty" name:"Rules"` + + // 总规则数 + Total *int64 `json:"Total,omitempty" name:"Total"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeBotManagedRulesResponse struct { + *tchttp.BaseResponse + Response *DescribeBotManagedRulesResponseParams `json:"Response"` +} + +func (r *DescribeBotManagedRulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeBotManagedRulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeCnameStatusRequestParams struct { + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 域名列表 + Names []*string `json:"Names,omitempty" name:"Names"` +} + +type DescribeCnameStatusRequest struct { + *tchttp.BaseRequest + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 域名列表 + Names []*string `json:"Names,omitempty" name:"Names"` +} + +func (r *DescribeCnameStatusRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeCnameStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Names") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeCnameStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeCnameStatusResponseParams struct { + // 状态列表 + Status []*CnameStatus `json:"Status,omitempty" name:"Status"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeCnameStatusResponse struct { + *tchttp.BaseResponse + Response *DescribeCnameStatusResponseParams `json:"Response"` +} + +func (r *DescribeCnameStatusResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeCnameStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDoSPolicyRequestParams struct { + // 策略组id + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 一级域名zone + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeDDoSPolicyRequest struct { + *tchttp.BaseRequest + + // 策略组id + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 一级域名zone + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeDDoSPolicyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDoSPolicyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "PolicyId") + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDoSPolicyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDoSPolicyResponseParams struct { + // DDoS防护配置 + DdosRule *DdosRule `json:"DdosRule,omitempty" name:"DdosRule"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDoSPolicyResponse struct { + *tchttp.BaseResponse + Response *DescribeDDoSPolicyResponseParams `json:"Response"` +} + +func (r *DescribeDDoSPolicyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDoSPolicyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackDataRequestParams struct { + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • ddos_attackMaxBandwidth :攻击带宽峰值 ;
  • + //
  • ddos_attackMaxPackageRate:攻击包速率峰值 ;
  • + //
  • ddos_attackBandwidth :攻击带宽曲线 ;
  • + //
  • ddos_attackPackageRate :攻击包速率曲线 。
  • + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // ddos策略组id列表,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 端口号。 + Port *int64 `json:"Port,omitempty" name:"Port"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 攻击类型,取值有: + //
  • flood ;
  • + //
  • icmpFlood ;
  • + //
  • all 。
  • + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeDDosAttackDataRequest struct { + *tchttp.BaseRequest + + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • ddos_attackMaxBandwidth :攻击带宽峰值 ;
  • + //
  • ddos_attackMaxPackageRate:攻击包速率峰值 ;
  • + //
  • ddos_attackBandwidth :攻击带宽曲线 ;
  • + //
  • ddos_attackPackageRate :攻击包速率曲线 。
  • + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // ddos策略组id列表,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 端口号。 + Port *int64 `json:"Port,omitempty" name:"Port"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 攻击类型,取值有: + //
  • flood ;
  • + //
  • icmpFlood ;
  • + //
  • all 。
  • + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeDDosAttackDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "ZoneIds") + delete(f, "PolicyIds") + delete(f, "Port") + delete(f, "ProtocolType") + delete(f, "AttackType") + delete(f, "Interval") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDosAttackDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackDataResponseParams struct { + // DDos攻击数据内容。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*SecEntry `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDosAttackDataResponse struct { + *tchttp.BaseResponse + Response *DescribeDDosAttackDataResponseParams `json:"Response"` +} + +func (r *DescribeDDosAttackDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackEventDetailRequestParams struct { + // 事件id。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeDDosAttackEventDetailRequest struct { + *tchttp.BaseRequest + + // 事件id。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeDDosAttackEventDetailRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackEventDetailRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "EventId") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDosAttackEventDetailRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackEventDetailResponseParams struct { + // DDos攻击事件详情。 + Data *DDosAttackEventDetailData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDosAttackEventDetailResponse struct { + *tchttp.BaseResponse + Response *DescribeDDosAttackEventDetailResponseParams `json:"Response"` +} + +func (r *DescribeDDosAttackEventDetailResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackEventDetailResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackEventRequestParams struct { + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos策略组id列表,不填默认选择全部策略Id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 是否展示详情,取值有: + //
  • Y :展示 ;
  • + //
  • N :不展示 。
  • 默认为Y。 + IsShowDetail *string `json:"IsShowDetail,omitempty" name:"IsShowDetail"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeDDosAttackEventRequest struct { + *tchttp.BaseRequest + + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos策略组id列表,不填默认选择全部策略Id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 是否展示详情,取值有: + //
  • Y :展示 ;
  • + //
  • N :不展示 。
  • 默认为Y。 + IsShowDetail *string `json:"IsShowDetail,omitempty" name:"IsShowDetail"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeDDosAttackEventRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackEventRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "PolicyIds") + delete(f, "ZoneIds") + delete(f, "ProtocolType") + delete(f, "IsShowDetail") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDosAttackEventRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackEventResponseParams struct { + // DDos攻击事件数据。 + Data *DDosAttackEventData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDosAttackEventResponse struct { + *tchttp.BaseResponse + Response *DescribeDDosAttackEventResponseParams `json:"Response"` +} + +func (r *DescribeDDosAttackEventResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackEventResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackSourceEventRequestParams struct { + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos策略组id 集合,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 站点集合,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeDDosAttackSourceEventRequest struct { + *tchttp.BaseRequest + + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos策略组id 集合,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 站点集合,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeDDosAttackSourceEventRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackSourceEventRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "PolicyIds") + delete(f, "ZoneIds") + delete(f, "ProtocolType") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDosAttackSourceEventRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackSourceEventResponseParams struct { + // DDos攻击源数据。 + Data *DDosAttackSourceEventData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDosAttackSourceEventResponse struct { + *tchttp.BaseResponse + Response *DescribeDDosAttackSourceEventResponseParams `json:"Response"` +} + +func (r *DescribeDDosAttackSourceEventResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackSourceEventResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackTopDataRequestParams struct { + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • ddos_attackFlux_protocol :攻击总流量协议类型分布排行 ;
  • + //
  • ddos_attackPackageNum_protocol :攻击总包量协议类型分布排行 ;
  • + //
  • ddos_attackNum_attackType :攻击总次数攻击类型分布排行 ;
  • + //
  • ddos_attackNum_sregion :攻击总次数攻击源地区分布排行 ;
  • + //
  • ddos_attackFlux_sip :攻击总流量攻击源ip分布排行 ;
  • + //
  • ddos_attackFlux_sregion :攻击总流量攻击源地区分布排行 。
  • + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 查询前多少个,传值为0返回全量。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 站点id集合,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // ddos策略组id 集合,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 端口号。 + Port *int64 `json:"Port,omitempty" name:"Port"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 攻击类型,取值有: + //
  • flood ;
  • + //
  • icmpFlood ;
  • + //
  • all 。
  • + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeDDosAttackTopDataRequest struct { + *tchttp.BaseRequest + + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • ddos_attackFlux_protocol :攻击总流量协议类型分布排行 ;
  • + //
  • ddos_attackPackageNum_protocol :攻击总包量协议类型分布排行 ;
  • + //
  • ddos_attackNum_attackType :攻击总次数攻击类型分布排行 ;
  • + //
  • ddos_attackNum_sregion :攻击总次数攻击源地区分布排行 ;
  • + //
  • ddos_attackFlux_sip :攻击总流量攻击源ip分布排行 ;
  • + //
  • ddos_attackFlux_sregion :攻击总流量攻击源地区分布排行 。
  • + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 查询前多少个,传值为0返回全量。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 站点id集合,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // ddos策略组id 集合,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 端口号。 + Port *int64 `json:"Port,omitempty" name:"Port"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 攻击类型,取值有: + //
  • flood ;
  • + //
  • icmpFlood ;
  • + //
  • all 。
  • + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeDDosAttackTopDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackTopDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricName") + delete(f, "Limit") + delete(f, "ZoneIds") + delete(f, "PolicyIds") + delete(f, "Port") + delete(f, "ProtocolType") + delete(f, "AttackType") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDosAttackTopDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosAttackTopDataResponseParams struct { + // top数据内容 + Data []*TopNEntry `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应消息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDosAttackTopDataResponse struct { + *tchttp.BaseResponse + Response *DescribeDDosAttackTopDataResponseParams `json:"Response"` +} + +func (r *DescribeDDosAttackTopDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosAttackTopDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosMajorAttackEventRequestParams struct { + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos 策略组id集合,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeDDosMajorAttackEventRequest struct { + *tchttp.BaseRequest + + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos 策略组id集合,不填默认选择全部策略id。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 协议类型,取值有: + //
  • tcp ;
  • + //
  • udp ;
  • + //
  • all 。
  • + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeDDosMajorAttackEventRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosMajorAttackEventRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "PolicyIds") + delete(f, "ProtocolType") + delete(f, "ZoneIds") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDDosMajorAttackEventRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDDosMajorAttackEventResponseParams struct { + // DDos查询主攻击事件。 + Data *DDosMajorAttackEventData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应消息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDDosMajorAttackEventResponse struct { + *tchttp.BaseResponse + Response *DescribeDDosMajorAttackEventResponseParams `json:"Response"` +} + +func (r *DescribeDDosMajorAttackEventResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDDosMajorAttackEventResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDefaultCertificatesRequestParams struct { + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeDefaultCertificatesRequest struct { + *tchttp.BaseRequest + + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeDefaultCertificatesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDefaultCertificatesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDefaultCertificatesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDefaultCertificatesResponseParams struct { + // 证书总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 默认证书列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + CertInfo []*DefaultServerCertInfo `json:"CertInfo,omitempty" name:"CertInfo"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDefaultCertificatesResponse struct { + *tchttp.BaseResponse + Response *DescribeDefaultCertificatesResponseParams `json:"Response"` +} + +func (r *DescribeDefaultCertificatesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDefaultCertificatesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDnsDataRequestParams struct { + // 起始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 过滤参数 + Filters []*DnsDataFilter `json:"Filters,omitempty" name:"Filters"` + + // 时间粒度,默认为1分钟粒度,服务端根据时间范围自适应。 + // 支持指定以下几种粒度: + // min:1分钟粒度 + // 5min:5分钟粒度 + // hour:1小时粒度 + // day:天粒度 + Interval *string `json:"Interval,omitempty" name:"Interval"` +} + +type DescribeDnsDataRequest struct { + *tchttp.BaseRequest + + // 起始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 过滤参数 + Filters []*DnsDataFilter `json:"Filters,omitempty" name:"Filters"` + + // 时间粒度,默认为1分钟粒度,服务端根据时间范围自适应。 + // 支持指定以下几种粒度: + // min:1分钟粒度 + // 5min:5分钟粒度 + // hour:1小时粒度 + // day:天粒度 + Interval *string `json:"Interval,omitempty" name:"Interval"` +} + +func (r *DescribeDnsDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDnsDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "Filters") + delete(f, "Interval") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDnsDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDnsDataResponseParams struct { + // 统计曲线数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*DataItem `json:"Data,omitempty" name:"Data"` + + // 时间粒度 + // 注意:此字段可能返回 null,表示取不到有效值。 + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDnsDataResponse struct { + *tchttp.BaseResponse + Response *DescribeDnsDataResponseParams `json:"Response"` +} + +func (r *DescribeDnsDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDnsDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDnsRecordsRequestParams struct { + // 查询条件过滤器 + Filters []*DnsRecordFilter `json:"Filters,omitempty" name:"Filters"` + + // 排序 + Order *string `json:"Order,omitempty" name:"Order"` + + // 可选值 asc, desc + Direction *string `json:"Direction,omitempty" name:"Direction"` + + // 可选值 all, any + Match *string `json:"Match,omitempty" name:"Match"` + + // 分页查询限制数目,默认为 100,最大可设置为 1000 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 分页查询偏移量,默认为 0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeDnsRecordsRequest struct { + *tchttp.BaseRequest + + // 查询条件过滤器 + Filters []*DnsRecordFilter `json:"Filters,omitempty" name:"Filters"` + + // 排序 + Order *string `json:"Order,omitempty" name:"Order"` + + // 可选值 asc, desc + Direction *string `json:"Direction,omitempty" name:"Direction"` + + // 可选值 all, any + Match *string `json:"Match,omitempty" name:"Match"` + + // 分页查询限制数目,默认为 100,最大可设置为 1000 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 分页查询偏移量,默认为 0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeDnsRecordsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDnsRecordsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Filters") + delete(f, "Order") + delete(f, "Direction") + delete(f, "Match") + delete(f, "Limit") + delete(f, "Offset") + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDnsRecordsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDnsRecordsResponseParams struct { + // 总数,用于分页查询 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // DNS 记录列表 + Records []*DnsRecord `json:"Records,omitempty" name:"Records"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDnsRecordsResponse struct { + *tchttp.BaseResponse + Response *DescribeDnsRecordsResponseParams `json:"Response"` +} + +func (r *DescribeDnsRecordsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDnsRecordsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDnssecRequestParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` +} + +type DescribeDnssecRequest struct { + *tchttp.BaseRequest + + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` +} + +func (r *DescribeDnssecRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDnssecRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDnssecRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeDnssecResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // DNSSEC 状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` + + // DNSSEC 相关信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + Dnssec *DnssecInfo `json:"Dnssec,omitempty" name:"Dnssec"` + + // 修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeDnssecResponse struct { + *tchttp.BaseResponse + Response *DescribeDnssecResponseParams `json:"Response"` +} + +func (r *DescribeDnssecResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeDnssecResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeHostsCertificateRequestParams struct { + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页查询偏移量,默认为 0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目,默认为 100,最大可设置为 1000 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询条件过滤器 + Filters []*CertFilter `json:"Filters,omitempty" name:"Filters"` + + // 排序方式 + Sort *CertSort `json:"Sort,omitempty" name:"Sort"` +} + +type DescribeHostsCertificateRequest struct { + *tchttp.BaseRequest + + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页查询偏移量,默认为 0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目,默认为 100,最大可设置为 1000 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询条件过滤器 + Filters []*CertFilter `json:"Filters,omitempty" name:"Filters"` + + // 排序方式 + Sort *CertSort `json:"Sort,omitempty" name:"Sort"` +} + +func (r *DescribeHostsCertificateRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeHostsCertificateRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Filters") + delete(f, "Sort") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeHostsCertificateRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeHostsCertificateResponseParams struct { + // 总数,用于分页查询 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 域名证书配置列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + Hosts []*HostCertSetting `json:"Hosts,omitempty" name:"Hosts"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeHostsCertificateResponse struct { + *tchttp.BaseResponse + Response *DescribeHostsCertificateResponseParams `json:"Response"` +} + +func (r *DescribeHostsCertificateResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeHostsCertificateResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeHostsSettingRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页查询偏移量,默认为 0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目,默认为 100,最大可设置为 1000 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 指定域名查询 + Hosts []*string `json:"Hosts,omitempty" name:"Hosts"` +} + +type DescribeHostsSettingRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页查询偏移量,默认为 0 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目,默认为 100,最大可设置为 1000 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 指定域名查询 + Hosts []*string `json:"Hosts,omitempty" name:"Hosts"` +} + +func (r *DescribeHostsSettingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeHostsSettingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Hosts") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeHostsSettingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeHostsSettingResponseParams struct { + // 域名列表 + Hosts []*DetailHost `json:"Hosts,omitempty" name:"Hosts"` + + // 域名数量 + TotalNumber *int64 `json:"TotalNumber,omitempty" name:"TotalNumber"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeHostsSettingResponse struct { + *tchttp.BaseResponse + Response *DescribeHostsSettingResponseParams `json:"Response"` +} + +func (r *DescribeHostsSettingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeHostsSettingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeIdentificationRequestParams struct { + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` +} + +type DescribeIdentificationRequest struct { + *tchttp.BaseRequest + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` +} + +func (r *DescribeIdentificationRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeIdentificationRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Name") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeIdentificationRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeIdentificationResponseParams struct { + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 验证状态 + // - pending 验证中 + // - finished 验证完成 + Status *string `json:"Status,omitempty" name:"Status"` + + // 子域 + Subdomain *string `json:"Subdomain,omitempty" name:"Subdomain"` + + // 记录类型 + RecordType *string `json:"RecordType,omitempty" name:"RecordType"` + + // 记录值 + RecordValue *string `json:"RecordValue,omitempty" name:"RecordValue"` + + // 域名当前的 NS 记录 + // 注意:此字段可能返回 null,表示取不到有效值。 + OriginalNameServers []*string `json:"OriginalNameServers,omitempty" name:"OriginalNameServers"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeIdentificationResponse struct { + *tchttp.BaseResponse + Response *DescribeIdentificationResponseParams `json:"Response"` +} + +func (r *DescribeIdentificationResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeIdentificationResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeLoadBalancingDetailRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` +} + +type DescribeLoadBalancingDetailRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` +} + +func (r *DescribeLoadBalancingDetailRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeLoadBalancingDetailRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "LoadBalancingId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeLoadBalancingDetailRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeLoadBalancingDetailResponseParams struct { + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名,填写@表示根域 + Host *string `json:"Host,omitempty" name:"Host"` + + // 代理模式: + // dns_only: 仅DNS + // proxied: 开启代理 + Type *string `json:"Type,omitempty" name:"Type"` + + // 当Type=dns_only表示DNS的TTL时间 + TTL *uint64 `json:"TTL,omitempty" name:"TTL"` + + // 使用的源站组ID + OriginId []*string `json:"OriginId,omitempty" name:"OriginId"` + + // 使用的源站信息 + Origin []*OriginGroup `json:"Origin,omitempty" name:"Origin"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 调度域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cname *string `json:"Cname,omitempty" name:"Cname"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeLoadBalancingDetailResponse struct { + *tchttp.BaseResponse + Response *DescribeLoadBalancingDetailResponseParams `json:"Response"` +} + +func (r *DescribeLoadBalancingDetailResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeLoadBalancingDetailResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeLoadBalancingRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页参数Offset + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 分页参数Limit + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` + + // 过滤参数Host + Host *string `json:"Host,omitempty" name:"Host"` + + // 过滤参数Host是否支持模糊匹配 + Fuzzy *bool `json:"Fuzzy,omitempty" name:"Fuzzy"` +} + +type DescribeLoadBalancingRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 分页参数Offset + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 分页参数Limit + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` + + // 过滤参数Host + Host *string `json:"Host,omitempty" name:"Host"` + + // 过滤参数Host是否支持模糊匹配 + Fuzzy *bool `json:"Fuzzy,omitempty" name:"Fuzzy"` +} + +func (r *DescribeLoadBalancingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeLoadBalancingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Host") + delete(f, "Fuzzy") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeLoadBalancingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeLoadBalancingResponseParams struct { + // 记录总数 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 负载均衡信息 + Data []*LoadBalancing `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeLoadBalancingResponse struct { + *tchttp.BaseResponse + Response *DescribeLoadBalancingResponseParams `json:"Response"` +} + +func (r *DescribeLoadBalancingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeLoadBalancingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOriginGroupDetailRequestParams struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeOriginGroupDetailRequest struct { + *tchttp.BaseRequest + + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeOriginGroupDetailRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOriginGroupDetailRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "OriginId") + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeOriginGroupDetailRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOriginGroupDetailResponseParams struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 源站组名称 + OriginName *string `json:"OriginName,omitempty" name:"OriginName"` + + // 源站组配置类型 + // area:表示按照Record记录中的Area字段进行按客户端IP所在区域回源。 + // weight:表示按照Record记录中的Weight字段进行按权重回源。 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录 + Record []*OriginRecord `json:"Record,omitempty" name:"Record"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 源站类型 + // 注意:此字段可能返回 null,表示取不到有效值。 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 当前源站组是否被四层代理使用。 + // 注意:此字段可能返回 null,表示取不到有效值。 + ApplicationProxyUsed *bool `json:"ApplicationProxyUsed,omitempty" name:"ApplicationProxyUsed"` + + // 当前源站组是否被负载均衡使用。 + // 注意:此字段可能返回 null,表示取不到有效值。 + LoadBalancingUsed *bool `json:"LoadBalancingUsed,omitempty" name:"LoadBalancingUsed"` + + // 使用当前源站组的负载均衡的类型: + // none:未被使用 + // dns_only:被仅DNS类型负载均衡使用 + // proxied:被代理加速类型负载均衡使用 + // both:同时被仅DNS和代理加速类型负载均衡使用 + // 注意:此字段可能返回 null,表示取不到有效值。 + LoadBalancingUsedType *string `json:"LoadBalancingUsedType,omitempty" name:"LoadBalancingUsedType"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeOriginGroupDetailResponse struct { + *tchttp.BaseResponse + Response *DescribeOriginGroupDetailResponseParams `json:"Response"` +} + +func (r *DescribeOriginGroupDetailResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOriginGroupDetailResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOriginGroupRequestParams struct { + // 分页参数Offset + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 分页参数Limit + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` + + // 过滤参数 + Filters []*OriginFilter `json:"Filters,omitempty" name:"Filters"` + + // 站点ID + // 不填写获取所有站点源站组 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeOriginGroupRequest struct { + *tchttp.BaseRequest + + // 分页参数Offset + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 分页参数Limit + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` + + // 过滤参数 + Filters []*OriginFilter `json:"Filters,omitempty" name:"Filters"` + + // 站点ID + // 不填写获取所有站点源站组 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeOriginGroupRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOriginGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Filters") + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeOriginGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOriginGroupResponseParams struct { + // 源站组信息 + Data []*OriginGroup `json:"Data,omitempty" name:"Data"` + + // 记录总数 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeOriginGroupResponse struct { + *tchttp.BaseResponse + Response *DescribeOriginGroupResponseParams `json:"Response"` +} + +func (r *DescribeOriginGroupResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOriginGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOverviewL7DataRequestParams struct { + // RFC3339格式,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339格式,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 指标列表,支持的指标 + // l7Flow_outFlux: 访问流量 + // l7Flow_request: 访问请求数 + // l7Flow_outBandwidth: 访问带宽 + // l7Flow_hit_outFlux: 缓存命中流量 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId列表,仅在zone/domain维度下查询时该参数有效 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // Domain列表,仅在domain维度下查询时该参数有效 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 协议类型, 选填{http,http2,https,all} + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeOverviewL7DataRequest struct { + *tchttp.BaseRequest + + // RFC3339格式,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339格式,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 指标列表,支持的指标 + // l7Flow_outFlux: 访问流量 + // l7Flow_request: 访问请求数 + // l7Flow_outBandwidth: 访问带宽 + // l7Flow_hit_outFlux: 缓存命中流量 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId列表,仅在zone/domain维度下查询时该参数有效 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // Domain列表,仅在domain维度下查询时该参数有效 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 协议类型, 选填{http,http2,https,all} + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeOverviewL7DataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOverviewL7DataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "Interval") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "Protocol") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeOverviewL7DataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOverviewL7DataResponseParams struct { + // 查询维度 + Type *string `json:"Type,omitempty" name:"Type"` + + // 时间间隔 + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 详细数据 + Data []*TimingDataRecord `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeOverviewL7DataResponse struct { + *tchttp.BaseResponse + Response *DescribeOverviewL7DataResponseParams `json:"Response"` +} + +func (r *DescribeOverviewL7DataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOverviewL7DataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribePrefetchTasksRequestParams struct { + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 查询起始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 查询结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 查询起始偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 查询最大返回的结果条数 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询的状态 + // 允许的值为:processing、success、failed、timeout、invalid + Statuses []*string `json:"Statuses,omitempty" name:"Statuses"` + + // zone id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 查询的域名列表 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 查询的资源 + Target *string `json:"Target,omitempty" name:"Target"` +} + +type DescribePrefetchTasksRequest struct { + *tchttp.BaseRequest + + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 查询起始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 查询结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 查询起始偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 查询最大返回的结果条数 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询的状态 + // 允许的值为:processing、success、failed、timeout、invalid + Statuses []*string `json:"Statuses,omitempty" name:"Statuses"` + + // zone id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 查询的域名列表 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 查询的资源 + Target *string `json:"Target,omitempty" name:"Target"` +} + +func (r *DescribePrefetchTasksRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribePrefetchTasksRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "JobId") + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Statuses") + delete(f, "ZoneId") + delete(f, "Domains") + delete(f, "Target") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribePrefetchTasksRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribePrefetchTasksResponseParams struct { + // 该查询条件总共条目数 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 任务结果列表 + Tasks []*Task `json:"Tasks,omitempty" name:"Tasks"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribePrefetchTasksResponse struct { + *tchttp.BaseResponse + Response *DescribePrefetchTasksResponseParams `json:"Response"` +} + +func (r *DescribePrefetchTasksResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribePrefetchTasksResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribePurgeTasksRequestParams struct { + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 查询起始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 查询结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 查询起始偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 查询最大返回的结果条数 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询的状态 + // 允许的值为:processing、success、failed、timeout、invalid + Statuses []*string `json:"Statuses,omitempty" name:"Statuses"` + + // zone id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 查询的域名列表 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 查询内容 + Target *string `json:"Target,omitempty" name:"Target"` +} + +type DescribePurgeTasksRequest struct { + *tchttp.BaseRequest + + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 查询起始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 查询结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 查询起始偏移量 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 查询最大返回的结果条数 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询的状态 + // 允许的值为:processing、success、failed、timeout、invalid + Statuses []*string `json:"Statuses,omitempty" name:"Statuses"` + + // zone id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 查询的域名列表 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 查询内容 + Target *string `json:"Target,omitempty" name:"Target"` +} + +func (r *DescribePurgeTasksRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribePurgeTasksRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "JobId") + delete(f, "Type") + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Statuses") + delete(f, "ZoneId") + delete(f, "Domains") + delete(f, "Target") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribePurgeTasksRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribePurgeTasksResponseParams struct { + // 该查询条件总共条目数 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 任务结果列表 + Tasks []*Task `json:"Tasks,omitempty" name:"Tasks"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribePurgeTasksResponse struct { + *tchttp.BaseResponse + Response *DescribePurgeTasksResponseParams `json:"Response"` +} + +func (r *DescribePurgeTasksResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribePurgeTasksResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeRulesRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 过滤参数,不填默认不过滤。 + Filters []*RuleFilter `json:"Filters,omitempty" name:"Filters"` +} + +type DescribeRulesRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 过滤参数,不填默认不过滤。 + Filters []*RuleFilter `json:"Filters,omitempty" name:"Filters"` +} + +func (r *DescribeRulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeRulesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Filters") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeRulesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeRulesResponseParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则列表,按规则执行顺序从先往后排序。 + RuleList []*RuleSettingDetail `json:"RuleList,omitempty" name:"RuleList"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeRulesResponse struct { + *tchttp.BaseResponse + Response *DescribeRulesResponseParams `json:"Response"` +} + +func (r *DescribeRulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeRulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeRulesSettingRequestParams struct { + +} + +type DescribeRulesSettingRequest struct { + *tchttp.BaseRequest + +} + +func (r *DescribeRulesSettingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeRulesSettingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeRulesSettingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeRulesSettingResponseParams struct { + // 规则引擎可应用匹配请求的设置列表及其详细建议配置信息。 + Actions []*RulesSettingAction `json:"Actions,omitempty" name:"Actions"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeRulesSettingResponse struct { + *tchttp.BaseResponse + Response *DescribeRulesSettingResponseParams `json:"Response"` +} + +func (r *DescribeRulesSettingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeRulesSettingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyListRequestParams struct { + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeSecurityPolicyListRequest struct { + *tchttp.BaseRequest + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeSecurityPolicyListRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyListRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeSecurityPolicyListRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyListResponseParams struct { + // 防护资源列表 + Entities []*SecurityEntity `json:"Entities,omitempty" name:"Entities"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeSecurityPolicyListResponse struct { + *tchttp.BaseResponse + Response *DescribeSecurityPolicyListResponseParams `json:"Response"` +} + +func (r *DescribeSecurityPolicyListResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyListResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyManagedRulesIdRequestParams struct { + // 规则id集合 + RuleId []*int64 `json:"RuleId,omitempty" name:"RuleId"` +} + +type DescribeSecurityPolicyManagedRulesIdRequest struct { + *tchttp.BaseRequest + + // 规则id集合 + RuleId []*int64 `json:"RuleId,omitempty" name:"RuleId"` +} + +func (r *DescribeSecurityPolicyManagedRulesIdRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyManagedRulesIdRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "RuleId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeSecurityPolicyManagedRulesIdRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyManagedRulesIdResponseParams struct { + // 返回总数 + Total *int64 `json:"Total,omitempty" name:"Total"` + + // 门神规则 + Rules []*ManagedRule `json:"Rules,omitempty" name:"Rules"` + + // 返回总数 + Count *int64 `json:"Count,omitempty" name:"Count"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeSecurityPolicyManagedRulesIdResponse struct { + *tchttp.BaseResponse + Response *DescribeSecurityPolicyManagedRulesIdResponseParams `json:"Response"` +} + +func (r *DescribeSecurityPolicyManagedRulesIdResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyManagedRulesIdResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyManagedRulesRequestParams struct { + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 页数 + Page *int64 `json:"Page,omitempty" name:"Page"` + + // 每页数量 + PerPage *int64 `json:"PerPage,omitempty" name:"PerPage"` +} + +type DescribeSecurityPolicyManagedRulesRequest struct { + *tchttp.BaseRequest + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 页数 + Page *int64 `json:"Page,omitempty" name:"Page"` + + // 每页数量 + PerPage *int64 `json:"PerPage,omitempty" name:"PerPage"` +} + +func (r *DescribeSecurityPolicyManagedRulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyManagedRulesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Entity") + delete(f, "Page") + delete(f, "PerPage") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeSecurityPolicyManagedRulesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyManagedRulesResponseParams struct { + // 本次返回的规则数 + Count *int64 `json:"Count,omitempty" name:"Count"` + + // 门神规则 + Rules []*ManagedRule `json:"Rules,omitempty" name:"Rules"` + + // 总规则数 + Total *int64 `json:"Total,omitempty" name:"Total"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeSecurityPolicyManagedRulesResponse struct { + *tchttp.BaseResponse + Response *DescribeSecurityPolicyManagedRulesResponseParams `json:"Response"` +} + +func (r *DescribeSecurityPolicyManagedRulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyManagedRulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyRegionsRequestParams struct { + +} + +type DescribeSecurityPolicyRegionsRequest struct { + *tchttp.BaseRequest + +} + +func (r *DescribeSecurityPolicyRegionsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyRegionsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeSecurityPolicyRegionsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyRegionsResponseParams struct { + // 总数 + Count *int64 `json:"Count,omitempty" name:"Count"` + + // 地域信息 + GeoIp []*GeoIp `json:"GeoIp,omitempty" name:"GeoIp"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeSecurityPolicyRegionsResponse struct { + *tchttp.BaseResponse + Response *DescribeSecurityPolicyRegionsResponseParams `json:"Response"` +} + +func (r *DescribeSecurityPolicyRegionsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyRegionsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyRequestParams struct { + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名 + Entity *string `json:"Entity,omitempty" name:"Entity"` +} + +type DescribeSecurityPolicyRequest struct { + *tchttp.BaseRequest + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名 + Entity *string `json:"Entity,omitempty" name:"Entity"` +} + +func (r *DescribeSecurityPolicyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Entity") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeSecurityPolicyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPolicyResponseParams struct { + // 用户id + AppId *int64 `json:"AppId,omitempty" name:"AppId"` + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 安全配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + Config *SecurityConfig `json:"Config,omitempty" name:"Config"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeSecurityPolicyResponse struct { + *tchttp.BaseResponse + Response *DescribeSecurityPolicyResponseParams `json:"Response"` +} + +func (r *DescribeSecurityPolicyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPolicyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPortraitRulesRequestParams struct { + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` +} + +type DescribeSecurityPortraitRulesRequest struct { + *tchttp.BaseRequest + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` +} + +func (r *DescribeSecurityPortraitRulesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPortraitRulesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Entity") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeSecurityPortraitRulesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeSecurityPortraitRulesResponseParams struct { + // 本次返回的规则数 + Count *int64 `json:"Count,omitempty" name:"Count"` + + // Bot用户画像规则 + Rules []*PortraitManagedRuleDetail `json:"Rules,omitempty" name:"Rules"` + + // 总规则数 + Total *int64 `json:"Total,omitempty" name:"Total"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeSecurityPortraitRulesResponse struct { + *tchttp.BaseResponse + Response *DescribeSecurityPortraitRulesResponseParams `json:"Response"` +} + +func (r *DescribeSecurityPortraitRulesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeSecurityPortraitRulesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTimingL4DataRequestParams struct { + // RFC3339格式,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339格式,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 支持的指标: + // l4Flow_connections: 访问连接数 + // l4Flow_flux: 访问总流量 + // l4Flow_inFlux: 访问入流量 + // l4Flow_outFlux: 访问出流量 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 该字段已废弃,请使用ProxyIds字段 + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds"` + + // 该字段当前无效 + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // 时间间隔,选填{min, 5min, hour, day} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 该字段当前无效,请使用Filter筛选 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 支持的 Filter:proxyd,ruleId + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 四层实例列表 + ProxyIds []*string `json:"ProxyIds,omitempty" name:"ProxyIds"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeTimingL4DataRequest struct { + *tchttp.BaseRequest + + // RFC3339格式,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339格式,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 支持的指标: + // l4Flow_connections: 访问连接数 + // l4Flow_flux: 访问总流量 + // l4Flow_inFlux: 访问入流量 + // l4Flow_outFlux: 访问出流量 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 该字段已废弃,请使用ProxyIds字段 + InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds"` + + // 该字段当前无效 + Protocol *string `json:"Protocol,omitempty" name:"Protocol"` + + // 时间间隔,选填{min, 5min, hour, day} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 该字段当前无效,请使用Filter筛选 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 支持的 Filter:proxyd,ruleId + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 四层实例列表 + ProxyIds []*string `json:"ProxyIds,omitempty" name:"ProxyIds"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeTimingL4DataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTimingL4DataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "ZoneIds") + delete(f, "InstanceIds") + delete(f, "Protocol") + delete(f, "Interval") + delete(f, "RuleId") + delete(f, "Filters") + delete(f, "ProxyIds") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTimingL4DataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTimingL4DataResponseParams struct { + // 查询维度 + Type *string `json:"Type,omitempty" name:"Type"` + + // 时间间隔 + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 详细数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*TimingDataRecord `json:"Data,omitempty" name:"Data"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeTimingL4DataResponse struct { + *tchttp.BaseResponse + Response *DescribeTimingL4DataResponseParams `json:"Response"` +} + +func (r *DescribeTimingL4DataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTimingL4DataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTimingL7AnalysisDataRequestParams struct { + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 指标列表,支持的指标 + // l7Flow_outFlux: 访问流量 + // l7Flow_request: 访问请求数 + // l7Flow_outBandwidth: 访问带宽 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId数组 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeTimingL7AnalysisDataRequest struct { + *tchttp.BaseRequest + + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 指标列表,支持的指标 + // l7Flow_outFlux: 访问流量 + // l7Flow_request: 访问请求数 + // l7Flow_outBandwidth: 访问带宽 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId数组 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeTimingL7AnalysisDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTimingL7AnalysisDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "Interval") + delete(f, "ZoneIds") + delete(f, "Filters") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTimingL7AnalysisDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTimingL7AnalysisDataResponseParams struct { + // 详细数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*TimingDataRecord `json:"Data,omitempty" name:"Data"` + + // 查询维度 + Type *string `json:"Type,omitempty" name:"Type"` + + // 时间间隔 + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeTimingL7AnalysisDataResponse struct { + *tchttp.BaseResponse + Response *DescribeTimingL7AnalysisDataResponseParams `json:"Response"` +} + +func (r *DescribeTimingL7AnalysisDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTimingL7AnalysisDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTimingL7CacheDataRequestParams struct { + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 时序类访问流量指标列表,支持的指标 + // l7Cache_outFlux: 访问流量 + // l7Cache_request: 访问请求数 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 站点id列表 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件,筛选EO/源站响应如下: + // EO响应:{Key: "cacheType", Value: ["hit"], Operator: "equals"}; + // 源站响应:{Key: "cacheType", Value: ["miss", "dynamic"], Operator: "equals"} + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeTimingL7CacheDataRequest struct { + *tchttp.BaseRequest + + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 时序类访问流量指标列表,支持的指标 + // l7Cache_outFlux: 访问流量 + // l7Cache_request: 访问请求数 + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 站点id列表 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件,筛选EO/源站响应如下: + // EO响应:{Key: "cacheType", Value: ["hit"], Operator: "equals"}; + // 源站响应:{Key: "cacheType", Value: ["miss", "dynamic"], Operator: "equals"} + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeTimingL7CacheDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTimingL7CacheDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "Interval") + delete(f, "ZoneIds") + delete(f, "Filters") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTimingL7CacheDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTimingL7CacheDataResponseParams struct { + // 详细数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*TimingDataRecord `json:"Data,omitempty" name:"Data"` + + // 查询维度 + Type *string `json:"Type,omitempty" name:"Type"` + + // 时间间隔 + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeTimingL7CacheDataResponse struct { + *tchttp.BaseResponse + Response *DescribeTimingL7CacheDataResponseParams `json:"Response"` +} + +func (r *DescribeTimingL7CacheDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTimingL7CacheDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTopL7AnalysisDataRequestParams struct { + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 时序类访问流量指标 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // topN,填0时返回全量数据 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId数组 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeTopL7AnalysisDataRequest struct { + *tchttp.BaseRequest + + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 时序类访问流量指标 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // topN,填0时返回全量数据 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId数组 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeTopL7AnalysisDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopL7AnalysisDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricName") + delete(f, "Limit") + delete(f, "Interval") + delete(f, "ZoneIds") + delete(f, "Filters") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTopL7AnalysisDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTopL7AnalysisDataResponseParams struct { + // top详细数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*TopDataRecord `json:"Data,omitempty" name:"Data"` + + // 查询维度 + Type *string `json:"Type,omitempty" name:"Type"` + + // 查询指标 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeTopL7AnalysisDataResponse struct { + *tchttp.BaseResponse + Response *DescribeTopL7AnalysisDataResponseParams `json:"Response"` +} + +func (r *DescribeTopL7AnalysisDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopL7AnalysisDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTopL7CacheDataRequestParams struct { + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 时序类访问流量指标 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // topN,填0时返回全量数据 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId数组 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeTopL7CacheDataRequest struct { + *tchttp.BaseRequest + + // RFC3339标准,客户端时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // RFC3339标准,客户端时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 时序类访问流量指标 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // topN,填0时返回全量数据 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 时间间隔,选填{min, 5min, hour, day, week} + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // ZoneId数组 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 筛选条件 + Filters []*Filter `json:"Filters,omitempty" name:"Filters"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeTopL7CacheDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopL7CacheDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricName") + delete(f, "Limit") + delete(f, "Interval") + delete(f, "ZoneIds") + delete(f, "Filters") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTopL7CacheDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeTopL7CacheDataResponseParams struct { + // top详细数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*TopDataRecord `json:"Data,omitempty" name:"Data"` + + // 查询维度 + Type *string `json:"Type,omitempty" name:"Type"` + + // 查询指标 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeTopL7CacheDataResponse struct { + *tchttp.BaseResponse + Response *DescribeTopL7CacheDataResponseParams `json:"Response"` +} + +func (r *DescribeTopL7CacheDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopL7CacheDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesAttackEventsRequestParams struct { + // 开始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 条数 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 当前页 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos策略组id列表 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 站点集合 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 子域名列表 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 选填{Y、N},默认为Y;Y:展示,N:不展示 + IsShowDetail *string `json:"IsShowDetail,omitempty" name:"IsShowDetail"` +} + +type DescribeWebManagedRulesAttackEventsRequest struct { + *tchttp.BaseRequest + + // 开始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 条数 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 当前页 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // ddos策略组id列表 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 站点集合 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 子域名列表 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 选填{Y、N},默认为Y;Y:展示,N:不展示 + IsShowDetail *string `json:"IsShowDetail,omitempty" name:"IsShowDetail"` +} + +func (r *DescribeWebManagedRulesAttackEventsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesAttackEventsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "PolicyIds") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "IsShowDetail") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebManagedRulesAttackEventsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesAttackEventsResponseParams struct { + // Web攻击事件数据 + Data *WebEventData `json:"Data,omitempty" name:"Data"` + + // 状态,1:失败,0:成功 + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 返回数据 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebManagedRulesAttackEventsResponse struct { + *tchttp.BaseResponse + Response *DescribeWebManagedRulesAttackEventsResponseParams `json:"Response"` +} + +func (r *DescribeWebManagedRulesAttackEventsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesAttackEventsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesDataRequestParams struct { + // 开始时间,RFC3339格式。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间,RFC3339格式。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • waf_interceptNum :waf拦截次数 。
  • + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 子域名列表,不填默认选择子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 该字段已废弃,请勿传。 + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 该字段已废弃,请勿传。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 筛选条件,取值有: + //
  • action :执行动作 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeWebManagedRulesDataRequest struct { + *tchttp.BaseRequest + + // 开始时间,RFC3339格式。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间,RFC3339格式。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • waf_interceptNum :waf拦截次数 。
  • + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 子域名列表,不填默认选择子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 该字段已废弃,请勿传。 + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 该字段已废弃,请勿传。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 筛选条件,取值有: + //
  • action :执行动作 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeWebManagedRulesDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "ProtocolType") + delete(f, "AttackType") + delete(f, "Interval") + delete(f, "QueryCondition") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebManagedRulesDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesDataResponseParams struct { + // Web攻击日志实体。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*SecEntry `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应消息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebManagedRulesDataResponse struct { + *tchttp.BaseResponse + Response *DescribeWebManagedRulesDataResponseParams `json:"Response"` +} + +func (r *DescribeWebManagedRulesDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesLogRequestParams struct { + // 起始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点集合,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 域名集合,不填默认选择全部子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 筛选条件,取值有: + //
  • attackType :攻击类型 ;
  • + //
  • riskLevel :风险等级 ;
  • + //
  • action :执行动作(处置方式) ;
  • + //
  • ruleId :规则id ;
  • + //
  • sipCountryCode :ip所在国家 ;
  • + //
  • attackIp :攻击ip ;
  • + //
  • oriDomain :被攻击的子域名 ;
  • + //
  • eventId :事件id ;
  • + //
  • ua :用户代理 ;
  • + //
  • requestMethod :请求方法 ;
  • + //
  • uri :统一资源标识符 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeWebManagedRulesLogRequest struct { + *tchttp.BaseRequest + + // 起始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点集合,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 域名集合,不填默认选择全部子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 筛选条件,取值有: + //
  • attackType :攻击类型 ;
  • + //
  • riskLevel :风险等级 ;
  • + //
  • action :执行动作(处置方式) ;
  • + //
  • ruleId :规则id ;
  • + //
  • sipCountryCode :ip所在国家 ;
  • + //
  • attackIp :攻击ip ;
  • + //
  • oriDomain :被攻击的子域名 ;
  • + //
  • eventId :事件id ;
  • + //
  • ua :用户代理 ;
  • + //
  • requestMethod :请求方法 ;
  • + //
  • uri :统一资源标识符 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeWebManagedRulesLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesLogRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "QueryCondition") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebManagedRulesLogRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesLogResponseParams struct { + // web攻击日志数据内容。 + Data *WebLogData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebManagedRulesLogResponse struct { + *tchttp.BaseResponse + Response *DescribeWebManagedRulesLogResponseParams `json:"Response"` +} + +func (r *DescribeWebManagedRulesLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesTopDataRequestParams struct { + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • waf_requestNum_url :url请求数排行 ;
  • + //
  • waf_requestNum_cip:客户端ip请求数排行 ;
  • + //
  • waf_cipRequestNum_region :客户端区域请求数排行 。
  • + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 查询前多少个,传值为0返回全量。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 该字段已废弃,请勿传。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 该字段已废弃,请勿传。 + Port *int64 `json:"Port,omitempty" name:"Port"` + + // 该字段已废弃,请勿传。 + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 该字段已废弃,请勿传。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 域名列表,不填默认选择全部子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 筛选条件,取值有: + //
  • action :执行动作 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeWebManagedRulesTopDataRequest struct { + *tchttp.BaseRequest + + // 开始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • waf_requestNum_url :url请求数排行 ;
  • + //
  • waf_requestNum_cip:客户端ip请求数排行 ;
  • + //
  • waf_cipRequestNum_region :客户端区域请求数排行 。
  • + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 查询前多少个,传值为0返回全量。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 该字段已废弃,请勿传。 + PolicyIds []*int64 `json:"PolicyIds,omitempty" name:"PolicyIds"` + + // 该字段已废弃,请勿传。 + Port *int64 `json:"Port,omitempty" name:"Port"` + + // 该字段已废弃,请勿传。 + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 该字段已废弃,请勿传。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 域名列表,不填默认选择全部子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 筛选条件,取值有: + //
  • action :执行动作 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeWebManagedRulesTopDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesTopDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricName") + delete(f, "Limit") + delete(f, "ZoneIds") + delete(f, "PolicyIds") + delete(f, "Port") + delete(f, "ProtocolType") + delete(f, "AttackType") + delete(f, "Domains") + delete(f, "Interval") + delete(f, "QueryCondition") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebManagedRulesTopDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebManagedRulesTopDataResponseParams struct { + // top数据内容。 + Data []*TopNEntry `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应消息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebManagedRulesTopDataResponse struct { + *tchttp.BaseResponse + Response *DescribeWebManagedRulesTopDataResponseParams `json:"Response"` +} + +func (r *DescribeWebManagedRulesTopDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebManagedRulesTopDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebProtectionAttackEventsRequestParams struct { + // 开始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 条数 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 当前页 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 域名 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 站点集合 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` +} + +type DescribeWebProtectionAttackEventsRequest struct { + *tchttp.BaseRequest + + // 开始时间 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 条数 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 当前页 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 域名 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 站点集合 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` +} + +func (r *DescribeWebProtectionAttackEventsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebProtectionAttackEventsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "Domains") + delete(f, "ZoneIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebProtectionAttackEventsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebProtectionAttackEventsResponseParams struct { + // DDos攻击事件数据 + Data *CCInterceptEventData `json:"Data,omitempty" name:"Data"` + + // 状态,1:失败,0:成功 + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 返回消息 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebProtectionAttackEventsResponse struct { + *tchttp.BaseResponse + Response *DescribeWebProtectionAttackEventsResponseParams `json:"Response"` +} + +func (r *DescribeWebProtectionAttackEventsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebProtectionAttackEventsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebProtectionDataRequestParams struct { + // 开始时间,RFC3339格式。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间,RFC3339格式。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • ccRate_interceptNum :速率限制规则限制次数 ;
  • + //
  • ccAcl_interceptNum :自定义规则拦截次数 。
  • + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 子域名列表,不填默认选择全部子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 该字段已废弃,请勿传。 + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 该字段已废弃,请勿传。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 筛选条件,取值有: + //
  • action :执行动作 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeWebProtectionDataRequest struct { + *tchttp.BaseRequest + + // 开始时间,RFC3339格式。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间,RFC3339格式。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 统计指标列表,取值有: + //
  • ccRate_interceptNum :速率限制规则限制次数 ;
  • + //
  • ccAcl_interceptNum :自定义规则拦截次数 。
  • + MetricNames []*string `json:"MetricNames,omitempty" name:"MetricNames"` + + // 站点id列表,不填默认选择全部站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 子域名列表,不填默认选择全部子域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 该字段已废弃,请勿传。 + ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` + + // 该字段已废弃,请勿传。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 筛选条件,取值有: + //
  • action :执行动作 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeWebProtectionDataRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebProtectionDataRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "MetricNames") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "ProtocolType") + delete(f, "AttackType") + delete(f, "Interval") + delete(f, "QueryCondition") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebProtectionDataRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebProtectionDataResponseParams struct { + // 数据详情。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*SecEntry `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应消息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 查询时间粒度,取值有: + //
  • min :1分钟 ;
  • + //
  • 5min :5分钟 ;
  • + //
  • hour :1小时 ;
  • + //
  • day :1天 。
  • + Interval *string `json:"Interval,omitempty" name:"Interval"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebProtectionDataResponse struct { + *tchttp.BaseResponse + Response *DescribeWebProtectionDataResponseParams `json:"Response"` +} + +func (r *DescribeWebProtectionDataResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebProtectionDataResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebProtectionLogRequestParams struct { + // 起始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点集合,不填默认查询所有站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 域名集合,不填默认查询所有域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 筛选条件。 + // 限速规则日志中取值有: + //
  • action :执行动作(处置方式);
  • + //
  • ruleId :规则id ;
  • + //
  • oriDomain :被攻击的子域名 ;
  • + //
  • attackIp :攻击ip 。
  • + // 自定义规则日志中取值有: + //
  • action :执行动作(处置方式);
  • + //
  • ruleId :规则id ;
  • + //
  • oriDomain :被攻击的子域名 ;
  • + //
  • attackIp :攻击ip ;
  • + //
  • eventId :事件id ;
  • + //
  • ua :用户代理 ;
  • + //
  • requestMethod :请求方法 ;
  • + //
  • uri :统一资源标识符 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 日志类型,取值有: + //
  • rate :限速日志 ;
  • + //
  • acl :自定义规则日志 。
  • 不填默认为rate。 + EntityType *string `json:"EntityType,omitempty" name:"EntityType"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +type DescribeWebProtectionLogRequest struct { + *tchttp.BaseRequest + + // 起始时间。 + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间。 + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点集合,不填默认查询所有站点。 + ZoneIds []*string `json:"ZoneIds,omitempty" name:"ZoneIds"` + + // 域名集合,不填默认查询所有域名。 + Domains []*string `json:"Domains,omitempty" name:"Domains"` + + // 筛选条件。 + // 限速规则日志中取值有: + //
  • action :执行动作(处置方式);
  • + //
  • ruleId :规则id ;
  • + //
  • oriDomain :被攻击的子域名 ;
  • + //
  • attackIp :攻击ip 。
  • + // 自定义规则日志中取值有: + //
  • action :执行动作(处置方式);
  • + //
  • ruleId :规则id ;
  • + //
  • oriDomain :被攻击的子域名 ;
  • + //
  • attackIp :攻击ip ;
  • + //
  • eventId :事件id ;
  • + //
  • ua :用户代理 ;
  • + //
  • requestMethod :请求方法 ;
  • + //
  • uri :统一资源标识符 。
  • + QueryCondition []*QueryCondition `json:"QueryCondition,omitempty" name:"QueryCondition"` + + // 日志类型,取值有: + //
  • rate :限速日志 ;
  • + //
  • acl :自定义规则日志 。
  • 不填默认为rate。 + EntityType *string `json:"EntityType,omitempty" name:"EntityType"` + + // 数据归属地区,取值有: + //
  • overseas :全球(除中国大陆地区)数据 ;
  • + //
  • mainland :中国大陆地区数据 。
  • 不填默认查询overseas。 + Area *string `json:"Area,omitempty" name:"Area"` +} + +func (r *DescribeWebProtectionLogRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebProtectionLogRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "ZoneIds") + delete(f, "Domains") + delete(f, "QueryCondition") + delete(f, "EntityType") + delete(f, "Area") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeWebProtectionLogRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeWebProtectionLogResponseParams struct { + // 限速拦截数据内容。 + Data *CCLogData `json:"Data,omitempty" name:"Data"` + + // 请求响应状态,取值有: + //
  • 1 :失败 ;
  • + //
  • 0 :成功 。
  • + Status *int64 `json:"Status,omitempty" name:"Status"` + + // 请求响应信息。 + Msg *string `json:"Msg,omitempty" name:"Msg"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeWebProtectionLogResponse struct { + *tchttp.BaseResponse + Response *DescribeWebProtectionLogResponseParams `json:"Response"` +} + +func (r *DescribeWebProtectionLogResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeWebProtectionLogResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZoneDDoSPolicyRequestParams struct { + // 一级域名id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeZoneDDoSPolicyRequest struct { + *tchttp.BaseRequest + + // 一级域名id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeZoneDDoSPolicyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZoneDDoSPolicyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeZoneDDoSPolicyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZoneDDoSPolicyResponseParams struct { + // 用户appid + AppId *int64 `json:"AppId,omitempty" name:"AppId"` + + // 防护分区 + ShieldAreas []*ShieldArea `json:"ShieldAreas,omitempty" name:"ShieldAreas"` + + // 所有子域名信息,包含安全加速/内容加速 + // 注意:此字段可能返回 null,表示取不到有效值。 + Domains []*DDoSApplication `json:"Domains,omitempty" name:"Domains"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeZoneDDoSPolicyResponse struct { + *tchttp.BaseResponse + Response *DescribeZoneDDoSPolicyResponseParams `json:"Response"` +} + +func (r *DescribeZoneDDoSPolicyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZoneDDoSPolicyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZoneDetailsRequestParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` +} + +type DescribeZoneDetailsRequest struct { + *tchttp.BaseRequest + + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` +} + +func (r *DescribeZoneDetailsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZoneDetailsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeZoneDetailsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZoneDetailsResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 用户当前使用的 NS 列表 + OriginalNameServers []*string `json:"OriginalNameServers,omitempty" name:"OriginalNameServers"` + + // 腾讯云分配给用户的 NS 列表 + NameServers []*string `json:"NameServers,omitempty" name:"NameServers"` + + // 站点状态 + // - active:NS 已切换 + // - pending:NS 未切换 + // - moved:NS 已切走 + // - deactivated:被封禁 + Status *string `json:"Status,omitempty" name:"Status"` + + // 站点接入方式 + // - full:NS 接入 + // - partial:CNAME 接入 + Type *string `json:"Type,omitempty" name:"Type"` + + // 站点是否关闭 + Paused *bool `json:"Paused,omitempty" name:"Paused"` + + // 是否开启 CNAME 加速 + // - enabled:开启 + // - disabled:关闭 + CnameSpeedUp *string `json:"CnameSpeedUp,omitempty" name:"CnameSpeedUp"` + + // cname切换验证状态 + // - finished 切换完成 + // - pending 切换验证中 + CnameStatus *string `json:"CnameStatus,omitempty" name:"CnameStatus"` + + // 资源标签 + // 注意:此字段可能返回 null,表示取不到有效值。 + Tags []*Tag `json:"Tags,omitempty" name:"Tags"` + + // 站点接入地域,取值为: + //
  • global:全球;
  • + //
  • mainland:中国大陆;
  • + //
  • overseas:境外区域。
  • + Area *string `json:"Area,omitempty" name:"Area"` + + // 计费资源 + // 注意:此字段可能返回 null,表示取不到有效值。 + Resources []*Resource `json:"Resources,omitempty" name:"Resources"` + + // 站点修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 站点创建时间 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 用户自定义 NS 信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + VanityNameServers *VanityNameServers `json:"VanityNameServers,omitempty" name:"VanityNameServers"` + + // 用户自定义 NS IP 信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + VanityNameServersIps []*VanityNameServersIps `json:"VanityNameServersIps,omitempty" name:"VanityNameServersIps"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeZoneDetailsResponse struct { + *tchttp.BaseResponse + Response *DescribeZoneDetailsResponseParams `json:"Response"` +} + +func (r *DescribeZoneDetailsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZoneDetailsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZoneSettingRequestParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type DescribeZoneSettingRequest struct { + *tchttp.BaseRequest + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *DescribeZoneSettingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZoneSettingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeZoneSettingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZoneSettingResponseParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称。 + Zone *string `json:"Zone,omitempty" name:"Zone"` + + // 缓存过期时间配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cache *CacheConfig `json:"Cache,omitempty" name:"Cache"` + + // 节点缓存键配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + CacheKey *CacheKey `json:"CacheKey,omitempty" name:"CacheKey"` + + // Quic访问配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Quic *Quic `json:"Quic,omitempty" name:"Quic"` + + // POST请求传输配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + PostMaxSize *PostMaxSize `json:"PostMaxSize,omitempty" name:"PostMaxSize"` + + // 智能压缩配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Compression *Compression `json:"Compression,omitempty" name:"Compression"` + + // Http2回源配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + UpstreamHttp2 *UpstreamHttp2 `json:"UpstreamHttp2,omitempty" name:"UpstreamHttp2"` + + // 访问协议强制Https跳转配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + ForceRedirect *ForceRedirect `json:"ForceRedirect,omitempty" name:"ForceRedirect"` + + // Https 加速配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Https *Https `json:"Https,omitempty" name:"Https"` + + // 源站配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Origin *Origin `json:"Origin,omitempty" name:"Origin"` + + // 智能加速配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + SmartRouting *SmartRouting `json:"SmartRouting,omitempty" name:"SmartRouting"` + + // 浏览器缓存配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + MaxAge *MaxAge `json:"MaxAge,omitempty" name:"MaxAge"` + + // 离线缓存配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + OfflineCache *OfflineCache `json:"OfflineCache,omitempty" name:"OfflineCache"` + + // WebSocket配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + WebSocket *WebSocket `json:"WebSocket,omitempty" name:"WebSocket"` + + // 客户端IP回源请求头配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + ClientIpHeader *ClientIp `json:"ClientIpHeader,omitempty" name:"ClientIpHeader"` + + // 缓存预刷新配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + CachePrefresh *CachePrefresh `json:"CachePrefresh,omitempty" name:"CachePrefresh"` + + // Ipv6访问配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` + + // 站点加速区域信息,取值有: + //
  • mainland:中国境内加速;
  • + //
  • overseas:中国境外加速。
  • + Area *string `json:"Area,omitempty" name:"Area"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeZoneSettingResponse struct { + *tchttp.BaseResponse + Response *DescribeZoneSettingResponseParams `json:"Response"` +} + +func (r *DescribeZoneSettingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZoneSettingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZonesRequestParams struct { + // 分页查询偏移量。默认值:0,最小值:0。 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目。默认值:1000,最大值:1000。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询条件过滤器,复杂类型。 + Filters []*ZoneFilter `json:"Filters,omitempty" name:"Filters"` +} + +type DescribeZonesRequest struct { + *tchttp.BaseRequest + + // 分页查询偏移量。默认值:0,最小值:0。 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 分页查询限制数目。默认值:1000,最大值:1000。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 查询条件过滤器,复杂类型。 + Filters []*ZoneFilter `json:"Filters,omitempty" name:"Filters"` +} + +func (r *DescribeZonesRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZonesRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Offset") + delete(f, "Limit") + delete(f, "Filters") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeZonesRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeZonesResponseParams struct { + // 符合条件的站点个数。 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 站点详细信息列表。 + Zones []*Zone `json:"Zones,omitempty" name:"Zones"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DescribeZonesResponse struct { + *tchttp.BaseResponse + Response *DescribeZonesResponseParams `json:"Response"` +} + +func (r *DescribeZonesResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeZonesResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DetailHost struct { + // 腾讯云账号ID + AppId *int64 `json:"AppId,omitempty" name:"AppId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 加速服务状态 + // process:部署中 + // online:已启动 + // offline:已关闭 + Status *string `json:"Status,omitempty" name:"Status"` + + // 域名 + Host *string `json:"Host,omitempty" name:"Host"` +} + +type DnsDataFilter struct { + // 参数名称,取值范围: + // zone:站点名 + // host:域名 + // type:dns解析类型 + // code:dns返回状态码 + // area:解析服务器所在区域 + Name *string `json:"Name,omitempty" name:"Name"` + + // 参数值 + // 当Name=area时,Value取值范围: + // 亚洲:Asia + // 欧洲:Europe + // 非洲:Africa + // 大洋洲:Oceania + // 美洲:Americas + // + // 当Name=code时,Value取值范围: + // NoError:成功的响应 + // NXDomain:只在权威域名服务器的响应消息中有效,标示请求中请求的域不存在 + // NotImp:域名服务器不支持请求的类型 + // Refused:域名服务器因为策略的原因拒绝执行请求的操作 + Value *string `json:"Value,omitempty" name:"Value"` + + // 参数值 + // 当Name=area时,Value取值范围: + // 亚洲:Asia + // 欧洲:Europe + // 非洲:Africa + // 大洋洲:Oceania + // 美洲:Americas + // + // 当Name=code时,Value取值范围: + // NoError:成功的响应 + // NXDomain:只在权威域名服务器的响应消息中有效,标示请求中请求的域不存在 + // NotImp:域名服务器不支持请求的类型 + // Refused:域名服务器因为策略的原因拒绝执行请求的操作 + Values []*string `json:"Values,omitempty" name:"Values"` +} + +type DnsRecord struct { + // 记录 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 主机记录 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录值 + Content *string `json:"Content,omitempty" name:"Content"` + + // 代理模式 + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // TTL 值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + // 注意:此字段可能返回 null,表示取不到有效值。 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` + + // 创建时间 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 域名锁 + Locked *bool `json:"Locked,omitempty" name:"Locked"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 解析状态 + // active: 生效 + // pending: 不生效 + Status *string `json:"Status,omitempty" name:"Status"` + + // CNAME 地址 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cname *string `json:"Cname,omitempty" name:"Cname"` + + // 域名是否开启了负载均衡,四层代理,安全 + // - lb 负载均衡 + // - security 安全 + // - l4 四层代理 + // 注意:此字段可能返回 null,表示取不到有效值。 + DomainStatus []*string `json:"DomainStatus,omitempty" name:"DomainStatus"` +} + +type DnsRecordFilter struct { + // 过滤字段名,支持的列表如下: + // - name: 站点名。 + // - status: 站点状态 + Name *string `json:"Name,omitempty" name:"Name"` + + // 过滤字段值 + Values []*string `json:"Values,omitempty" name:"Values"` + + // 是否启用模糊查询,仅支持过滤字段名为name。模糊查询时,Values长度最大为1 + Fuzzy *bool `json:"Fuzzy,omitempty" name:"Fuzzy"` +} + +type DnssecInfo struct { + // 标志 + Flags *int64 `json:"Flags,omitempty" name:"Flags"` + + // 加密算法 + Algorithm *string `json:"Algorithm,omitempty" name:"Algorithm"` + + // 加密类型 + KeyType *string `json:"KeyType,omitempty" name:"KeyType"` + + // 摘要类型 + DigestType *string `json:"DigestType,omitempty" name:"DigestType"` + + // 摘要算法 + DigestAlgorithm *string `json:"DigestAlgorithm,omitempty" name:"DigestAlgorithm"` + + // 摘要信息 + Digest *string `json:"Digest,omitempty" name:"Digest"` + + // DS 记录值 + DS *string `json:"DS,omitempty" name:"DS"` + + // 密钥标签 + KeyTag *int64 `json:"KeyTag,omitempty" name:"KeyTag"` + + // 公钥 + PublicKey *string `json:"PublicKey,omitempty" name:"PublicKey"` +} + +// Predefined struct for user +type DownloadL7LogsRequestParams struct { + // 起始时间(需严格按照RFC3339标准传参) + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间(需严格按照RFC3339标准传参) + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 每页展示条数 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 当前页 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点名集合 + Zones []*string `json:"Zones,omitempty" name:"Zones"` + + // 子域名集合 + Domains []*string `json:"Domains,omitempty" name:"Domains"` +} + +type DownloadL7LogsRequest struct { + *tchttp.BaseRequest + + // 起始时间(需严格按照RFC3339标准传参) + StartTime *string `json:"StartTime,omitempty" name:"StartTime"` + + // 结束时间(需严格按照RFC3339标准传参) + EndTime *string `json:"EndTime,omitempty" name:"EndTime"` + + // 每页展示条数 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 当前页 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 站点名集合 + Zones []*string `json:"Zones,omitempty" name:"Zones"` + + // 子域名集合 + Domains []*string `json:"Domains,omitempty" name:"Domains"` +} + +func (r *DownloadL7LogsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DownloadL7LogsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "StartTime") + delete(f, "EndTime") + delete(f, "PageSize") + delete(f, "PageNo") + delete(f, "Zones") + delete(f, "Domains") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DownloadL7LogsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DownloadL7LogsResponseParams struct { + // 七层离线日志data + // 注意:此字段可能返回 null,表示取不到有效值。 + Data []*L7OfflineLog `json:"Data,omitempty" name:"Data"` + + // 页面大小 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 页号 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 总页数 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type DownloadL7LogsResponse struct { + *tchttp.BaseResponse + Response *DownloadL7LogsResponseParams `json:"Response"` +} + +func (r *DownloadL7LogsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DownloadL7LogsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type FailReason struct { + // 失败原因 + Reason *string `json:"Reason,omitempty" name:"Reason"` + + // 处理失败的资源列表。 + // 该列表元素来源于输入参数中的Targets,因此格式和入参中的Targets保持一致 + Targets []*string `json:"Targets,omitempty" name:"Targets"` +} + +type Filter struct { + // 筛选维度 + Key *string `json:"Key,omitempty" name:"Key"` + + // 操作符 + Operator *string `json:"Operator,omitempty" name:"Operator"` + + // 筛选维度值 + Value []*string `json:"Value,omitempty" name:"Value"` +} + +type ForceRedirect struct { + // 访问强制跳转配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 重定向状态码,取值有: + //
  • 301:301跳转;
  • + //
  • 302:302跳转。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + RedirectStatusCode *int64 `json:"RedirectStatusCode,omitempty" name:"RedirectStatusCode"` +} + +type GeoIp struct { + // 地域ID + RegionId *int64 `json:"RegionId,omitempty" name:"RegionId"` + + // 国家名 + Country *string `json:"Country,omitempty" name:"Country"` + + // 洲 + Continent *string `json:"Continent,omitempty" name:"Continent"` + + // 国家英文名 + CountryEn *string `json:"CountryEn,omitempty" name:"CountryEn"` + + // 洲 + ContinentEn *string `json:"ContinentEn,omitempty" name:"ContinentEn"` +} + +type Header struct { + // HTTP头部 + Name *string `json:"Name,omitempty" name:"Name"` + + // HTTP头部值 + Value *string `json:"Value,omitempty" name:"Value"` +} + +type HostCertSetting struct { + // 域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Host *string `json:"Host,omitempty" name:"Host"` + + // 服务端证书配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + CertInfo []*ServerCertInfo `json:"CertInfo,omitempty" name:"CertInfo"` +} + +type Hsts struct { + // 是否开启,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // MaxAge数值。单位为秒,最大值为1天。 + // 注意:此字段可能返回 null,表示取不到有效值。 + MaxAge *int64 `json:"MaxAge,omitempty" name:"MaxAge"` + + // 是否包含子域名,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + IncludeSubDomains *string `json:"IncludeSubDomains,omitempty" name:"IncludeSubDomains"` + + // 是否开启预加载,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + Preload *string `json:"Preload,omitempty" name:"Preload"` +} + +type Https struct { + // http2 配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + Http2 *string `json:"Http2,omitempty" name:"Http2"` + + // OCSP 配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + OcspStapling *string `json:"OcspStapling,omitempty" name:"OcspStapling"` + + // Tls版本设置,取值有: + //
  • TLSv1:TLSv1版本;
  • + //
  • TLSV1.1:TLSv1.1版本;
  • + //
  • TLSV1.2:TLSv1.2版本;
  • + //
  • TLSv1.3:TLSv1.3版本。
  • 修改时必须开启连续的版本。 + // 注意:此字段可能返回 null,表示取不到有效值。 + TlsVersion []*string `json:"TlsVersion,omitempty" name:"TlsVersion"` + + // HSTS 配置。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Hsts *Hsts `json:"Hsts,omitempty" name:"Hsts"` +} + +// Predefined struct for user +type IdentifyZoneRequestParams struct { + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` +} + +type IdentifyZoneRequest struct { + *tchttp.BaseRequest + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` +} + +func (r *IdentifyZoneRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *IdentifyZoneRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Name") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "IdentifyZoneRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type IdentifyZoneResponseParams struct { + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 子域 + Subdomain *string `json:"Subdomain,omitempty" name:"Subdomain"` + + // 记录类型 + RecordType *string `json:"RecordType,omitempty" name:"RecordType"` + + // 记录值 + RecordValue *string `json:"RecordValue,omitempty" name:"RecordValue"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type IdentifyZoneResponse struct { + *tchttp.BaseResponse + Response *IdentifyZoneResponseParams `json:"Response"` +} + +func (r *IdentifyZoneResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *IdentifyZoneResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ImportDnsRecordsRequestParams struct { + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 文件内容 + File *string `json:"File,omitempty" name:"File"` +} + +type ImportDnsRecordsRequest struct { + *tchttp.BaseRequest + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 文件内容 + File *string `json:"File,omitempty" name:"File"` +} + +func (r *ImportDnsRecordsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ImportDnsRecordsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "File") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ImportDnsRecordsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ImportDnsRecordsResponseParams struct { + // 记录 ID + Ids []*string `json:"Ids,omitempty" name:"Ids"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ImportDnsRecordsResponse struct { + *tchttp.BaseResponse + Response *ImportDnsRecordsResponseParams `json:"Response"` +} + +func (r *ImportDnsRecordsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ImportDnsRecordsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type IntelligenceRule struct { + // 开关 + // 注意:此字段可能返回 null,表示取不到有效值。 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 规则详情 + // 注意:此字段可能返回 null,表示取不到有效值。 + Items []*IntelligenceRuleItem `json:"Items,omitempty" name:"Items"` +} + +type IntelligenceRuleItem struct { + // 恶意BOT + // 注意:此字段可能返回 null,表示取不到有效值。 + Label *string `json:"Label,omitempty" name:"Label"` + + // 动作 + // 注意:此字段可能返回 null,表示取不到有效值。 + Action *string `json:"Action,omitempty" name:"Action"` +} + +type IpTableConfig struct { + // 开关 + // 注意:此字段可能返回 null,表示取不到有效值。 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // [] + // 注意:此字段可能返回 null,表示取不到有效值。 + Rules []*IpTableRule `json:"Rules,omitempty" name:"Rules"` +} + +type IpTableRule struct { + // 动作: drop拦截,trans放行,monitor观察 + // 注意:此字段可能返回 null,表示取不到有效值。 + Action *string `json:"Action,omitempty" name:"Action"` + + // 根据类型匹配:ip(根据ip), area(根据区域) + // 注意:此字段可能返回 null,表示取不到有效值。 + MatchFrom *string `json:"MatchFrom,omitempty" name:"MatchFrom"` + + // 匹配内容 + // 注意:此字段可能返回 null,表示取不到有效值。 + MatchContent *string `json:"MatchContent,omitempty" name:"MatchContent"` + + // 规则id + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleID *int64 `json:"RuleID,omitempty" name:"RuleID"` + + // 更新时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` +} + +type Ipv6Access struct { + // Ipv6访问功能配置,取值有: + //
  • on:开启Ipv6访问功能;
  • + //
  • off:关闭Ipv6访问功能。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type L7OfflineLog struct { + // 日志打包开始时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + LogTime *int64 `json:"LogTime,omitempty" name:"LogTime"` + + // 子域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Domain *string `json:"Domain,omitempty" name:"Domain"` + + // 原始大小 单位byte + // 注意:此字段可能返回 null,表示取不到有效值。 + Size *int64 `json:"Size,omitempty" name:"Size"` + + // 下载地址 + // 注意:此字段可能返回 null,表示取不到有效值。 + Url *string `json:"Url,omitempty" name:"Url"` + + // 日志数据包名 + // 注意:此字段可能返回 null,表示取不到有效值。 + LogPacketName *string `json:"LogPacketName,omitempty" name:"LogPacketName"` + + // 加速区域,取值有: + //
  • mainland:中国大陆境内;
  • + //
  • overseas:全球(不含中国大陆)。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type LoadBalancing struct { + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 子域名,填写@表示根域 + Host *string `json:"Host,omitempty" name:"Host"` + + // 代理模式: + // dns_only: 仅DNS + // proxied: 开启代理 + Type *string `json:"Type,omitempty" name:"Type"` + + // 当Type=dns_only表示DNS的TTL时间 + TTL *uint64 `json:"TTL,omitempty" name:"TTL"` + + // 使用的源站组ID + OriginId []*string `json:"OriginId,omitempty" name:"OriginId"` + + // 使用的源站信息 + Origin []*OriginGroup `json:"Origin,omitempty" name:"Origin"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 调度域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cname *string `json:"Cname,omitempty" name:"Cname"` +} + +type ManagedRule struct { + // 规则id + RuleId *int64 `json:"RuleId,omitempty" name:"RuleId"` + + // 规则描述 + Description *string `json:"Description,omitempty" name:"Description"` + + // 规则类型名 + RuleTypeName *string `json:"RuleTypeName,omitempty" name:"RuleTypeName"` + + // 策略规则防护等级 + RuleLevelDesc *string `json:"RuleLevelDesc,omitempty" name:"RuleLevelDesc"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 规则当前状态 block, allow + Status *string `json:"Status,omitempty" name:"Status"` + + // 规则标签 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleTags []*string `json:"RuleTags,omitempty" name:"RuleTags"` + + // 规则类型详细描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleTypeDesc *string `json:"RuleTypeDesc,omitempty" name:"RuleTypeDesc"` + + // 规则类型id + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleTypeId *int64 `json:"RuleTypeId,omitempty" name:"RuleTypeId"` +} + +type MaxAge struct { + // 是否遵循源站,取值有: + //
  • on:遵循源站,忽略MaxAge 时间设置;
  • + //
  • off:不遵循源站,使用MaxAge 时间设置。
  • + FollowOrigin *string `json:"FollowOrigin,omitempty" name:"FollowOrigin"` + + // MaxAge 时间设置,单位秒,最大365天。 + // 注意:时间为0,即不缓存。 + MaxAgeTime *int64 `json:"MaxAgeTime,omitempty" name:"MaxAgeTime"` +} + +// Predefined struct for user +type ModifyApplicationProxyRequestParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 当ProxyType=hostname时,表示域名或子域名; + // 当ProxyType=instance时,表示代理名称。 + ProxyName *string `json:"ProxyName,omitempty" name:"ProxyName"` + + // 参数已经废弃。 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 参数已经废弃。 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` + + // 会话保持时间,不填写保持原有配置。取值范围:30-3600,单位:秒。 + SessionPersistTime *uint64 `json:"SessionPersistTime,omitempty" name:"SessionPersistTime"` + + // 四层代理模式,取值有: + //
  • hostname:表示子域名模式;
  • + //
  • instance:表示实例模式。
  • 不填写保持原有配置。 + ProxyType *string `json:"ProxyType,omitempty" name:"ProxyType"` + + // Ipv6访问配置,不填写保持原有配置。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` +} + +type ModifyApplicationProxyRequest struct { + *tchttp.BaseRequest + + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 当ProxyType=hostname时,表示域名或子域名; + // 当ProxyType=instance时,表示代理名称。 + ProxyName *string `json:"ProxyName,omitempty" name:"ProxyName"` + + // 参数已经废弃。 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 参数已经废弃。 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` + + // 会话保持时间,不填写保持原有配置。取值范围:30-3600,单位:秒。 + SessionPersistTime *uint64 `json:"SessionPersistTime,omitempty" name:"SessionPersistTime"` + + // 四层代理模式,取值有: + //
  • hostname:表示子域名模式;
  • + //
  • instance:表示实例模式。
  • 不填写保持原有配置。 + ProxyType *string `json:"ProxyType,omitempty" name:"ProxyType"` + + // Ipv6访问配置,不填写保持原有配置。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` +} + +func (r *ModifyApplicationProxyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "ProxyName") + delete(f, "ForwardClientIp") + delete(f, "SessionPersist") + delete(f, "SessionPersistTime") + delete(f, "ProxyType") + delete(f, "Ipv6") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyApplicationProxyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyResponseParams struct { + // 代理ID。 + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyApplicationProxyResponse struct { + *tchttp.BaseResponse + Response *ModifyApplicationProxyResponseParams `json:"Response"` +} + +func (r *ModifyApplicationProxyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyRuleRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 协议,取值为TCP或者UDP + Proto *string `json:"Proto,omitempty" name:"Proto"` + + // 端口,支持格式: + // 80:80端口 + // 81-90:81至90端口 + Port []*string `json:"Port,omitempty" name:"Port"` + + // 源站类型,取值: + // custom:手动添加 + // origins:源站组 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 源站信息: + // 当OriginType=custom时,表示一个或多个源站,如: + // OriginValue=["8.8.8.8:80","9.9.9.9:80"] + // OriginValue=["test.com:80"] + // + // 当OriginType=origins时,包含一个元素,表示源站组ID,如: + // OriginValue=["origin-xxx"] + OriginValue []*string `json:"OriginValue,omitempty" name:"OriginValue"` + + // 传递客户端IP,当Proto=TCP时,取值: + // TOA:TOA + // PPV1: Proxy Protocol传递,协议版本V1 + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + // 当Proto=UDP时,取值: + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 是否开启会话保持 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` +} + +type ModifyApplicationProxyRuleRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 协议,取值为TCP或者UDP + Proto *string `json:"Proto,omitempty" name:"Proto"` + + // 端口,支持格式: + // 80:80端口 + // 81-90:81至90端口 + Port []*string `json:"Port,omitempty" name:"Port"` + + // 源站类型,取值: + // custom:手动添加 + // origins:源站组 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 源站信息: + // 当OriginType=custom时,表示一个或多个源站,如: + // OriginValue=["8.8.8.8:80","9.9.9.9:80"] + // OriginValue=["test.com:80"] + // + // 当OriginType=origins时,包含一个元素,表示源站组ID,如: + // OriginValue=["origin-xxx"] + OriginValue []*string `json:"OriginValue,omitempty" name:"OriginValue"` + + // 传递客户端IP,当Proto=TCP时,取值: + // TOA:TOA + // PPV1: Proxy Protocol传递,协议版本V1 + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + // 当Proto=UDP时,取值: + // PPV2: Proxy Protocol传递,协议版本V2 + // OFF:不传递 + ForwardClientIp *string `json:"ForwardClientIp,omitempty" name:"ForwardClientIp"` + + // 是否开启会话保持 + SessionPersist *bool `json:"SessionPersist,omitempty" name:"SessionPersist"` +} + +func (r *ModifyApplicationProxyRuleRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyRuleRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "RuleId") + delete(f, "Proto") + delete(f, "Port") + delete(f, "OriginType") + delete(f, "OriginValue") + delete(f, "ForwardClientIp") + delete(f, "SessionPersist") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyApplicationProxyRuleRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyRuleResponseParams struct { + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyApplicationProxyRuleResponse struct { + *tchttp.BaseResponse + Response *ModifyApplicationProxyRuleResponseParams `json:"Response"` +} + +func (r *ModifyApplicationProxyRuleResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyRuleResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyRuleStatusRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 状态 + // offline: 停用 + // online: 启用 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyApplicationProxyRuleStatusRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 状态 + // offline: 停用 + // online: 启用 + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyApplicationProxyRuleStatusRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyRuleStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "RuleId") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyApplicationProxyRuleStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyRuleStatusResponseParams struct { + // 规则ID + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyApplicationProxyRuleStatusResponse struct { + *tchttp.BaseResponse + Response *ModifyApplicationProxyRuleStatusResponseParams `json:"Response"` +} + +func (r *ModifyApplicationProxyRuleStatusResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyRuleStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyStatusRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 状态 + // offline: 停用 + // online: 启用 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyApplicationProxyStatusRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 状态 + // offline: 停用 + // online: 启用 + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyApplicationProxyStatusRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "ProxyId") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyApplicationProxyStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyApplicationProxyStatusResponseParams struct { + // 代理ID + ProxyId *string `json:"ProxyId,omitempty" name:"ProxyId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyApplicationProxyStatusResponse struct { + *tchttp.BaseResponse + Response *ModifyApplicationProxyStatusResponseParams `json:"Response"` +} + +func (r *ModifyApplicationProxyStatusResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyApplicationProxyStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDDoSPolicyHostRequestParams struct { + // 站点id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名 + Host *string `json:"Host,omitempty" name:"Host"` + + // 加速开关 on-开启加速;off-关闭加速(AccelerateType:on,SecurityType:on,安全加速,未开防护增强;AccelerateType:off,SecurityType:on,安全加速,开启防护增强;AccelerateType:on,SecurityType:off,内容加速,未开防护增强) + AccelerateType *string `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 策略id + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 安全开关 on-开启安全;off-关闭安全(AccelerateType:on,SecurityType:on,安全加速,未开防护增强;AccelerateType:off,SecurityType:on,安全加速,开启防护增强;AccelerateType:on,SecurityType:off,内容加速,未开防护增强) + SecurityType *string `json:"SecurityType,omitempty" name:"SecurityType"` +} + +type ModifyDDoSPolicyHostRequest struct { + *tchttp.BaseRequest + + // 站点id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名 + Host *string `json:"Host,omitempty" name:"Host"` + + // 加速开关 on-开启加速;off-关闭加速(AccelerateType:on,SecurityType:on,安全加速,未开防护增强;AccelerateType:off,SecurityType:on,安全加速,开启防护增强;AccelerateType:on,SecurityType:off,内容加速,未开防护增强) + AccelerateType *string `json:"AccelerateType,omitempty" name:"AccelerateType"` + + // 策略id + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 安全开关 on-开启安全;off-关闭安全(AccelerateType:on,SecurityType:on,安全加速,未开防护增强;AccelerateType:off,SecurityType:on,安全加速,开启防护增强;AccelerateType:on,SecurityType:off,内容加速,未开防护增强) + SecurityType *string `json:"SecurityType,omitempty" name:"SecurityType"` +} + +func (r *ModifyDDoSPolicyHostRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDDoSPolicyHostRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Host") + delete(f, "AccelerateType") + delete(f, "PolicyId") + delete(f, "SecurityType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyDDoSPolicyHostRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDDoSPolicyHostResponseParams struct { + // 修改成功的host + Host *string `json:"Host,omitempty" name:"Host"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyDDoSPolicyHostResponse struct { + *tchttp.BaseResponse + Response *ModifyDDoSPolicyHostResponseParams `json:"Response"` +} + +func (r *ModifyDDoSPolicyHostResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDDoSPolicyHostResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDDoSPolicyRequestParams struct { + // 策略id。 + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 站点id。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // DDoS防护配置详情。 + DdosRule *DdosRule `json:"DdosRule,omitempty" name:"DdosRule"` +} + +type ModifyDDoSPolicyRequest struct { + *tchttp.BaseRequest + + // 策略id。 + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 站点id。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // DDoS防护配置详情。 + DdosRule *DdosRule `json:"DdosRule,omitempty" name:"DdosRule"` +} + +func (r *ModifyDDoSPolicyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDDoSPolicyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "PolicyId") + delete(f, "ZoneId") + delete(f, "DdosRule") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyDDoSPolicyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDDoSPolicyResponseParams struct { + // 策略id。 + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyDDoSPolicyResponse struct { + *tchttp.BaseResponse + Response *ModifyDDoSPolicyResponseParams `json:"Response"` +} + +func (r *ModifyDDoSPolicyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDDoSPolicyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDefaultCertificateRequestParams struct { + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 默认证书ID + CertId *string `json:"CertId,omitempty" name:"CertId"` + + // 证书状态 + // deployed: 部署证书 + // disabled:禁用证书 + // 失败状态下重新deployed即可重试失败 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyDefaultCertificateRequest struct { + *tchttp.BaseRequest + + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 默认证书ID + CertId *string `json:"CertId,omitempty" name:"CertId"` + + // 证书状态 + // deployed: 部署证书 + // disabled:禁用证书 + // 失败状态下重新deployed即可重试失败 + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyDefaultCertificateRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDefaultCertificateRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "CertId") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyDefaultCertificateRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDefaultCertificateResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyDefaultCertificateResponse struct { + *tchttp.BaseResponse + Response *ModifyDefaultCertificateResponseParams `json:"Response"` +} + +func (r *ModifyDefaultCertificateResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDefaultCertificateResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDnsRecordRequestParams struct { + // 记录 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录内容 + Content *string `json:"Content,omitempty" name:"Content"` + + // 生存时间值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` + + // 代理模式 + Mode *string `json:"Mode,omitempty" name:"Mode"` +} + +type ModifyDnsRecordRequest struct { + *tchttp.BaseRequest + + // 记录 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录内容 + Content *string `json:"Content,omitempty" name:"Content"` + + // 生存时间值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` + + // 代理模式 + Mode *string `json:"Mode,omitempty" name:"Mode"` +} + +func (r *ModifyDnsRecordRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDnsRecordRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + delete(f, "ZoneId") + delete(f, "Type") + delete(f, "Name") + delete(f, "Content") + delete(f, "Ttl") + delete(f, "Priority") + delete(f, "Mode") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyDnsRecordRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDnsRecordResponseParams struct { + // 记录 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 记录类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 记录内容 + Content *string `json:"Content,omitempty" name:"Content"` + + // 生存时间值 + Ttl *int64 `json:"Ttl,omitempty" name:"Ttl"` + + // 优先级 + Priority *int64 `json:"Priority,omitempty" name:"Priority"` + + // 代理模式 + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 解析状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // CNAME 地址 + // 注意:此字段可能返回 null,表示取不到有效值。 + Cname *string `json:"Cname,omitempty" name:"Cname"` + + // 锁定状态 + Locked *bool `json:"Locked,omitempty" name:"Locked"` + + // 创建时间 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyDnsRecordResponse struct { + *tchttp.BaseResponse + Response *ModifyDnsRecordResponseParams `json:"Response"` +} + +func (r *ModifyDnsRecordResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDnsRecordResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDnssecRequestParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // DNSSEC 状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyDnssecRequest struct { + *tchttp.BaseRequest + + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // DNSSEC 状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyDnssecRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDnssecRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyDnssecRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyDnssecResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // DNSSEC 状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` + + // DNSSEC 相关信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + Dnssec *DnssecInfo `json:"Dnssec,omitempty" name:"Dnssec"` + + // 修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyDnssecResponse struct { + *tchttp.BaseResponse + Response *ModifyDnssecResponseParams `json:"Response"` +} + +func (r *ModifyDnssecResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyDnssecResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyHostsCertificateRequestParams struct { + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 本次变更的域名 + Hosts []*string `json:"Hosts,omitempty" name:"Hosts"` + + // 证书信息, 只需要传入 CertId 即可, 如果为空, 则使用默认证书 + CertInfo []*ServerCertInfo `json:"CertInfo,omitempty" name:"CertInfo"` +} + +type ModifyHostsCertificateRequest struct { + *tchttp.BaseRequest + + // Zone ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 本次变更的域名 + Hosts []*string `json:"Hosts,omitempty" name:"Hosts"` + + // 证书信息, 只需要传入 CertId 即可, 如果为空, 则使用默认证书 + CertInfo []*ServerCertInfo `json:"CertInfo,omitempty" name:"CertInfo"` +} + +func (r *ModifyHostsCertificateRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyHostsCertificateRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Hosts") + delete(f, "CertInfo") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyHostsCertificateRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyHostsCertificateResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyHostsCertificateResponse struct { + *tchttp.BaseResponse + Response *ModifyHostsCertificateResponseParams `json:"Response"` +} + +func (r *ModifyHostsCertificateResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyHostsCertificateResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyLoadBalancingRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 代理模式: + // dns_only: 仅DNS + // proxied: 开启代理 + Type *string `json:"Type,omitempty" name:"Type"` + + // 使用的源站组ID + OriginId []*string `json:"OriginId,omitempty" name:"OriginId"` + + // 当Type=dns_only表示DNS的TTL时间 + TTL *uint64 `json:"TTL,omitempty" name:"TTL"` +} + +type ModifyLoadBalancingRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 代理模式: + // dns_only: 仅DNS + // proxied: 开启代理 + Type *string `json:"Type,omitempty" name:"Type"` + + // 使用的源站组ID + OriginId []*string `json:"OriginId,omitempty" name:"OriginId"` + + // 当Type=dns_only表示DNS的TTL时间 + TTL *uint64 `json:"TTL,omitempty" name:"TTL"` +} + +func (r *ModifyLoadBalancingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyLoadBalancingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "LoadBalancingId") + delete(f, "Type") + delete(f, "OriginId") + delete(f, "TTL") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyLoadBalancingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyLoadBalancingResponseParams struct { + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyLoadBalancingResponse struct { + *tchttp.BaseResponse + Response *ModifyLoadBalancingResponseParams `json:"Response"` +} + +func (r *ModifyLoadBalancingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyLoadBalancingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyLoadBalancingStatusRequestParams struct { + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 状态 + // online: 启用 + // offline: 停用 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyLoadBalancingStatusRequest struct { + *tchttp.BaseRequest + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 状态 + // online: 启用 + // offline: 停用 + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyLoadBalancingStatusRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyLoadBalancingStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "LoadBalancingId") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyLoadBalancingStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyLoadBalancingStatusResponseParams struct { + // 负载均衡ID + LoadBalancingId *string `json:"LoadBalancingId,omitempty" name:"LoadBalancingId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyLoadBalancingStatusResponse struct { + *tchttp.BaseResponse + Response *ModifyLoadBalancingStatusResponseParams `json:"Response"` +} + +func (r *ModifyLoadBalancingStatusResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyLoadBalancingStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyOriginGroupRequestParams struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 源站组名称 + OriginName *string `json:"OriginName,omitempty" name:"OriginName"` + + // 配置类型,当OriginType=self 时,需要填写: + // area: 按区域配置 + // weight: 按权重配置 + // 当OriginType=third_party/cos 时,不需要填写 + Type *string `json:"Type,omitempty" name:"Type"` + + // 源站记录 + Record []*OriginRecord `json:"Record,omitempty" name:"Record"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 源站类型 + // self:自有源站 + // third_party:第三方源站 + // cos:腾讯云COS源站 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` +} + +type ModifyOriginGroupRequest struct { + *tchttp.BaseRequest + + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 源站组名称 + OriginName *string `json:"OriginName,omitempty" name:"OriginName"` + + // 配置类型,当OriginType=self 时,需要填写: + // area: 按区域配置 + // weight: 按权重配置 + // 当OriginType=third_party/cos 时,不需要填写 + Type *string `json:"Type,omitempty" name:"Type"` + + // 源站记录 + Record []*OriginRecord `json:"Record,omitempty" name:"Record"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 源站类型 + // self:自有源站 + // third_party:第三方源站 + // cos:腾讯云COS源站 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` +} + +func (r *ModifyOriginGroupRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyOriginGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "OriginId") + delete(f, "OriginName") + delete(f, "Type") + delete(f, "Record") + delete(f, "ZoneId") + delete(f, "OriginType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyOriginGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyOriginGroupResponseParams struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyOriginGroupResponse struct { + *tchttp.BaseResponse + Response *ModifyOriginGroupResponseParams `json:"Response"` +} + +func (r *ModifyOriginGroupResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyOriginGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyRulePriorityRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则 ID 的顺序,多条规则执行顺序依次往下。 + RuleIds []*string `json:"RuleIds,omitempty" name:"RuleIds"` +} + +type ModifyRulePriorityRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则 ID 的顺序,多条规则执行顺序依次往下。 + RuleIds []*string `json:"RuleIds,omitempty" name:"RuleIds"` +} + +func (r *ModifyRulePriorityRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyRulePriorityRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "RuleIds") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyRulePriorityRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyRulePriorityResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyRulePriorityResponse struct { + *tchttp.BaseResponse + Response *ModifyRulePriorityResponseParams `json:"Response"` +} + +func (r *ModifyRulePriorityResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyRulePriorityResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyRuleRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则名称,字符串名称长度 1~255。 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 规则内容。 + Rules []*RuleItem `json:"Rules,omitempty" name:"Rules"` + + // 规则 ID。 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 规则状态,取值有: + //
  • enable: 启用;
  • + //
  • disable: 未启用。
  • + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyRuleRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 规则名称,字符串名称长度 1~255。 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 规则内容。 + Rules []*RuleItem `json:"Rules,omitempty" name:"Rules"` + + // 规则 ID。 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 规则状态,取值有: + //
  • enable: 启用;
  • + //
  • disable: 未启用。
  • + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyRuleRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyRuleRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "RuleName") + delete(f, "Rules") + delete(f, "RuleId") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyRuleRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyRuleResponseParams struct { + // 规则 ID。 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyRuleResponse struct { + *tchttp.BaseResponse + Response *ModifyRuleResponseParams `json:"Response"` +} + +func (r *ModifyRuleResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyRuleResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifySecurityPolicyRequestParams struct { + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 安全配置 + Config *SecurityConfig `json:"Config,omitempty" name:"Config"` +} + +type ModifySecurityPolicyRequest struct { + *tchttp.BaseRequest + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名/应用名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 安全配置 + Config *SecurityConfig `json:"Config,omitempty" name:"Config"` +} + +func (r *ModifySecurityPolicyRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifySecurityPolicyRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Entity") + delete(f, "Config") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifySecurityPolicyRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifySecurityPolicyResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifySecurityPolicyResponse struct { + *tchttp.BaseResponse + Response *ModifySecurityPolicyResponseParams `json:"Response"` +} + +func (r *ModifySecurityPolicyResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifySecurityPolicyResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneCnameSpeedUpRequestParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // CNAME 加速状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ModifyZoneCnameSpeedUpRequest struct { + *tchttp.BaseRequest + + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // CNAME 加速状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` +} + +func (r *ModifyZoneCnameSpeedUpRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneCnameSpeedUpRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + delete(f, "Status") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyZoneCnameSpeedUpRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneCnameSpeedUpResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // CNAME 加速状态 + // - enabled 开启 + // - disabled 关闭 + Status *string `json:"Status,omitempty" name:"Status"` + + // 更新时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyZoneCnameSpeedUpResponse struct { + *tchttp.BaseResponse + Response *ModifyZoneCnameSpeedUpResponseParams `json:"Response"` +} + +func (r *ModifyZoneCnameSpeedUpResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneCnameSpeedUpResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneRequestParams struct { + // 站点 ID,用于唯一标识站点信息 + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点接入方式 + // - full NS 接入 + // - partial CNAME 接入 + Type *string `json:"Type,omitempty" name:"Type"` + + // 自定义站点信息 + VanityNameServers *VanityNameServers `json:"VanityNameServers,omitempty" name:"VanityNameServers"` +} + +type ModifyZoneRequest struct { + *tchttp.BaseRequest + + // 站点 ID,用于唯一标识站点信息 + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点接入方式 + // - full NS 接入 + // - partial CNAME 接入 + Type *string `json:"Type,omitempty" name:"Type"` + + // 自定义站点信息 + VanityNameServers *VanityNameServers `json:"VanityNameServers,omitempty" name:"VanityNameServers"` +} + +func (r *ModifyZoneRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + delete(f, "Type") + delete(f, "VanityNameServers") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyZoneRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 站点当前使用的 NS + OriginalNameServers []*string `json:"OriginalNameServers,omitempty" name:"OriginalNameServers"` + + // 站点状态 + // - pending 未接入 NS + // - active 已接入 NS + // - moved NS 已切走 + Status *string `json:"Status,omitempty" name:"Status"` + + // 站点接入方式 + // - full NS 接入 + // - partial CNAME 接入 + Type *string `json:"Type,omitempty" name:"Type"` + + // 腾讯云分配的 NS 列表 + NameServers []*string `json:"NameServers,omitempty" name:"NameServers"` + + // 创建时间 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 修改时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // cname 接入状态 + // - finished 站点验证完成 + // - pending 站点验证中 + // 注意:此字段可能返回 null,表示取不到有效值。 + CnameStatus *string `json:"CnameStatus,omitempty" name:"CnameStatus"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyZoneResponse struct { + *tchttp.BaseResponse + Response *ModifyZoneResponseParams `json:"Response"` +} + +func (r *ModifyZoneResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneSettingRequestParams struct { + // 待变更的站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 缓存过期时间配置。 + // 不填写表示保持原有配置。 + Cache *CacheConfig `json:"Cache,omitempty" name:"Cache"` + + // 节点缓存键配置。 + // 不填写表示保持原有配置。 + CacheKey *CacheKey `json:"CacheKey,omitempty" name:"CacheKey"` + + // 浏览器缓存配置。 + // 不填写表示保持原有配置。 + MaxAge *MaxAge `json:"MaxAge,omitempty" name:"MaxAge"` + + // 离线缓存配置。 + // 不填写表示保持原有配置。 + OfflineCache *OfflineCache `json:"OfflineCache,omitempty" name:"OfflineCache"` + + // Quic访问配置。 + // 不填写表示保持原有配置。 + Quic *Quic `json:"Quic,omitempty" name:"Quic"` + + // Post请求传输配置。 + // 不填写表示保持原有配置。 + PostMaxSize *PostMaxSize `json:"PostMaxSize,omitempty" name:"PostMaxSize"` + + // 智能压缩配置。 + // 不填写表示保持原有配置。 + Compression *Compression `json:"Compression,omitempty" name:"Compression"` + + // Http2回源配置。 + // 不填写表示保持原有配置。 + UpstreamHttp2 *UpstreamHttp2 `json:"UpstreamHttp2,omitempty" name:"UpstreamHttp2"` + + // 访问协议强制Https跳转配置。 + // 不填写表示保持原有配置。 + ForceRedirect *ForceRedirect `json:"ForceRedirect,omitempty" name:"ForceRedirect"` + + // Https加速配置。 + // 不填写表示保持原有配置。 + Https *Https `json:"Https,omitempty" name:"Https"` + + // 源站配置。 + // 不填写表示保持原有配置。 + Origin *Origin `json:"Origin,omitempty" name:"Origin"` + + // 智能加速配置。 + // 不填写表示保持原有配置。 + SmartRouting *SmartRouting `json:"SmartRouting,omitempty" name:"SmartRouting"` + + // WebSocket配置。 + // 不填写表示保持原有配置。 + WebSocket *WebSocket `json:"WebSocket,omitempty" name:"WebSocket"` + + // 客户端IP回源请求头配置。 + // 不填写表示保持原有配置。 + ClientIpHeader *ClientIp `json:"ClientIpHeader,omitempty" name:"ClientIpHeader"` + + // 缓存预刷新配置。 + // 不填写表示保持原有配置。 + CachePrefresh *CachePrefresh `json:"CachePrefresh,omitempty" name:"CachePrefresh"` + + // Ipv6访问配置。 + // 不填写表示保持原有配置。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` +} + +type ModifyZoneSettingRequest struct { + *tchttp.BaseRequest + + // 待变更的站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 缓存过期时间配置。 + // 不填写表示保持原有配置。 + Cache *CacheConfig `json:"Cache,omitempty" name:"Cache"` + + // 节点缓存键配置。 + // 不填写表示保持原有配置。 + CacheKey *CacheKey `json:"CacheKey,omitempty" name:"CacheKey"` + + // 浏览器缓存配置。 + // 不填写表示保持原有配置。 + MaxAge *MaxAge `json:"MaxAge,omitempty" name:"MaxAge"` + + // 离线缓存配置。 + // 不填写表示保持原有配置。 + OfflineCache *OfflineCache `json:"OfflineCache,omitempty" name:"OfflineCache"` + + // Quic访问配置。 + // 不填写表示保持原有配置。 + Quic *Quic `json:"Quic,omitempty" name:"Quic"` + + // Post请求传输配置。 + // 不填写表示保持原有配置。 + PostMaxSize *PostMaxSize `json:"PostMaxSize,omitempty" name:"PostMaxSize"` + + // 智能压缩配置。 + // 不填写表示保持原有配置。 + Compression *Compression `json:"Compression,omitempty" name:"Compression"` + + // Http2回源配置。 + // 不填写表示保持原有配置。 + UpstreamHttp2 *UpstreamHttp2 `json:"UpstreamHttp2,omitempty" name:"UpstreamHttp2"` + + // 访问协议强制Https跳转配置。 + // 不填写表示保持原有配置。 + ForceRedirect *ForceRedirect `json:"ForceRedirect,omitempty" name:"ForceRedirect"` + + // Https加速配置。 + // 不填写表示保持原有配置。 + Https *Https `json:"Https,omitempty" name:"Https"` + + // 源站配置。 + // 不填写表示保持原有配置。 + Origin *Origin `json:"Origin,omitempty" name:"Origin"` + + // 智能加速配置。 + // 不填写表示保持原有配置。 + SmartRouting *SmartRouting `json:"SmartRouting,omitempty" name:"SmartRouting"` + + // WebSocket配置。 + // 不填写表示保持原有配置。 + WebSocket *WebSocket `json:"WebSocket,omitempty" name:"WebSocket"` + + // 客户端IP回源请求头配置。 + // 不填写表示保持原有配置。 + ClientIpHeader *ClientIp `json:"ClientIpHeader,omitempty" name:"ClientIpHeader"` + + // 缓存预刷新配置。 + // 不填写表示保持原有配置。 + CachePrefresh *CachePrefresh `json:"CachePrefresh,omitempty" name:"CachePrefresh"` + + // Ipv6访问配置。 + // 不填写表示保持原有配置。 + Ipv6 *Ipv6Access `json:"Ipv6,omitempty" name:"Ipv6"` +} + +func (r *ModifyZoneSettingRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneSettingRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + delete(f, "Cache") + delete(f, "CacheKey") + delete(f, "MaxAge") + delete(f, "OfflineCache") + delete(f, "Quic") + delete(f, "PostMaxSize") + delete(f, "Compression") + delete(f, "UpstreamHttp2") + delete(f, "ForceRedirect") + delete(f, "Https") + delete(f, "Origin") + delete(f, "SmartRouting") + delete(f, "WebSocket") + delete(f, "ClientIpHeader") + delete(f, "CachePrefresh") + delete(f, "Ipv6") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyZoneSettingRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneSettingResponseParams struct { + // 站点ID。 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyZoneSettingResponse struct { + *tchttp.BaseResponse + Response *ModifyZoneSettingResponseParams `json:"Response"` +} + +func (r *ModifyZoneSettingResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneSettingResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneStatusRequestParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点状态 + // - false 开启站点 + // - true 关闭站点 + Paused *bool `json:"Paused,omitempty" name:"Paused"` +} + +type ModifyZoneStatusRequest struct { + *tchttp.BaseRequest + + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点状态 + // - false 开启站点 + // - true 关闭站点 + Paused *bool `json:"Paused,omitempty" name:"Paused"` +} + +func (r *ModifyZoneStatusRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneStatusRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Id") + delete(f, "Paused") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyZoneStatusRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyZoneStatusResponseParams struct { + // 站点 ID + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 站点状态 + // - false 开启站点 + // - true 关闭站点 + Paused *bool `json:"Paused,omitempty" name:"Paused"` + + // 更新时间 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ModifyZoneStatusResponse struct { + *tchttp.BaseResponse + Response *ModifyZoneStatusResponseParams `json:"Response"` +} + +func (r *ModifyZoneStatusResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyZoneStatusResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type OfflineCache struct { + // 离线缓存是否开启,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type Origin struct { + // 主源站列表。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Origins []*string `json:"Origins,omitempty" name:"Origins"` + + // 备源站列表。 + // 注意:此字段可能返回 null,表示取不到有效值。 + BackupOrigins []*string `json:"BackupOrigins,omitempty" name:"BackupOrigins"` + + // 回源协议配置,取值有: + //
  • http:强制 http 回源;
  • + //
  • follow:协议跟随回源;
  • + //
  • https:强制 https 回源,https 回源时仅支持源站 443 端口。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + OriginPullProtocol *string `json:"OriginPullProtocol,omitempty" name:"OriginPullProtocol"` + + // OriginType 为对象存储(COS)时,可以指定是否允许访问私有 bucket。 + // 注意:此字段可能返回 null,表示取不到有效值。 + CosPrivateAccess *string `json:"CosPrivateAccess,omitempty" name:"CosPrivateAccess"` +} + +type OriginCheckOriginStatus struct { + // healthy: 健康,unhealthy: 不健康,process: 探测中 + Status *string `json:"Status,omitempty" name:"Status"` + + // host列表,源站组不健康时存在值 + // 注意:此字段可能返回 null,表示取不到有效值。 + Host []*string `json:"Host,omitempty" name:"Host"` +} + +type OriginFilter struct { + // 要过滤的字段,支持:name + Name *string `json:"Name,omitempty" name:"Name"` + + // 要过滤的值 + Value *string `json:"Value,omitempty" name:"Value"` +} + +type OriginGroup struct { + // 源站组ID + OriginId *string `json:"OriginId,omitempty" name:"OriginId"` + + // 源站组名称 + OriginName *string `json:"OriginName,omitempty" name:"OriginName"` + + // 源站组配置类型 + // area:表示按照Record记录中的Area字段进行按客户端IP所在区域回源。 + // weight:表示按照Record记录中的Weight字段进行按权重回源。 + Type *string `json:"Type,omitempty" name:"Type"` + + // 记录 + Record []*OriginRecord `json:"Record,omitempty" name:"Record"` + + // 更新时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` + + // 站点ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 站点名称 + ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"` + + // 源站类型 + // 注意:此字段可能返回 null,表示取不到有效值。 + OriginType *string `json:"OriginType,omitempty" name:"OriginType"` + + // 当前源站组是否被四层代理使用。 + // 注意:此字段可能返回 null,表示取不到有效值。 + ApplicationProxyUsed *bool `json:"ApplicationProxyUsed,omitempty" name:"ApplicationProxyUsed"` + + // 当前源站组是否被负载均衡使用。 + // 注意:此字段可能返回 null,表示取不到有效值。 + LoadBalancingUsed *bool `json:"LoadBalancingUsed,omitempty" name:"LoadBalancingUsed"` + + // 源站状态信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *OriginCheckOriginStatus `json:"Status,omitempty" name:"Status"` + + // 使用当前源站组的负载均衡的类型: + // none:未被使用 + // dns_only:被仅DNS类型负载均衡使用 + // proxied:被代理加速类型负载均衡使用 + // both:同时被仅DNS和代理加速类型负载均衡使用 + // 注意:此字段可能返回 null,表示取不到有效值。 + LoadBalancingUsedType *string `json:"LoadBalancingUsedType,omitempty" name:"LoadBalancingUsedType"` +} + +type OriginRecord struct { + // 记录值 + Record *string `json:"Record,omitempty" name:"Record"` + + // 当源站配置类型Type=area时,表示区域 + // 为空表示默认区域 + Area []*string `json:"Area,omitempty" name:"Area"` + + // 当源站配置类型Type=weight时,表示权重 + // 取值范围为[1-100] + // 源站组内多个源站权重总和应为100。 + // 当源站配置类型Type=proto,表示权重 + // 取值范围为[1-100] + // 源站组内Proto相同的多个源站权重总和应为100。 + Weight *uint64 `json:"Weight,omitempty" name:"Weight"` + + // 端口 + Port *uint64 `json:"Port,omitempty" name:"Port"` + + // 记录ID + RecordId *string `json:"RecordId,omitempty" name:"RecordId"` + + // 是否私有鉴权 + // 当源站类型OriginType=third_part时有效 + // 注意:此字段可能返回 null,表示取不到有效值。 + Private *bool `json:"Private,omitempty" name:"Private"` + + // 私有鉴权参数 + // 当源站类型Private=true时有效 + // 注意:此字段可能返回 null,表示取不到有效值。 + PrivateParameter []*OriginRecordPrivateParameter `json:"PrivateParameter,omitempty" name:"PrivateParameter"` + + // 当源站配置类型Type=proto时,表示客户端请求协议,取值:http/https + // 注意:此字段可能返回 null,表示取不到有效值。 + Proto *string `json:"Proto,omitempty" name:"Proto"` +} + +type OriginRecordPrivateParameter struct { + // 私有鉴权参数名称: + // "AccessKeyId":Access Key ID + // "SecretAccessKey":Secret Access Key + Name *string `json:"Name,omitempty" name:"Name"` + + // 私有鉴权参数数值 + Value *string `json:"Value,omitempty" name:"Value"` +} + +type PlanInfo struct { + // 结算货币类型,取值有: + //
  • CNY :人民币结算;
  • + //
  • USD :美元结算。
  • + Currency *string `json:"Currency,omitempty" name:"Currency"` + + // 套餐所含流量(单位:字节) + Flux *uint64 `json:"Flux,omitempty" name:"Flux"` + + // 结算周期,取值有: + //
  • y :按年结算;
  • + //
  • m :按月结算;
  • + //
  • h :按小时结算;
  • + //
  • M :按分钟结算;
  • + //
  • s :按秒结算。
  • + Frequency *string `json:"Frequency,omitempty" name:"Frequency"` + + // 套餐类型,取值有: + //
  • sta :全球内容分发网络(不包括中国大陆)标准版套餐;
  • + //
  • sta_with_bot :全球内容分发网络(不包括中国大陆)标准版套餐附带bot管理;
  • + //
  • sta_cm :中国大陆内容分发网络标准版套餐;
  • + //
  • sta_cm_with_bot :中国大陆内容分发网络标准版套餐附带bot管理;
  • + //
  • ent :全球内容分发网络(不包括中国大陆)企业版套餐;
  • + //
  • ent_with_bot : 全球内容分发网络(不包括中国大陆)企业版套餐附带bot管理;
  • + //
  • ent_cm :中国大陆内容分发网络企业版套餐;
  • + //
  • ent_cm_with_bot :中国大陆内容分发网络企业版套餐附带bot管理。
  • + PlanType *string `json:"PlanType,omitempty" name:"PlanType"` + + // 套餐价格(单位:分) + Price *float64 `json:"Price,omitempty" name:"Price"` + + // 套餐所含请求次数(单位:字节) + Request *uint64 `json:"Request,omitempty" name:"Request"` + + // 套餐所能绑定的站点个数。 + SiteNumber *uint64 `json:"SiteNumber,omitempty" name:"SiteNumber"` +} + +type PortraitManagedRuleDetail struct { + // 规则唯一id + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleId *int64 `json:"RuleId,omitempty" name:"RuleId"` + + // 规则的描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + Description *string `json:"Description,omitempty" name:"Description"` + + // 规则所属类型的名字, botdb(用户画像) + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleTypeName *string `json:"RuleTypeName,omitempty" name:"RuleTypeName"` + + // 规则内的功能分类Id(扫描器,Bot行为等) + // 注意:此字段可能返回 null,表示取不到有效值。 + ClassificationId *int64 `json:"ClassificationId,omitempty" name:"ClassificationId"` + + // 规则当前所属动作状态(block, alg, ...) + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type PostMaxSize struct { + // 是否开启POST请求上传文件限制,平台默认为限制为32MB,取值有: + //
  • on:开启限制;
  • + //
  • off:关闭限制。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 最大限制,取值在1MB和500MB之间。单位字节。 + // 注意:此字段可能返回 null,表示取不到有效值。 + MaxSize *int64 `json:"MaxSize,omitempty" name:"MaxSize"` +} + +type QueryCondition struct { + // 维度 + Key *string `json:"Key,omitempty" name:"Key"` + + // 操作符 + Operator *string `json:"Operator,omitempty" name:"Operator"` + + // 维度值 + Value []*string `json:"Value,omitempty" name:"Value"` +} + +type QueryString struct { + // CacheKey是否由QueryString组成,取值有: + //
  • on:是;
  • + //
  • off:否。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // CacheKey使用QueryString的方式,取值有: + //
  • includeCustom:使用部分url参数;
  • + //
  • excludeCustom:排除部分url参数。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + Action *string `json:"Action,omitempty" name:"Action"` + + // 使用/排除的url参数数组。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Value []*string `json:"Value,omitempty" name:"Value"` +} + +type Quic struct { + // 是否开启Quic配置,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type RateLimitConfig struct { + // 开关 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 用户规则 + UserRules []*RateLimitUserRule `json:"UserRules,omitempty" name:"UserRules"` + + // 默认模板 + // 注意:此字段可能返回 null,表示取不到有效值。 + Template *RateLimitTemplate `json:"Template,omitempty" name:"Template"` + + // 智能客户端过滤 + // 注意:此字段可能返回 null,表示取不到有效值。 + Intelligence *RateLimitIntelligence `json:"Intelligence,omitempty" name:"Intelligence"` +} + +type RateLimitIntelligence struct { + // 功能开关 + // 注意:此字段可能返回 null,表示取不到有效值。 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 执行动作 monitor(观察), alg(挑战) + // 注意:此字段可能返回 null,表示取不到有效值。 + Action *string `json:"Action,omitempty" name:"Action"` +} + +type RateLimitTemplate struct { + // 模板名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 模板值详情 + // 注意:此字段可能返回 null,表示取不到有效值。 + Detail *RateLimitTemplateDetail `json:"Detail,omitempty" name:"Detail"` +} + +type RateLimitTemplateDetail struct { + // 模板名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 唯一id + // 注意:此字段可能返回 null,表示取不到有效值。 + ID *int64 `json:"ID,omitempty" name:"ID"` + + // 处置动作 + // 注意:此字段可能返回 null,表示取不到有效值。 + Action *string `json:"Action,omitempty" name:"Action"` + + // 惩罚时间,秒 + // 注意:此字段可能返回 null,表示取不到有效值。 + PunishTime *int64 `json:"PunishTime,omitempty" name:"PunishTime"` + + // 阈值 + // 注意:此字段可能返回 null,表示取不到有效值。 + Threshold *int64 `json:"Threshold,omitempty" name:"Threshold"` + + // 统计周期 + // 注意:此字段可能返回 null,表示取不到有效值。 + Period *int64 `json:"Period,omitempty" name:"Period"` +} + +type RateLimitUserRule struct { + // RateLimit统计阈值 + Threshold *int64 `json:"Threshold,omitempty" name:"Threshold"` + + // RateLimit统计时间 + Period *int64 `json:"Period,omitempty" name:"Period"` + + // 规则名 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 动作:monitor(观察), drop(拦截) + Action *string `json:"Action,omitempty" name:"Action"` + + // 惩罚时长 + PunishTime *int64 `json:"PunishTime,omitempty" name:"PunishTime"` + + // 处罚时长单位,second + PunishTimeUnit *string `json:"PunishTimeUnit,omitempty" name:"PunishTimeUnit"` + + // 规则状态 + RuleStatus *string `json:"RuleStatus,omitempty" name:"RuleStatus"` + + // 规则 + Conditions []*ACLCondition `json:"Conditions,omitempty" name:"Conditions"` + + // 规则权重 + RulePriority *int64 `json:"RulePriority,omitempty" name:"RulePriority"` + + // 规则id + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleID *int64 `json:"RuleID,omitempty" name:"RuleID"` + + // 过滤词 + // 注意:此字段可能返回 null,表示取不到有效值。 + FreqFields []*string `json:"FreqFields,omitempty" name:"FreqFields"` + + // 更新时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` +} + +// Predefined struct for user +type ReclaimZoneRequestParams struct { + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` +} + +type ReclaimZoneRequest struct { + *tchttp.BaseRequest + + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` +} + +func (r *ReclaimZoneRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ReclaimZoneRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "Name") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ReclaimZoneRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ReclaimZoneResponseParams struct { + // 站点名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ReclaimZoneResponse struct { + *tchttp.BaseResponse + Response *ReclaimZoneResponseParams `json:"Response"` +} + +func (r *ReclaimZoneResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ReclaimZoneResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type Resource struct { + // 资源 ID。 + Id *string `json:"Id,omitempty" name:"Id"` + + // 付费模式,取值有: + //
  • 0:后付费。
  • + PayMode *int64 `json:"PayMode,omitempty" name:"PayMode"` + + // 创建时间。 + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` + + // 生效时间。 + EnableTime *string `json:"EnableTime,omitempty" name:"EnableTime"` + + // 失效时间。 + ExpireTime *string `json:"ExpireTime,omitempty" name:"ExpireTime"` + + // 套餐状态,取值有: + //
  • normal:正常;
  • + //
  • isolated:隔离;
  • + //
  • destroyed:销毁。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 询价参数。 + Sv []*Sv `json:"Sv,omitempty" name:"Sv"` + + // 是否自动续费,取值有: + //
  • 0:默认状态;
  • + //
  • 1:自动续费;
  • + //
  • 2:不自动续费。
  • + AutoRenewFlag *int64 `json:"AutoRenewFlag,omitempty" name:"AutoRenewFlag"` + + // 套餐关联资源 ID。 + PlanId *string `json:"PlanId,omitempty" name:"PlanId"` + + // 地域,取值有: + //
  • mainland:国内;
  • + //
  • overseas:海外。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type RuleAction struct { + // 常规功能操作,选择该类型的功能项有: + //
  • 访问URL 重写(AccessUrlRedirect);
  • + //
  • 回源 URL 重写 (UpstreamUrlRedirect);
  • + //
  • QUIC(QUIC);
  • + //
  • WebSocket (WebSocket);
  • + //
  • 视频拖拽(VideoSeek);
  • + //
  • Token 鉴权(Authentication);
  • + //
  • 自定义CacheKey(CacheKey);
  • + //
  • 节点缓存 TTL (Cache);
  • + //
  • 浏览器缓存 TTL(MaxAge);
  • + //
  • 离线缓存(OfflineCache);
  • + //
  • 智能加速(SmartRouting);
  • + //
  • 分片回源(RangeOriginPull);
  • + //
  • HTTP/2 回源(UpstreamHttp2);
  • + //
  • Host Header 重写(HostHeader);
  • + //
  • 强制 HTTPS(ForceRedirect);
  • + //
  • 回源 HTTPS(OriginPullProtocol);
  • + //
  • 缓存预刷新(CachePrefresh);
  • + //
  • 智能压缩(Compression);
  • + //
  • Hsts;
  • + //
  • ClientIpHeader;
  • + //
  • TlsVersion;
  • + //
  • OcspStapling。
  • + //
  • HTTP/2 访问(Http2)。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + NormalAction *RuleNormalAction `json:"NormalAction,omitempty" name:"NormalAction"` + + // 带有请求头/响应头的功能操作,选择该类型的功能项有: + //
  • 修改 HTTP 请求头(RequestHeader);
  • + //
  • 修改HTTP响应头(ResponseHeader)。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + RewriteAction *RuleRewriteAction `json:"RewriteAction,omitempty" name:"RewriteAction"` + + // 带有状态码的功能操作,选择该类型的功能项有: + //
  • 自定义错误页面(ErrorPage);
  • + //
  • 状态码缓存 TTL(StatusCodeCache)。
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + CodeAction *RuleCodeAction `json:"CodeAction,omitempty" name:"CodeAction"` +} + +type RuleAndConditions struct { + // 规则引擎条件,该数组内所有项全部满足即判断该条件满足。 + Conditions []*RuleCondition `json:"Conditions,omitempty" name:"Conditions"` +} + +type RuleChoicePropertiesItem struct { + // 参数名称。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 参数值类型。 + //
  • CHOICE:参数值只能在 ChoicesValue 中选择;
  • + //
  • TOGGLE:参数值为开关类型,可在 ChoicesValue 中选择;
  • + //
  • CUSTOM_NUM:参数值用户自定义,整型类型;
  • + //
  • CUSTOM_STRING:参数值用户自定义,字符串类型。
  • + Type *string `json:"Type,omitempty" name:"Type"` + + // 参数值的可选值。 + // 注意:若参数值为用户自定义则该数组为空数组。 + ChoicesValue []*string `json:"ChoicesValue,omitempty" name:"ChoicesValue"` + + // 数值参数的最小值,非数值参数或 Min 和 Max 值都为 0 则此项无意义。 + Min *int64 `json:"Min,omitempty" name:"Min"` + + // 数值参数的最大值,非数值参数或 Min 和 Max 值都为 0 则此项无意义。 + Max *int64 `json:"Max,omitempty" name:"Max"` + + // 参数值是否支持多选或者填写多个。 + IsMultiple *bool `json:"IsMultiple,omitempty" name:"IsMultiple"` + + // 是否允许为空。 + IsAllowEmpty *bool `json:"IsAllowEmpty,omitempty" name:"IsAllowEmpty"` + + // 特殊参数。 + //
  • 为 NULL:RuleAction 选择 NormalAction;
  • + //
  • 成员参数 Id 为 Action:RuleAction 选择 RewirteAction;
  • + //
  • 成员参数 Id 为 StatusCode:RuleAction 选择 CodeAction。
  • + ExtraParameter *RuleExtraParameter `json:"ExtraParameter,omitempty" name:"ExtraParameter"` +} + +type RuleCodeAction struct { + // 功能名称,功能名称填写规范可调用接口 [查询规则引擎的设置参数](https://tcloud4api.woa.com/document/product/1657/79433?!preview&!document=1) 查看。 + Action *string `json:"Action,omitempty" name:"Action"` + + // 操作参数。 + Parameters []*RuleCodeActionParams `json:"Parameters,omitempty" name:"Parameters"` +} + +type RuleCodeActionParams struct { + // 状态 Code。 + StatusCode *int64 `json:"StatusCode,omitempty" name:"StatusCode"` + + // 参数名称,参数填写规范可调用接口 [查询规则引擎的设置参数](https://tcloud4api.woa.com/document/product/1657/79433?!preview&!document=1) 查看。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 参数值。 + Values []*string `json:"Values,omitempty" name:"Values"` +} + +type RuleCondition struct { + // 运算符,取值有: + //
  • equal: 等于;
  • + //
  • notequal: 不等于。
  • + Operator *string `json:"Operator,omitempty" name:"Operator"` + + // 匹配类型,取值有: + //
  • 全部(站点任意请求): host。
  • + //
  • 文件名: filename;
  • + //
  • 文件后缀: extension;
  • + //
  • HOST: host;
  • + //
  • URL Full: full_url,当前站点下完整 URL 路径,必须包含 HTTP 协议,Host 和 路径;
  • + //
  • URL Path: url,当前站点下 URL 路径的请求。
  • + Target *string `json:"Target,omitempty" name:"Target"` + + // 对应匹配类型的参数值,对应匹配类型的取值有: + //
  • 文件后缀:jpg、txt等文件后缀;
  • + //
  • 文件名称:例如 foo.jpg 中的 foo;
  • + //
  • 全部(站点任意请求): all;
  • + //
  • HOST:当前站点下的 host ,例如www.maxx55.com;
  • + //
  • URL Path:当前站点下 URL 路径的请求,例如:/example;
  • + //
  • URL Full:当前站点下完整 URL 请求,必须包含 HTTP 协议,Host 和 路径,例如:https://www.maxx55.cn/example。
  • + Values []*string `json:"Values,omitempty" name:"Values"` +} + +type RuleExtraParameter struct { + // 参数名,取值有: + //
  • Action:修改 HTTP 头部所需参数,RuleAction 选择 RewirteAction;
  • + //
  • StatusCode:状态码相关功能所需参数,RuleAction 选择 CodeAction。
  • + Id *string `json:"Id,omitempty" name:"Id"` + + // 参数值类型。 + //
  • CHOICE:参数值只能在 Values 中选择;
  • + //
  • CUSTOM_NUM:参数值用户自定义,整型类型;
  • + //
  • CUSTOM_STRING:参数值用户自定义,字符串类型。
  • + Type *string `json:"Type,omitempty" name:"Type"` + + // 可选参数值。 + // 注意:当 Id 的值为 StatusCode 时数组中的值为整型,填写参数值时请填写字符串的整型数值。 + Choices *string `json:"Choices,omitempty" name:"Choices"` +} + +type RuleFilter struct { + // 过滤参数,取值有: + //
  • RULE_ID:规则 ID。
  • + Name *string `json:"Name,omitempty" name:"Name"` + + // 参数值。 + Values []*string `json:"Values,omitempty" name:"Values"` +} + +type RuleItem struct { + // 执行功能判断条件。 + // 注意:满足该数组内任意一项条件,功能即可执行。 + Conditions []*RuleAndConditions `json:"Conditions,omitempty" name:"Conditions"` + + // 执行的功能。 + Actions []*RuleAction `json:"Actions,omitempty" name:"Actions"` +} + +type RuleNormalAction struct { + // 功能名称,功能名称填写规范可调用接口 [查询规则引擎的设置参数](https://tcloud4api.woa.com/document/product/1657/79433?!preview&!document=1) 查看。 + Action *string `json:"Action,omitempty" name:"Action"` + + // 参数。 + Parameters []*RuleNormalActionParams `json:"Parameters,omitempty" name:"Parameters"` +} + +type RuleNormalActionParams struct { + // 参数名称,参数填写规范可调用接口 [查询规则引擎的设置参数](https://tcloud4api.woa.com/document/product/1657/79433?!preview&!document=1) 查看。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 参数值。 + Values []*string `json:"Values,omitempty" name:"Values"` +} + +type RuleRewriteAction struct { + // 功能名称,功能名称填写规范可调用接口 [查询规则引擎的设置参数](https://tcloud4api.woa.com/document/product/1657/79433?!preview&!document=1) 查看。 + Action *string `json:"Action,omitempty" name:"Action"` + + // 参数。 + Parameters []*RuleRewriteActionParams `json:"Parameters,omitempty" name:"Parameters"` +} + +type RuleRewriteActionParams struct { + // 功能参数名称,参数填写规范可调用接口 [查询规则引擎的设置参数](https://tcloud4api.woa.com/document/product/1657/79433?!preview&!document=1) 查看。现在只有三种取值: + //
  • add:添加 HTTP 头部;
  • + //
  • set:重写 HTTP 头部;
  • + //
  • del:删除 HTTP 头部。
  • + Action *string `json:"Action,omitempty" name:"Action"` + + // 参数名称。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 参数值。 + Values []*string `json:"Values,omitempty" name:"Values"` +} + +type RuleSettingDetail struct { + // 规则ID。 + RuleId *string `json:"RuleId,omitempty" name:"RuleId"` + + // 规则名称,名称字符串长度 1~255。 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 规则状态,取值有: + //
  • enable: 启用;
  • + //
  • disable: 未启用。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 规则内容。 + Rules []*RuleItem `json:"Rules,omitempty" name:"Rules"` + + // 规则优先级, 值越大优先级越高,最小为 1。 + RulePriority *int64 `json:"RulePriority,omitempty" name:"RulePriority"` +} + +type RulesProperties struct { + // 值为参数名称。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 数值参数的最小值,非数值参数或 Min 和 Max 值都为 0 则此项无意义。 + Min *int64 `json:"Min,omitempty" name:"Min"` + + // 参数值的可选值。 + // 注意:若参数值为用户自定义则该数组为空数组。 + ChoicesValue []*string `json:"ChoicesValue,omitempty" name:"ChoicesValue"` + + // 参数值类型。 + //
  • CHOICE:参数值只能在 ChoicesValue 中选择;
  • + //
  • TOGGLE:参数值为开关类型,可在 ChoicesValue 中选择;
  • + //
  • OBJECT:参数值为对象类型,ChoiceProperties 为改对象类型关联的属性;
  • + //
  • CUSTOM_NUM:参数值用户自定义,整型类型;
  • + //
  • CUSTOM_STRING:参数值用户自定义,字符串类型。
  • 注意:当参数类型为 OBJECT 类型时,请注意参考 [示例2 参数为 OBJECT 类型的创建](https://tcloud4api.woa.com/document/product/1657/79382?!preview&!document=1) + Type *string `json:"Type,omitempty" name:"Type"` + + // 数值参数的最大值,非数值参数或 Min 和 Max 值都为 0 则此项无意义。 + Max *int64 `json:"Max,omitempty" name:"Max"` + + // 参数值是否支持多选或者填写多个。 + IsMultiple *bool `json:"IsMultiple,omitempty" name:"IsMultiple"` + + // 是否允许为空。 + IsAllowEmpty *bool `json:"IsAllowEmpty,omitempty" name:"IsAllowEmpty"` + + // 该参数对应的关联配置参数,属于调用接口的必填参数。 + // 注意:如果可选参数无特殊新增参数则该数组为空数组。 + ChoiceProperties []*RuleChoicePropertiesItem `json:"ChoiceProperties,omitempty" name:"ChoiceProperties"` + + //
  • 为 NULL:无特殊参数,RuleAction 选择 NormalAction;
  • + // 注意:此字段可能返回 null,表示取不到有效值。 + ExtraParameter *RuleExtraParameter `json:"ExtraParameter,omitempty" name:"ExtraParameter"` +} + +type RulesSettingAction struct { + // 功能名称,取值有: + //
  • 访问URL 重写(AccessUrlRedirect);
  • + //
  • 回源 URL 重写 (UpstreamUrlRedirect);
  • + //
  • 自定义错误页面 + // (ErrorPage);
  • + //
  • QUIC(QUIC);
  • + //
  • WebSocket (WebSocket);
  • + //
  • 视频拖拽(VideoSeek);
  • + //
  • Token 鉴权(Authentication);
  • + //
  • 自定义CacheKey(CacheKey);
  • + //
  • 节点缓存 TTL (Cache);
  • + //
  • 浏览器缓存 TTL(MaxAge);
  • + //
  • 离线缓存(OfflineCache);
  • + //
  • 智能加速(SmartRouting);
  • + //
  • 分片回源(RangeOriginPull);
  • + //
  • HTTP/2 回源(UpstreamHttp2);
  • + //
  • Host Header 重写(HostHeader);
  • + //
  • 强制 HTTPS(ForceRedirect);
  • + //
  • 回源 HTTPS(OriginPullProtocol);
  • + //
  • 缓存预刷新(CachePrefresh);
  • + //
  • 智能压缩(Compression);
  • + //
  • 修改 HTTP 请求头(RequestHeader);
  • + //
  • 修改HTTP响应头(ResponseHeader);
  • + //
  • 状态码缓存 TTL(StatusCodeCache);
  • + //
  • Hsts;
  • + //
  • ClientIpHeader;
  • + //
  • TlsVersion;
  • + //
  • OcspStapling。
  • + Action *string `json:"Action,omitempty" name:"Action"` + + // 参数信息。 + Properties []*RulesProperties `json:"Properties,omitempty" name:"Properties"` +} + +// Predefined struct for user +type ScanDnsRecordsRequestParams struct { + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +type ScanDnsRecordsRequest struct { + *tchttp.BaseRequest + + // 站点 ID + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` +} + +func (r *ScanDnsRecordsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ScanDnsRecordsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ZoneId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ScanDnsRecordsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ScanDnsRecordsResponseParams struct { + // 扫描状态 + // - doing 扫描中 + // - done 扫描完成 + Status *string `json:"Status,omitempty" name:"Status"` + + // 扫描后添加的记录数 + RecordsAdded *int64 `json:"RecordsAdded,omitempty" name:"RecordsAdded"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type ScanDnsRecordsResponse struct { + *tchttp.BaseResponse + Response *ScanDnsRecordsResponseParams `json:"Response"` +} + +func (r *ScanDnsRecordsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ScanDnsRecordsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type SecEntry struct { + // 查询维度值。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Key *string `json:"Key,omitempty" name:"Key"` + + // 查询维度下详细数据。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Value []*SecEntryValue `json:"Value,omitempty" name:"Value"` +} + +type SecEntryValue struct { + // 指标名称。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Metric *string `json:"Metric,omitempty" name:"Metric"` + + // 时序数据详情。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Detail []*TimingDataItem `json:"Detail,omitempty" name:"Detail"` + + // 最大值。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Max *int64 `json:"Max,omitempty" name:"Max"` + + // 平均值。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Avg *float64 `json:"Avg,omitempty" name:"Avg"` + + // 数据总和。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Sum *float64 `json:"Sum,omitempty" name:"Sum"` +} + +type SecRuleRelatedInfo struct { + // 规则ID列表(99999为无效id)。 + RuleId *int64 `json:"RuleId,omitempty" name:"RuleId"` + + // 执行动作(处置方式),取值有: + //
  • trans :通过 ;
  • + //
  • alg :算法挑战 ;
  • + //
  • drop :丢弃 ;
  • + //
  • ban :封禁源ip ;
  • + //
  • redirect :重定向 ;
  • + //
  • page :返回指定页面 ;
  • + //
  • monitor :观察 。
  • + Action *string `json:"Action,omitempty" name:"Action"` + + // 风险等级(waf日志中独有),取值有: + //
  • high risk :高危 ;
  • + //
  • middle risk :中危 ;
  • + //
  • low risk :低危 ;
  • + //
  • unkonw :未知 。
  • + RiskLevel *string `json:"RiskLevel,omitempty" name:"RiskLevel"` + + // 规则等级,取值有: + //
  • normal :正常 。
  • + RuleLevel *string `json:"RuleLevel,omitempty" name:"RuleLevel"` + + // 规则描述。 + Description *string `json:"Description,omitempty" name:"Description"` + + // 规则类型名称。 + RuleTypeName *string `json:"RuleTypeName,omitempty" name:"RuleTypeName"` +} + +type SecurityConfig struct { + // 门神配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + WafConfig *WafConfig `json:"WafConfig,omitempty" name:"WafConfig"` + + // RateLimit配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + RateLimitConfig *RateLimitConfig `json:"RateLimitConfig,omitempty" name:"RateLimitConfig"` + + // DDoS配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + DdosConfig *DDoSConfig `json:"DdosConfig,omitempty" name:"DdosConfig"` + + // ACL配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + AclConfig *AclConfig `json:"AclConfig,omitempty" name:"AclConfig"` + + // Bot配置 + // 注意:此字段可能返回 null,表示取不到有效值。 + BotConfig *BotConfig `json:"BotConfig,omitempty" name:"BotConfig"` + + // 总开关 + // 注意:此字段可能返回 null,表示取不到有效值。 + SwitchConfig *SwitchConfig `json:"SwitchConfig,omitempty" name:"SwitchConfig"` + + // IP黑白名单 + // 注意:此字段可能返回 null,表示取不到有效值。 + IpTableConfig *IpTableConfig `json:"IpTableConfig,omitempty" name:"IpTableConfig"` +} + +type SecurityEntity struct { + // 用户appid + AppId *int64 `json:"AppId,omitempty" name:"AppId"` + + // 一级域名 + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 二级域名 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 类型 domain/application + EntityType *string `json:"EntityType,omitempty" name:"EntityType"` +} + +type ServerCertInfo struct { + // 服务器证书 ID, 默认证书ID, 或在 SSL 证书管理进行证书托管时自动生成 + // 注意:此字段可能返回 null,表示取不到有效值。 + CertId *string `json:"CertId,omitempty" name:"CertId"` + + // 证书备注名 + // 注意:此字段可能返回 null,表示取不到有效值。 + Alias *string `json:"Alias,omitempty" name:"Alias"` + + // 证书类型: + // default: 默认证书 + // upload:用户上传 + // managed:腾讯云托管 + // 注意:此字段可能返回 null,表示取不到有效值。 + Type *string `json:"Type,omitempty" name:"Type"` + + // 证书过期时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + ExpireTime *string `json:"ExpireTime,omitempty" name:"ExpireTime"` + + // 证书部署时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + DeployTime *string `json:"DeployTime,omitempty" name:"DeployTime"` + + // 部署状态: + // processing: 部署中 + // deployed: 已部署 + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *string `json:"Status,omitempty" name:"Status"` +} + +type ShieldArea struct { + // 一级域名id + ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"` + + // 策略id + PolicyId *int64 `json:"PolicyId,omitempty" name:"PolicyId"` + + // 防护类型 domain/application + Type *string `json:"Type,omitempty" name:"Type"` + + // 四层应用名 + // 注意:此字段可能返回 null,表示取不到有效值。 + EntityName *string `json:"EntityName,omitempty" name:"EntityName"` + + // 7层域名参数 + // 注意:此字段可能返回 null,表示取不到有效值。 + Application []*DDoSApplication `json:"Application,omitempty" name:"Application"` + + // 四层tcp转发规则数 + // 注意:此字段可能返回 null,表示取不到有效值。 + TcpNum *int64 `json:"TcpNum,omitempty" name:"TcpNum"` + + // 四层udp转发规则数 + // 注意:此字段可能返回 null,表示取不到有效值。 + UdpNum *int64 `json:"UdpNum,omitempty" name:"UdpNum"` + + // 实例名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Entity *string `json:"Entity,omitempty" name:"Entity"` + + // 是否为共享资源客户,注意共享资源用户不可以切换代理模式,true-是;false-否 + // 注意:此字段可能返回 null,表示取不到有效值。 + Share *bool `json:"Share,omitempty" name:"Share"` +} + +type SmartRouting struct { + // 智能加速配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type Sv struct { + // 询价参数键。 + Key *string `json:"Key,omitempty" name:"Key"` + + // 询价参数值。 + Value *string `json:"Value,omitempty" name:"Value"` +} + +type SwitchConfig struct { + // Web类型的安全总开关:Web基础防护,自定义规则,速率限制 + WebSwitch *string `json:"WebSwitch,omitempty" name:"WebSwitch"` +} + +type Tag struct { + // 标签键 + // 注意:此字段可能返回 null,表示取不到有效值。 + TagKey *string `json:"TagKey,omitempty" name:"TagKey"` + + // 标签值 + // 注意:此字段可能返回 null,表示取不到有效值。 + TagValue *string `json:"TagValue,omitempty" name:"TagValue"` +} + +type Task struct { + // 任务ID + JobId *string `json:"JobId,omitempty" name:"JobId"` + + // 状态 + Status *string `json:"Status,omitempty" name:"Status"` + + // 资源 + Target *string `json:"Target,omitempty" name:"Target"` + + // 任务类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 任务创建时间 + CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"` + + // 任务完成时间 + UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"` +} + +type TimingDataItem struct { + // 返回数据对应时间点,采用unix秒级时间戳 + // 注意:此字段可能返回 null,表示取不到有效值。 + Timestamp *int64 `json:"Timestamp,omitempty" name:"Timestamp"` + + // 具体数值 + // 注意:此字段可能返回 null,表示取不到有效值。 + Value *int64 `json:"Value,omitempty" name:"Value"` +} + +type TimingDataRecord struct { + // 查询维度值 + TypeKey *string `json:"TypeKey,omitempty" name:"TypeKey"` + + // 详细时序数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + TypeValue []*TimingTypeValue `json:"TypeValue,omitempty" name:"TypeValue"` +} + +type TimingTypeValue struct { + // 数据和 + // 注意:此字段可能返回 null,表示取不到有效值。 + Sum *int64 `json:"Sum,omitempty" name:"Sum"` + + // 最大 + // 注意:此字段可能返回 null,表示取不到有效值。 + Max *int64 `json:"Max,omitempty" name:"Max"` + + // 平均 + // 注意:此字段可能返回 null,表示取不到有效值。 + Avg *int64 `json:"Avg,omitempty" name:"Avg"` + + // 指标名 + MetricName *string `json:"MetricName,omitempty" name:"MetricName"` + + // 废弃字段,即将下线,请使用Detail字段 + // 注意:此字段可能返回 null,表示取不到有效值。 + DetailData []*int64 `json:"DetailData,omitempty" name:"DetailData"` + + // 详细数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Detail []*TimingDataItem `json:"Detail,omitempty" name:"Detail"` +} + +type TopDataRecord struct { + // 查询维度值 + TypeKey *string `json:"TypeKey,omitempty" name:"TypeKey"` + + // top数据排行 + // 注意:此字段可能返回 null,表示取不到有效值。 + DetailData []*TopDetailData `json:"DetailData,omitempty" name:"DetailData"` +} + +type TopDetailData struct { + // 字段名 + Key *string `json:"Key,omitempty" name:"Key"` + + // 字段值 + Value *int64 `json:"Value,omitempty" name:"Value"` +} + +type TopNEntry struct { + // top查询维度值。 + Key *string `json:"Key,omitempty" name:"Key"` + + // 查询具体数据。 + Value []*TopNEntryValue `json:"Value,omitempty" name:"Value"` +} + +type TopNEntryValue struct { + // 排序实体名。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 排序实体数量。 + Count *int64 `json:"Count,omitempty" name:"Count"` +} + +type UpstreamHttp2 struct { + // http2回源配置开关,取值有: + //
  • on:开启;
  • + //
  • off:关闭。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` +} + +type VanityNameServers struct { + // 自定义 ns 开关 + // - on 开启 + // - off 关闭 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 自定义 ns 列表 + Servers []*string `json:"Servers,omitempty" name:"Servers"` +} + +type VanityNameServersIps struct { + // 自定义名字服务器名称 + Name *string `json:"Name,omitempty" name:"Name"` + + // 自定义名字服务器 IPv4 地址 + IPv4 *string `json:"IPv4,omitempty" name:"IPv4"` +} + +type WafConfig struct { + // 开关 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 防护级别,loose/normal/strict/stricter/custom + Level *string `json:"Level,omitempty" name:"Level"` + + // 模式 block-阻断;observe-观察模式;close-关闭 + Mode *string `json:"Mode,omitempty" name:"Mode"` + + // 托管规则黑白名单 + WafRules *WafRule `json:"WafRules,omitempty" name:"WafRules"` + + // AI规则引擎防护 + // 注意:此字段可能返回 null,表示取不到有效值。 + AiRule *AiRule `json:"AiRule,omitempty" name:"AiRule"` +} + +type WafRule struct { + // 黑名单,ID参考接口 DescribeSecurityPolicyManagedRules + BlockRuleIDs []*int64 `json:"BlockRuleIDs,omitempty" name:"BlockRuleIDs"` + + // 托管规则 开关 + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 观察模式,ID参考接口 DescribeSecurityPolicyManagedRules + // 注意:此字段可能返回 null,表示取不到有效值。 + ObserveRuleIDs []*int64 `json:"ObserveRuleIDs,omitempty" name:"ObserveRuleIDs"` +} + +type WebAttackEvent struct { + // 客户端ip + // 注意:此字段可能返回 null,表示取不到有效值。 + ClientIp *string `json:"ClientIp,omitempty" name:"ClientIp"` + + // 攻击URL + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackUrl *string `json:"AttackUrl,omitempty" name:"AttackUrl"` + + // 攻击时间 单位为s + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackTime *int64 `json:"AttackTime,omitempty" name:"AttackTime"` +} + +type WebEventData struct { + // 攻击事件数据集合 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*WebAttackEvent `json:"List,omitempty" name:"List"` + + // 当前页 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 每页展示条数 + // 注意:此字段可能返回 null,表示取不到有效值。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数 + // 注意:此字段可能返回 null,表示取不到有效值。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type WebLogData struct { + // 分组数据。 + // 注意:此字段可能返回 null,表示取不到有效值。 + List []*WebLogs `json:"List,omitempty" name:"List"` + + // 分页拉取的起始页号。最小值:1。 + PageNo *int64 `json:"PageNo,omitempty" name:"PageNo"` + + // 分页拉取的最大返回结果数。最大值:1000。 + PageSize *int64 `json:"PageSize,omitempty" name:"PageSize"` + + // 总页数。 + Pages *int64 `json:"Pages,omitempty" name:"Pages"` + + // 总条数。 + TotalSize *int64 `json:"TotalSize,omitempty" name:"TotalSize"` +} + +type WebLogs struct { + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackContent *string `json:"AttackContent,omitempty" name:"AttackContent"` + + // 攻击源(客户端)Ip。 + AttackIp *string `json:"AttackIp,omitempty" name:"AttackIp"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + AttackType *string `json:"AttackType,omitempty" name:"AttackType"` + + // 受攻击子域名。 + Domain *string `json:"Domain,omitempty" name:"Domain"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Msuuid *string `json:"Msuuid,omitempty" name:"Msuuid"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RequestMethod *string `json:"RequestMethod,omitempty" name:"RequestMethod"` + + // URI + RequestUri *string `json:"RequestUri,omitempty" name:"RequestUri"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RiskLevel *string `json:"RiskLevel,omitempty" name:"RiskLevel"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleId *uint64 `json:"RuleId,omitempty" name:"RuleId"` + + // IP所在国家iso-3166中alpha-2编码,编码信息请参考[ISO-3166](https://git.woa.com/edgeone/iso-3166/blob/master/all/all.json) + SipCountryCode *string `json:"SipCountryCode,omitempty" name:"SipCountryCode"` + + // 请求(事件)ID。 + EventId *string `json:"EventId,omitempty" name:"EventId"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + DisposalMethod *string `json:"DisposalMethod,omitempty" name:"DisposalMethod"` + + // http log。 + HttpLog *string `json:"HttpLog,omitempty" name:"HttpLog"` + + // 该字段已废弃。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Ua *string `json:"Ua,omitempty" name:"Ua"` + + // 攻击时间,采用unix秒级时间戳。 + AttackTime *uint64 `json:"AttackTime,omitempty" name:"AttackTime"` + + // 规则相关信息列表。 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleDetailList []*SecRuleRelatedInfo `json:"RuleDetailList,omitempty" name:"RuleDetailList"` +} + +type WebSocket struct { + // WebSocket 超时时间配置开关,取值有: + //
  • on:使用Timeout作为WebSocket超时时间;
  • + //
  • off:平台仍支持WebSocket连接,此时使用系统默认的15秒为超时时间。
  • + Switch *string `json:"Switch,omitempty" name:"Switch"` + + // 超时时间,单位为秒,最大超时时间120秒。 + Timeout *int64 `json:"Timeout,omitempty" name:"Timeout"` +} + +type Zone struct { + // 站点ID。 + Id *string `json:"Id,omitempty" name:"Id"` + + // 站点名称。 + Name *string `json:"Name,omitempty" name:"Name"` + + // 站点当前使用的 NS 列表。 + OriginalNameServers []*string `json:"OriginalNameServers,omitempty" name:"OriginalNameServers"` + + // 腾讯云分配的 NS 列表。 + NameServers []*string `json:"NameServers,omitempty" name:"NameServers"` + + // 站点状态,取值有: + //
  • active:NS 已切换;
  • + //
  • pending:NS 未切换;
  • + //
  • moved:NS 已切走;
  • + //
  • deactivated:被封禁。
  • + Status *string `json:"Status,omitempty" name:"Status"` + + // 站点接入方式,取值有 + //
  • full:NS 接入;
  • + //
  • partial:CNAME 接入。
  • + Type *string `json:"Type,omitempty" name:"Type"` + + // 站点是否关闭。 + Paused *bool `json:"Paused,omitempty" name:"Paused"` + + // 是否开启cname加速,取值有: + //
  • enabled:开启;
  • + //
  • disabled:关闭。
  • + CnameSpeedUp *string `json:"CnameSpeedUp,omitempty" name:"CnameSpeedUp"` + + // cname 接入状态,取值有: + //
  • finished:站点已验证;
  • + //
  • pending:站点验证中。
  • + CnameStatus *string `json:"CnameStatus,omitempty" name:"CnameStatus"` + + // 资源标签列表。 + Tags []*Tag `json:"Tags,omitempty" name:"Tags"` + + // 计费资源列表。 + Resources []*Resource `json:"Resources,omitempty" name:"Resources"` + + // 站点创建时间。 + CreatedOn *string `json:"CreatedOn,omitempty" name:"CreatedOn"` + + // 站点修改时间。 + ModifiedOn *string `json:"ModifiedOn,omitempty" name:"ModifiedOn"` + + // 站点接入地域,取值为: + //
  • global:全球;
  • + //
  • mainland:中国大陆;
  • + //
  • overseas:境外区域。
  • + Area *string `json:"Area,omitempty" name:"Area"` +} + +type ZoneFilter struct { + // 过滤字段名,支持的列表如下: + //
  • name:站点名;
  • + //
  • status:站点状态;
  • + //
  • tagKey:标签键;
  • + //
  • tagValue: 标签值。
  • + Name *string `json:"Name,omitempty" name:"Name"` + + // 过滤字段值。 + Values []*string `json:"Values,omitempty" name:"Values"` + + // 是否启用模糊查询,仅支持过滤字段名为name。模糊查询时,Values长度最大为1。默认为false。 + Fuzzy *bool `json:"Fuzzy,omitempty" name:"Fuzzy"` +} \ No newline at end of file diff --git a/vendor/modules.txt b/vendor/modules.txt index 98c65dfb7d..5bd2f1ce4c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -555,7 +555,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.412 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.480 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.486 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http @@ -613,6 +613,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr/v20190924 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq/v20200217 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.472 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem/v20210701 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.486 +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220106 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.480 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.199 diff --git a/website/docs/d/teo_zone_available_plans.html.markdown b/website/docs/d/teo_zone_available_plans.html.markdown new file mode 100644 index 0000000000..3f9b221bcd --- /dev/null +++ b/website/docs/d/teo_zone_available_plans.html.markdown @@ -0,0 +1,39 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_zone_available_plans" +sidebar_current: "docs-tencentcloud-datasource-teo_zone_available_plans" +description: |- + Use this data source to query zone available plans. +--- + +# tencentcloud_teo_zone_available_plans + +Use this data source to query zone available plans. + +## Example Usage + +```hcl +data "tencentcloud_teo_zone_available_plans" "available_plans" {} +``` + +## Argument Reference + +The following arguments are supported: + +* `result_output_file` - (Optional, String) Used for save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `plan_info_list` - Available plans for a zone. + * `currency` - Currency type. Valid values: `CNY`, `USD`. + * `flux` - The number of fluxes included in the zone plan. Unit: Byte. + * `frequency` - Billing cycle. Valid values: `y`: Billed by the year; `m`: Billed by the month; `h`: Billed by the hour; `M`: Billed by the minute; `s`: Billed by the second. + * `plan_type` - Plan type. + * `price` - Price of the plan. Unit: cent. + * `request` - The number of requests included in the zone plan. + * `site_number` - The number of zones this zone plan can bind. + + diff --git a/website/docs/d/teo_zone_ddos_policy.html.markdown b/website/docs/d/teo_zone_ddos_policy.html.markdown new file mode 100644 index 0000000000..2245f0b367 --- /dev/null +++ b/website/docs/d/teo_zone_ddos_policy.html.markdown @@ -0,0 +1,54 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_zone_ddos_policy" +sidebar_current: "docs-tencentcloud-datasource-teo_zone_ddos_policy" +description: |- + Use this data source to query zone ddos policy. +--- + +# tencentcloud_teo_zone_ddos_policy + +Use this data source to query zone ddos policy. + +## Example Usage + +```hcl +data "tencentcloud_teo_zone_ddos_policy" "example" { + zone_id = "" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `result_output_file` - (Optional, String) Used for save results. +* `zone_id` - (Optional, String) Site ID. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `app_id` - App ID. +* `domains` - All subdomain info. Note: This field may return null, indicating that no valid value can be obtained. + * `accelerate_type` - on: Enable; off: Disable. + * `host` - Subdomain. + * `security_type` - on: Enable; off: Disable. + * `status` - Status of the subdomain. Note: This field may return null, indicating that no valid value can be obtained, init: waiting to config NS; offline: waiting to enable site accelerating; process: config deployment processing; online: normal status. +* `shield_areas` - Shield areas of the zone. + * `application` - Layer 7 Domain Name Parameters. + * `accelerate_type` - on: Enable; off: Disable. + * `host` - Subdomain. + * `security_type` - on: Enable; off: Disable. + * `status` - Status of the subdomain. Note: This field may return null, indicating that no valid value can be obtained, init: waiting to config NS; offline: waiting to enable site accelerating; process: config deployment processing; online: normal status. + * `entity_name` - When `Type` is `domain`, this field is `ZoneName`. When `Type` is `application`, this field is `ProxyName`. Note: This field may return null, indicating that no valid value can be obtained. + * `entity` - When `Type` is `domain`, this field is `ZoneId`. When `Type` is `application`, this field is `ProxyId`. Note: This field may return null, indicating that no valid value can be obtained. + * `policy_id` - Policy ID. + * `share` - Whether the resource is shared. + * `tcp_num` - TCP forwarding rule number of layer 4 application. + * `type` - Valid values: `domain`, `application`. + * `udp_num` - UDP forwarding rule number of layer 4 application. + * `zone_id` - Site ID. + + diff --git a/website/docs/r/teo_application_proxy.html.markdown b/website/docs/r/teo_application_proxy.html.markdown new file mode 100644 index 0000000000..ffc80e3b89 --- /dev/null +++ b/website/docs/r/teo_application_proxy.html.markdown @@ -0,0 +1,60 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_application_proxy" +sidebar_current: "docs-tencentcloud-resource-teo_application_proxy" +description: |- + Provides a resource to create a teo application_proxy +--- + +# tencentcloud_teo_application_proxy + +Provides a resource to create a teo application_proxy + +## Example Usage + +```hcl +resource "tencentcloud_teo_application_proxy" "application_proxy" { + zone_id = tencentcloud_teo_zone.zone.id + zone_name = "sfurnace.work" + + accelerate_type = 1 + security_type = 1 + plat_type = "domain" + proxy_name = "www.sfurnace.work" + proxy_type = "hostname" + session_persist_time = 2400 +} +``` + +## Argument Reference + +The following arguments are supported: + +* `accelerate_type` - (Required, Int) - 0: Disable acceleration.- 1: Enable acceleration. +* `plat_type` - (Required, String) Scheduling mode.- ip: Anycast IP.- domain: CNAME. +* `proxy_name` - (Required, String) Layer-4 proxy name. +* `security_type` - (Required, Int) - 0: Disable security protection.- 1: Enable security protection. +* `zone_id` - (Required, String) Site ID. +* `zone_name` - (Required, String) Site name. +* `proxy_type` - (Optional, String) Specifies how a layer-4 proxy is created.- hostname: Subdomain name.- instance: Instance. +* `session_persist_time` - (Optional, Int) Session persistence duration. Value range: 30-3600 (in seconds). + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `host_id` - ID of the layer-7 domain name. +* `proxy_id` - Proxy ID. +* `schedule_value` - Scheduling information. +* `update_time` - Last modification date. + + +## Import + +teo application_proxy can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_application_proxy.application_proxy zoneId#proxyId +``` + diff --git a/website/docs/r/teo_application_proxy_rule.html.markdown b/website/docs/r/teo_application_proxy_rule.html.markdown new file mode 100644 index 0000000000..0608812c3e --- /dev/null +++ b/website/docs/r/teo_application_proxy_rule.html.markdown @@ -0,0 +1,61 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_application_proxy_rule" +sidebar_current: "docs-tencentcloud-resource-teo_application_proxy_rule" +description: |- + Provides a resource to create a teo application_proxy_rule +--- + +# tencentcloud_teo_application_proxy_rule + +Provides a resource to create a teo application_proxy_rule + +## Example Usage + +```hcl +resource "tencentcloud_teo_application_proxy_rule" "application_proxy_rule" { + zone_id = tencentcloud_teo_zone.zone.id + proxy_id = tencentcloud_teo_application_proxy.application_proxy_rule.proxy_id + + forward_client_ip = "TOA" + origin_type = "custom" + origin_value = [ + "1.1.1.1:80", + ] + port = [ + "80", + ] + proto = "TCP" + session_persist = false +} +``` + +## Argument Reference + +The following arguments are supported: + +* `origin_type` - (Required, String) Origin server type.- custom: Specified origins.- origins: An origin group.- load_balancing: A load balancer. +* `origin_value` - (Required, Set: [`String`]) Origin server information.When OriginType is custom, this field value indicates multiple origin servers in either of the following formats:- IP:Port- Domain name:Port.When OriginType is origins, it indicates the origin group ID. +* `port` - (Required, Set: [`String`]) Valid values:- port number: `80` means port 80.- port range: `81-90` means port range 81-90. +* `proto` - (Required, String) Protocol. Valid values: `TCP`, `UDP`. +* `proxy_id` - (Required, String, ForceNew) Proxy ID. +* `zone_id` - (Required, String, ForceNew) Site ID. +* `forward_client_ip` - (Optional, String) Passes the client IP.When Proto is TCP, valid values:- TOA: Pass the client IP via TOA.- PPV1: Pass the client IP via Proxy Protocol V1.- PPV2: Pass the client IP via Proxy Protocol V2.- OFF: Do not pass the client IP.When Proto=UDP, valid values:- PPV2: Pass the client IP via Proxy Protocol V2.- OFF: Do not pass the client IP. +* `session_persist` - (Optional, Bool) Specifies whether to enable session persistence. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `rule_id` - Rule ID. + + +## Import + +teo application_proxy_rule can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_application_proxy_rule.application_proxy_rule zoneId#proxyId#ruleId +``` + diff --git a/website/docs/r/teo_ddos_policy.html.markdown b/website/docs/r/teo_ddos_policy.html.markdown new file mode 100644 index 0000000000..ec7ae11b92 --- /dev/null +++ b/website/docs/r/teo_ddos_policy.html.markdown @@ -0,0 +1,215 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_ddos_policy" +sidebar_current: "docs-tencentcloud-resource-teo_ddos_policy" +description: |- + Provides a resource to create a teo ddosPolicy +--- + +# tencentcloud_teo_ddos_policy + +Provides a resource to create a teo ddosPolicy + +## Example Usage + +```hcl +resource "tencentcloud_teo_ddos_policy" "ddosPolicy" { + zone_id = "" + policy_id = "" + ddos_rule { + switch = "" + udp_shard_open = "" + ddos_status_info { + ply_level = "" + } + ddos_geo_ip { + region_id = "" + switch = "" + } + ddos_allow_block { + switch = "" + user_allow_block_ip { + ip = "" + mask = "" + type = "" + ip2 = "" + mask2 = "" + } + } + ddos_anti_ply { + drop_tcp = "" + drop_udp = "" + drop_icmp = "" + drop_other = "" + source_create_limit = "" + source_connect_limit = "" + destination_create_limit = "" + destination_connect_limit = "" + abnormal_connect_num = "" + abnormal_syn_ratio = "" + abnormal_syn_num = "" + connect_timeout = "" + empty_connect_protect = "" + udp_shard = "" + } + ddos_packet_filter { + switch = "" + packet_filter { + action = "" + protocol = "" + dport_start = "" + dport_end = "" + packet_min = "" + packet_max = "" + sport_start = "" + sport_end = "" + match_type = "" + is_not = "" + offset = "" + depth = "" + match_begin = "" + str = "" + match_type2 = "" + is_not2 = "" + offset2 = "" + depth2 = "" + match_begin2 = "" + str2 = "" + match_logic = "" + } + } + ddos_acl { + switch = "" + acl { + dport_end = "" + dport_start = "" + sport_end = "" + sport_start = "" + protocol = "" + action = "" + default = "" + } + } + + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `policy_id` - (Required, Int) Policy ID. +* `zone_id` - (Required, String) Site ID. +* `ddos_rule` - (Optional, List) DDoS Configuration of the zone. + +The `acl` object supports the following: + +* `action` - (Optional, String) Action to take. Valid values: `drop`, `transmit`, `forward`. +* `default` - (Optional, Int) Whether it is default configuration. Valid value:- 0: custom configuration.- 1: default configuration. +* `dport_end` - (Optional, Int) End of the dest port range. Valid value range: 0-65535. +* `dport_start` - (Optional, Int) Start of the dest port range. Valid value range: 0-65535. +* `protocol` - (Optional, String) Valid values: `tcp`, `udp`, `all`. +* `sport_end` - (Optional, Int) End of the source port range. Valid value range: 0-65535. +* `sport_start` - (Optional, Int) Start of the source port range. Valid value range: 0-65535. + +The `ddos_acl` object supports the following: + +* `acl` - (Optional, List) DDoS ACL rule configuration detail. +* `switch` - (Optional, String) - on: Enable. `Acl` parameter is require.- off: Disable. + +The `ddos_allow_block` object supports the following: + +* `switch` - (Optional, String) - on: Enable. `UserAllowBlockIp` parameter is required.- off: Disable. +* `user_allow_block_ip` - (Optional, List) DDoS black-white list detail. + +The `ddos_anti_ply` object supports the following: + +* `abnormal_connect_num` - (Required, Int) Abnormal connections threshold. Valid value range: 0-4294967295. +* `abnormal_syn_num` - (Required, Int) Abnormal syn packet number threshold. Valid value range: 0-65535. +* `abnormal_syn_ratio` - (Required, Int) Abnormal syn packet ratio threshold. Valid value range: 0-100. +* `connect_timeout` - (Required, Int) Connection timeout detection per second. Valid value range: 0-65535. +* `destination_connect_limit` - (Required, Int) Limitation of connections to dest port. Valid value range: 0-4294967295. +* `destination_create_limit` - (Required, Int) Limitation of new connection to dest port per second. Valid value range: 0-4294967295. +* `drop_icmp` - (Required, String) Block ICMP protocol. Valid values: `on`, `off`. +* `drop_other` - (Required, String) Block other protocols. Valid values: `on`, `off`. +* `drop_tcp` - (Required, String) Block TCP protocol. Valid values: `on`, `off`. +* `drop_udp` - (Required, String) Block UDP protocol. Valid values: `on`, `off`. +* `empty_connect_protect` - (Required, String) Empty connection protection switch. Valid values: `on`, `off`. +* `source_connect_limit` - (Required, Int) Limitation of connections to origin website. Valid value range: 0-4294967295. +* `source_create_limit` - (Required, Int) Limitation of new connection to origin website per second. Valid value range: 0-4294967295. +* `udp_shard` - (Optional, String) UDP shard protection switch. Valid values: `on`, `off`. + +The `ddos_geo_ip` object supports the following: + +* `region_id` - (Optional, Set) Region ID. See details in data source `security_policy_regions`. +* `switch` - (Optional, String) - on: Enable.- off: Disable. + +The `ddos_packet_filter` object supports the following: + +* `packet_filter` - (Optional, List) DDoS feature filtering configuration detail. +* `switch` - (Optional, String) - on: Enable. `ModifyDDoSPolicy` parameter is required.- off: Disable. + +The `ddos_rule` object supports the following: + +* `ddos_acl` - (Optional, List) DDoS ACL rule configuration. +* `ddos_allow_block` - (Optional, List) DDoS black-white list. +* `ddos_anti_ply` - (Optional, List) DDoS protocol and connection protection. +* `ddos_geo_ip` - (Optional, List) DDoS Protection by Geo Info. +* `ddos_packet_filter` - (Optional, List) DDoS feature filtering configuration. +* `ddos_status_info` - (Optional, List) DDoS protection level. +* `switch` - (Optional, String) DDoS protection switch. Valid values:- on: Enable.- off: Disable. +* `udp_shard_open` - (Optional, String) UDP shard switch. Valid values:- on: Enable.- off: Disable. + +The `ddos_status_info` object supports the following: + +* `ply_level` - (Required, String) Policy level. Valid values:- low: loose.- middle: moderate.- high: strict. + +The `packet_filter` object supports the following: + +* `action` - (Optional, String) Action to take. Valid values: `drop`, `transmit`, `drop_block`, `forward`. +* `depth2` - (Optional, Int) Packet character depth to check of feature 2. Valid value range: 1-1500. +* `depth` - (Optional, Int) Packet character depth to check of feature 1. Valid value range: 1-1500. +* `dport_end` - (Optional, Int) End of the dest port range. Valid value range: 0-65535. +* `dport_start` - (Optional, Int) Start of the dest port range. Valid value range: 0-65535. +* `is_not2` - (Optional, Int) Negate the match condition of feature 2. Valid values:- 0: match.- 1: not match. +* `is_not` - (Optional, Int) Negate the match condition of feature 1. Valid values:- 0: match.- 1: not match. +* `match_begin2` - (Optional, String) Packet layer for matching begin of feature 2. Valid values:- begin_l5: matching from packet payload.- begin_l4: matching from TCP/UDP header.- begin_l3: matching from IP header. +* `match_begin` - (Optional, String) Packet layer for matching begin of feature 1. Valid values:- begin_l5: matching from packet payload.- begin_l4: matching from TCP/UDP header.- begin_l3: matching from IP header. +* `match_logic` - (Optional, String) Relation between multi features. Valid values: `and`, `or`, `none` (only feature 1 is used). +* `match_type2` - (Optional, String) Match type of feature 2. Valid values:- pcre: regex expression.- sunday: string match. +* `match_type` - (Optional, String) Match type of feature 1. Valid values:- pcre: regex expression.- sunday: string match. +* `offset2` - (Optional, Int) Offset of feature 2. Valid value range: 1-1500. +* `offset` - (Optional, Int) Offset of feature 1. Valid value range: 1-1500. +* `packet_max` - (Optional, Int) Max packet size. Valid value range: 0-1500. +* `packet_min` - (Optional, Int) Min packet size. Valid value range: 0-1500. +* `protocol` - (Optional, String) Valid value: `tcp`, `udp`, `icmp`, `all`. +* `sport_end` - (Optional, Int) End of the source port range. Valid value range: 0-65535. +* `sport_start` - (Optional, Int) Start of the source port range. Valid value range: 0-65535. +* `str2` - (Optional, String) Regex expression or string to match. +* `str` - (Optional, String) Regex expression or string to match. + +The `user_allow_block_ip` object supports the following: + +* `type` - (Required, String) Valid values: `block`, `allow`. +* `ip2` - (Optional, String) End of the IP address when setting an IP range. +* `ip` - (Optional, String) Client IP. +* `mask2` - (Optional, Int) IP mask of the end IP address. +* `mask` - (Optional, Int) IP Mask. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +teo ddosPolicy can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_ddos_policy.ddosPolicy ddosPolicy_id +``` + diff --git a/website/docs/r/teo_default_certificate.html.markdown b/website/docs/r/teo_default_certificate.html.markdown new file mode 100644 index 0000000000..bc35e4d43a --- /dev/null +++ b/website/docs/r/teo_default_certificate.html.markdown @@ -0,0 +1,53 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_default_certificate" +sidebar_current: "docs-tencentcloud-resource-teo_default_certificate" +description: |- + Provides a resource to create a teo defaultCertificate +--- + +# tencentcloud_teo_default_certificate + +Provides a resource to create a teo defaultCertificate + +## Example Usage + +```hcl +resource "tencentcloud_teo_default_certificate" "default_certificate" { + zone_id = tencentcloud_teo_zone.zone.id + + cert_info { + cert_id = "teo-28i46c1gtmkl" + status = "deployed" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `zone_id` - (Required, String) Site ID. +* `cert_info` - (Optional, List) List of default certificates. Note: This field may return null, indicating that no valid value can be obtained. + +The `cert_info` object supports the following: + +* `cert_id` - (Required, String) Server certificate ID, which is the ID of the default certificate. If you choose to upload an external certificate for SSL certificate management, a certificate ID will be generated. +* `status` - (Optional, String) Certificate status.- applying: Application in progress.- failed: Application failed.- processing: Deploying certificate.- deployed: Certificate deployed.- disabled: Certificate disabled.Note: This field may return null, indicating that no valid value can be obtained. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +teo default_certificate can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_default_certificate.default_certificate zoneId +``` + diff --git a/website/docs/r/teo_dns_record.html.markdown b/website/docs/r/teo_dns_record.html.markdown new file mode 100644 index 0000000000..ea428a9520 --- /dev/null +++ b/website/docs/r/teo_dns_record.html.markdown @@ -0,0 +1,60 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_dns_record" +sidebar_current: "docs-tencentcloud-resource-teo_dns_record" +description: |- + Provides a resource to create a teo dnsRecord +--- + +# tencentcloud_teo_dns_record + +Provides a resource to create a teo dnsRecord + +## Example Usage + +```hcl +resource "tencentcloud_teo_dns_record" "dns_record" { + zone_id = tencentcloud_teo_zone.zone.id + record_type = "A" + name = "sfurnace.work" + mode = "proxied" + content = "2.2.2.2" + ttl = 80 +} +``` + +## Argument Reference + +The following arguments are supported: + +* `content` - (Required, String) DNS Record Content. +* `mode` - (Required, String) Proxy mode. Valid values: dns_only, cdn_only, and secure_cdn. +* `name` - (Required, String) DNS Record Name. +* `record_type` - (Required, String) DNS Record Type. +* `zone_id` - (Required, String) Site ID. +* `priority` - (Optional, Int) Priority. +* `tags` - (Optional, Map) Tag description list. +* `ttl` - (Optional, Int) TTL, the range is 1-604800, and the minimum value of different levels of domain names is different. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `cname` - CNAME address. +* `created_on` - Creation time. +* `domain_status` - . +* `locked` - Whether the DNS record is locked. +* `modified_on` - Modification time. +* `status` - Resolution status. +* `zone_name` - Site Name. + + +## Import + +teo dns_record can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_dns_record.dnsRecord zoneId#dnsRecordId#name +``` + diff --git a/website/docs/r/teo_dns_sec.html.markdown b/website/docs/r/teo_dns_sec.html.markdown new file mode 100644 index 0000000000..706509667d --- /dev/null +++ b/website/docs/r/teo_dns_sec.html.markdown @@ -0,0 +1,55 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_dns_sec" +sidebar_current: "docs-tencentcloud-resource-teo_dns_sec" +description: |- + Provides a resource to create a teo dnsSec +--- + +# tencentcloud_teo_dns_sec + +Provides a resource to create a teo dnsSec + +## Example Usage + +```hcl +resource "tencentcloud_teo_dns_sec" "dns_sec" { + zone_id = tencentcloud_teo_zone.zone.id + status = "disabled" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `status` - (Required, String) DNSSEC status. Valid values: `enabled`, `disabled`. +* `zone_id` - (Required, String) Site ID. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `dnssec` - DNSSEC infos. + * `algorithm` - Encryption algorithm. + * `d_s` - DS record value. + * `digest_algorithm` - Digest algorithm. + * `digest_type` - Digest type. + * `digest` - Digest message. + * `flags` - Flag. + * `key_tag` - Key tag. + * `key_type` - Encryption type. + * `public_key` - Public key. +* `modified_on` - Last modification date. +* `zone_name` - Site Name. + + +## Import + +teo dns_sec can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_dns_sec.dns_sec zoneId +``` + diff --git a/website/docs/r/teo_host_certificate.html.markdown b/website/docs/r/teo_host_certificate.html.markdown new file mode 100644 index 0000000000..47182ec517 --- /dev/null +++ b/website/docs/r/teo_host_certificate.html.markdown @@ -0,0 +1,55 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_host_certificate" +sidebar_current: "docs-tencentcloud-resource-teo_host_certificate" +description: |- + Provides a resource to create a teo hostCertificate +--- + +# tencentcloud_teo_host_certificate + +Provides a resource to create a teo hostCertificate + +## Example Usage + +```hcl +resource "tencentcloud_teo_host_certificate" "host_certificate" { + zone_id = tencentcloud_teo_zone.zone.id + host = tencentcloud_teo_dns_record.dns_record.name + + cert_info { + cert_id = "yqWPPbs7" + status = "deployed" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `host` - (Required, String) Domain name. +* `zone_id` - (Required, String) Site ID. +* `cert_info` - (Optional, List) Server certificate configuration.Note: This field may return null, indicating that no valid value can be obtained. + +The `cert_info` object supports the following: + +* `cert_id` - (Required, String) Server certificate ID, which is the ID of the default certificate. If you choose to upload an external certificate for SSL certificate management, a certificate ID will be generated. +* `status` - (Optional, String) Certificate deployment status.- processing: Deploying- deployed: DeployedNote: This field may return null, indicating that no valid value can be obtained. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +teo hostCertificate can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_host_certificate.host_certificate zoneId#host +``` + diff --git a/website/docs/r/teo_load_balancing.html.markdown b/website/docs/r/teo_load_balancing.html.markdown new file mode 100644 index 0000000000..c3f66461e1 --- /dev/null +++ b/website/docs/r/teo_load_balancing.html.markdown @@ -0,0 +1,55 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_load_balancing" +sidebar_current: "docs-tencentcloud-resource-teo_load_balancing" +description: |- + Provides a resource to create a teo loadBalancing +--- + +# tencentcloud_teo_load_balancing + +Provides a resource to create a teo loadBalancing + +## Example Usage + +```hcl +resource "tencentcloud_teo_load_balancing" "load_balancing" { + zone_id = tencentcloud_teo_zone.zone.id + + host = "sfurnace.work" + origin_id = [ + split("#", tencentcloud_teo_origin_group.group0.id)[1] + ] + ttl = 600 + type = "proxied" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `host` - (Required, String) Subdomain name. You can use @ to represent the root domain. +* `origin_id` - (Required, Set: [`String`]) ID of the origin group used. +* `type` - (Required, String) Proxy mode. Valid values: dns_only: Only DNS, proxied: Enable proxy. +* `zone_id` - (Required, String, ForceNew) Site ID. +* `ttl` - (Optional, Int) Indicates DNS TTL time when Type=dns_only. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `cname` - Schedules domain names, Note: This field may return null, indicating that no valid value can be obtained. +* `load_balancing_id` - CLB instance ID. +* `update_time` - Update time. + + +## Import + +teo loadBalancing can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_load_balancing.loadBalancing loadBalancing_id +``` + diff --git a/website/docs/r/teo_origin_group.html.markdown b/website/docs/r/teo_origin_group.html.markdown new file mode 100644 index 0000000000..1d95e1f1c2 --- /dev/null +++ b/website/docs/r/teo_origin_group.html.markdown @@ -0,0 +1,88 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_origin_group" +sidebar_current: "docs-tencentcloud-resource-teo_origin_group" +description: |- + Provides a resource to create a teo originGroup +--- + +# tencentcloud_teo_origin_group + +Provides a resource to create a teo originGroup + +## Example Usage + +```hcl +locals { + group0 = [ + { + "record" = "1.1.1.1" + "port" = 80 + "weight" = 30 + }, { + "record" = "2.2.2.2" + "port" = 443 + "weight" = 70 + } + ] +} + +resource "tencentcloud_teo_origin_group" "origin_group" { + zone_id = tencentcloud_teo_zone.zone.id + origin_name = "group0" + origin_type = "self" + type = "weight" + + dynamic "record" { + for_each = local.group0 + content { + record = record.value["record"] + port = record.value["port"] + weight = record.value["weight"] + area = [] + } + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `origin_name` - (Required, String) OriginGroup Name. +* `record` - (Required, List) Origin website records. +* `type` - (Required, String) Type of the origin group, this field is required only when `OriginType` is `self`. Valid values:- area: select an origin by using Geo info of the client IP and `Area` field in Records.- weight: weighted select an origin by using `Weight` field in Records. +* `zone_id` - (Required, String) Site ID. +* `origin_type` - (Optional, String) Type of the origin website. Valid values:- self: self-build website.- cos: tencent cos.- third_party: third party cos. + +The `private_parameter` object supports the following: + +* `name` - (Required, String) Parameter Name. Valid values:- AccessKeyId: Access Key ID.- SecretAccessKey: Secret Access Key. +* `value` - (Required, String) Parameter value. + +The `record` object supports the following: + +* `area` - (Required, Set) Indicating origin website's area when `Type` field is `area`. An empty List indicate the default area. +* `port` - (Required, Int) Port of the origin website. +* `record` - (Required, String) Record Value. +* `weight` - (Required, Int) Indicating origin website's weight when `Type` field is `weight`. Valid value range: 1-100. Sum of all weights should be 100. +* `private_parameter` - (Optional, List) Parameters for private authentication. Only valid when `Private` is `true`. +* `private` - (Optional, Bool) Whether origin website is using private authentication. Only valid when `OriginType` is `third_party`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `update_time` - Last modification date. +* `zone_name` - Site Name. + + +## Import + +teo origin_group can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_origin_group.origin_group zoneId#originId +``` + diff --git a/website/docs/r/teo_rule_engine.html.markdown b/website/docs/r/teo_rule_engine.html.markdown new file mode 100644 index 0000000000..704d62ea8c --- /dev/null +++ b/website/docs/r/teo_rule_engine.html.markdown @@ -0,0 +1,131 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_rule_engine" +sidebar_current: "docs-tencentcloud-resource-teo_rule_engine" +description: |- + Provides a resource to create a teo ruleEngine +--- + +# tencentcloud_teo_rule_engine + +Provides a resource to create a teo ruleEngine + +## Example Usage + +```hcl +resource "tencentcloud_teo_rule_engine" "rule_engine" { + zone_id = tencentcloud_teo_zone.zone.id + rule_name = "rule0" + status = "enable" + + rules { + conditions { + conditions { + operator = "equal" + target = "host" + values = [ + "www.sfurnace.work", + ] + } + } + + actions { + normal_action { + action = "MaxAge" + + parameters { + name = "FollowOrigin" + values = [ + "on", + ] + } + parameters { + name = "MaxAgeTime" + values = [ + "0", + ] + } + } + } + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `rules` - (Required, List) Rule items list. +* `status` - (Required, String) Status of the rule, valid value can be `enable` or `disable`. +* `zone_id` - (Required, String) Site ID. +* `rule_name` - (Optional, String) Rule name. + +The `actions` object supports the following: + +* `code_action` - (Optional, List) Define a code action. +* `normal_action` - (Optional, List) Define a normal action. +* `rewrite_action` - (Optional, List) Define a rewrite action. + +The `code_action` object supports the following: + +* `action` - (Required, String) Action name. +* `parameters` - (Required, List) Action parameters. + +The `conditions` object supports the following: + +* `conditions` - (Required, List) AND Conditions list of the rule. Rule would be triggered if all conditions are true. + +The `conditions` object supports the following: + +* `operator` - (Required, String) Condition operator. Valid values are `equal`, `notequal`. +* `target` - (Required, String) Condition target. Valid values:- host: Host of the URL.- filename: filename of the URL.- extension: file extension of the URL.- full_url: full url.- url: path of the URL. +* `values` - (Required, Set) Condition Value. + +The `normal_action` object supports the following: + +* `action` - (Required, String) Action name. +* `parameters` - (Required, List) Action parameters. + +The `parameters` object supports the following: + +* `action` - (Required, String) Action to take on the HEADER. +* `name` - (Required, String) Target HEADER name. +* `values` - (Required, Set) Parameter Value. + +The `parameters` object supports the following: + +* `name` - (Required, String) Parameter Name. +* `status_code` - (Required, Int) HTTP status code to use. +* `values` - (Required, Set) Parameter Values. + +The `parameters` object supports the following: + +* `name` - (Required, String) Parameter Name. +* `values` - (Required, Set) Parameter Values. + +The `rewrite_action` object supports the following: + +* `action` - (Required, String) Action name. +* `parameters` - (Required, List) Action parameters. + +The `rules` object supports the following: + +* `actions` - (Required, List) Actions list of the rule. See details in data source `rule_engine_setting`. +* `conditions` - (Required, List) OR Conditions list of the rule. Rule would be triggered if any of the condition is true. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `rule_id` - Rule ID. + + +## Import + +teo ruleEngine can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_rule_engine.rule_engine zoneId#ruleId +``` + diff --git a/website/docs/r/teo_security_policy.html.markdown b/website/docs/r/teo_security_policy.html.markdown new file mode 100644 index 0000000000..68ff3fc181 --- /dev/null +++ b/website/docs/r/teo_security_policy.html.markdown @@ -0,0 +1,312 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_security_policy" +sidebar_current: "docs-tencentcloud-resource-teo_security_policy" +description: |- + Provides a resource to create a teo securityPolicy +--- + +# tencentcloud_teo_security_policy + +Provides a resource to create a teo securityPolicy + +## Example Usage + +```hcl +resource "tencentcloud_teo_security_policy" "securityPolicy" { + zone_id = "" + entity = "" + config { + waf_config { + switch = "" + level = "" + mode = "" + waf_rules { + switch = "" + block_rule_ids = "" + observe_rule_ids = "" + } + ai_rule { + mode = "" + } + } + rate_limit_config { + switch = "" + user_rules { + rule_name = "" + threshold = "" + period = "" + action = "" + punish_time = "" + punish_time_unit = "" + rule_status = "" + freq_fields = "" + conditions { + match_from = "" + match_param = "" + operator = "" + match_content = "" + } + rule_priority = "" + } + template { + mode = "" + detail { + mode = "" + id = "" + action = "" + punish_time = "" + threshold = "" + period = "" + } + } + intelligence { + switch = "" + action = "" + } + } + acl_config { + switch = "" + user_rules { + rule_name = "" + action = "" + rule_status = "" + conditions { + match_from = "" + match_param = "" + operator = "" + match_content = "" + } + rule_priority = "" + punish_time = "" + punish_time_unit = "" + name = "" + page_id = "" + redirect_url = "" + response_code = "" + } + } + bot_config { + switch = "" + managed_rule { + rule_id = "" + action = "" + punish_time = "" + punish_time_unit = "" + name = "" + page_id = "" + redirect_url = "" + response_code = "" + trans_managed_ids = "" + alg_managed_ids = "" + cap_managed_ids = "" + mon_managed_ids = "" + drop_managed_ids = "" + } + portrait_rule { + rule_id = "" + alg_managed_ids = "" + cap_managed_ids = "" + mon_managed_ids = "" + drop_managed_ids = "" + switch = "" + } + intelligence_rule { + switch = "" + items { + label = "" + action = "" + } + } + } + switch_config { + web_switch = "" + } + ip_table_config { + switch = "" + rules { + action = "" + match_from = "" + match_content = "" + rule_id = "" + } + } + + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `config` - (Required, List) Security policy configuration. +* `entity` - (Required, String) Subdomain. +* `zone_id` - (Required, String) Site ID. + +The `acl_config` object supports the following: + +* `switch` - (Required, String) - on: Enable.- off: Disable. +* `user_rules` - (Required, List) Custom configuration. + +The `ai_rule` object supports the following: + +* `mode` - (Optional, String) Valid values:- smart_status_close: disabled.- smart_status_open: blocked.- smart_status_observe: observed. + +The `bot_config` object supports the following: + +* `intelligence_rule` - (Optional, List) Bot intelligent rule configuration. +* `managed_rule` - (Optional, List) Preset rules. +* `portrait_rule` - (Optional, List) Portrait rule. +* `switch` - (Optional, String) - on: Enable.- off: Disable. + +The `conditions` object supports the following: + +* `match_content` - (Required, String) Matching content. +* `match_from` - (Required, String) Matching field. +* `match_param` - (Required, String) Matching string. +* `operator` - (Required, String) Matching operator. + +The `config` object supports the following: + +* `acl_config` - (Optional, List) ACL configuration. +* `bot_config` - (Optional, List) Bot Configuration. +* `ip_table_config` - (Optional, List) Basic access control. +* `rate_limit_config` - (Optional, List) RateLimit Configuration. +* `switch_config` - (Optional, List) Main switch of 7-layer security. +* `waf_config` - (Optional, List) WAF (Web Application Firewall) Configuration. + +The `detail` object supports the following: + +* `action` - (Optional, String) Action to take. +* `id` - (Optional, Int) Template ID.Note: This field may return null, indicating that no valid value can be obtained. +* `mode` - (Optional, String) Template Name.Note: This field may return null, indicating that no valid value can be obtained. +* `period` - (Optional, Int) Period. +* `punish_time` - (Optional, Int) Punish time. +* `threshold` - (Optional, Int) Threshold. + +The `intelligence_rule` object supports the following: + +* `items` - (Optional, List) Configuration detail. +* `switch` - (Optional, String) - on: Enable.- off: Disable. + +The `intelligence` object supports the following: + +* `action` - (Optional, String) Action to take. Valid values: `monitor`, `alg`. +* `switch` - (Optional, String) - on: Enable.- off: Disable. + +The `ip_table_config` object supports the following: + +* `rules` - (Optional, List) Rules list. +* `switch` - (Optional, String) - on: Enable.- off: Disable. + +The `items` object supports the following: + +* `action` - (Optional, String) Action to take. Valid values: `trans`, `monitor`, `alg`, `captcha`, `drop`. +* `label` - (Optional, String) Bot label, valid values: `evil_bot`, `suspect_bot`, `good_bot`, `normal`. + +The `managed_rule` object supports the following: + +* `rule_id` - (Required, Int) Rule ID. +* `action` - (Optional, String) Action to take. Valid values: `drop`, `trans`, `monitor`, `alg`. +* `alg_managed_ids` - (Optional, Set) Rules to enable when action is `alg`. See details in data source `bot_managed_rules`. +* `cap_managed_ids` - (Optional, Set) Rules to enable when action is `captcha`. See details in data source `bot_managed_rules`. +* `drop_managed_ids` - (Optional, Set) Rules to enable when action is `drop`. See details in data source `bot_managed_rules`. +* `mon_managed_ids` - (Optional, Set) Rules to enable when action is `monitor`. See details in data source `bot_managed_rules`. +* `name` - (Optional, String) Name of the custom response page. +* `page_id` - (Optional, Int) ID of the custom response page. +* `punish_time_unit` - (Optional, String) Time unit of the punish time. +* `punish_time` - (Optional, Int) Punish time. +* `redirect_url` - (Optional, String) Redirect target URL, must be an sub-domain from one of the account's site. +* `response_code` - (Optional, Int) Response code to use when redirecting. +* `trans_managed_ids` - (Optional, Set) Rules to enable when action is `trans`. See details in data source `bot_managed_rules`. + +The `portrait_rule` object supports the following: + +* `alg_managed_ids` - (Optional, Set) Rules to enable when action is `alg`. See details in data source `bot_portrait_rules`. +* `cap_managed_ids` - (Optional, Set) Rules to enable when action is `captcha`. See details in data source `bot_portrait_rules`. +* `drop_managed_ids` - (Optional, Set) Rules to enable when action is `drop`. See details in data source `bot_portrait_rules`. +* `mon_managed_ids` - (Optional, Set) Rules to enable when action is `monitor`. See details in data source `bot_portrait_rules`. +* `rule_id` - (Optional, Int) Rule ID. +* `switch` - (Optional, String) - on: Enable.- off: Disable. + +The `rate_limit_config` object supports the following: + +* `switch` - (Required, String) - on: Enable.- off: Disable. +* `user_rules` - (Required, List) Custom configuration. +* `intelligence` - (Optional, List) Intelligent client filter. +* `template` - (Optional, List) Default Template.Note: This field may return null, indicating that no valid value can be obtained. + +The `rules` object supports the following: + +* `action` - (Optional, String) Actions to take. Valid values: `drop`, `trans`, `monitor`. +* `match_content` - (Optional, String) Matching content. +* `match_from` - (Optional, String) Matching type. Valid values: `ip`, `area`. +* `rule_id` - (Optional, Int) Rule ID. + +The `switch_config` object supports the following: + +* `web_switch` - (Optional, String) - on: Enable.- off: Disable. + +The `template` object supports the following: + +* `detail` - (Optional, List) Detail of the template. +* `mode` - (Optional, String) Template Name.Note: This field may return null, indicating that no valid value can be obtained. + +The `user_rules` object supports the following: + +* `action` - (Required, String) Action to take. Valid values: `trans`, `drop`, `monitor`, `ban`, `redirect`, `page`, `alg`. +* `conditions` - (Required, List) Conditions of the rule. +* `rule_name` - (Required, String) Rule name. +* `rule_priority` - (Required, Int) Priority of the rule. Valid value range: 0-100. +* `rule_status` - (Required, String) Status of the rule. +* `name` - (Optional, String) Name of the custom response page. +* `page_id` - (Optional, Int) ID of the custom response page. +* `punish_time_unit` - (Optional, String) Time unit of the punish time. Valid values: `second`, `minutes`, `hour`. +* `punish_time` - (Optional, Int) Punish time, Valid value range: 0-2 days. +* `redirect_url` - (Optional, String) Redirect target URL, must be an sub-domain from one of the account's site. +* `response_code` - (Optional, Int) Response code to use when redirecting. + +The `user_rules` object supports the following: + +* `action` - (Required, String) Valid values: `monitor`, `drop`. +* `conditions` - (Required, List) Conditions of the rule. +* `period` - (Required, Int) Period of the rate limit. Valid values: 10, 20, 30, 40, 50, 60 (in seconds). +* `punish_time_unit` - (Required, String) Time unit of the punish time. Valid values: `second`,`minutes`,`hour`. +* `punish_time` - (Required, Int) Punish time, Valid value range: 0-2 days. +* `rule_name` - (Required, String) Rule Name. +* `rule_priority` - (Required, Int) Priority of the rule. +* `rule_status` - (Required, String) Status of the rule. +* `threshold` - (Required, Int) Threshold of the rate limit. Valid value range: 0-4294967294. +* `freq_fields` - (Optional, Set) Filter words. + +The `waf_config` object supports the following: + +* `level` - (Required, String) Protection level. Valid values: `loose`, `normal`, `strict`, `stricter`, `custom`. +* `mode` - (Required, String) Protection mode. Valid values:- block: use block mode globally, you still can set a group of rules to use observe mode.- observe: use observe mode globally. +* `switch` - (Required, String) Whether to enable WAF rules. Valid values:- on: Enable.- off: Disable. +* `waf_rules` - (Required, List) WAF Rules Configuration. +* `ai_rule` - (Optional, List) AI based rules configuration. + +The `waf_rules` object supports the following: + +* `block_rule_ids` - (Required, Set) Block mode rules list. See details in data source `waf_managed_rules`. +* `switch` - (Required, String) Whether to host the rules' configuration.- on: Enable.- off: Disable. +* `observe_rule_ids` - (Optional, Set) Observe rules list. See details in data source `waf_managed_rules`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +teo securityPolicy can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_security_policy.securityPolicy securityPolicy_id#entity +``` + diff --git a/website/docs/r/teo_zone.html.markdown b/website/docs/r/teo_zone.html.markdown new file mode 100644 index 0000000000..39213a271f --- /dev/null +++ b/website/docs/r/teo_zone.html.markdown @@ -0,0 +1,71 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_zone" +sidebar_current: "docs-tencentcloud-resource-teo_zone" +description: |- + Provides a resource to create a teo zone +--- + +# tencentcloud_teo_zone + +Provides a resource to create a teo zone + +## Example Usage + +```hcl +resource "tencentcloud_teo_zone" "zone" { + name = "sfurnace.work" + plan_type = "ent_cm_with_bot" + type = "full" + paused = false + cname_speed_up = "enabled" + + # vanity_name_servers { + # switch = "on" + # servers = ["2.2.2.2"] + # } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required, String) Site name. +* `plan_type` - (Required, String) Plan type of the zone. See details in data source `zone_available_plans`. +* `cname_speed_up` - (Optional, String) Specifies whether to enable CNAME acceleration, enabled: Enable; disabled: Disable. +* `paused` - (Optional, Bool) Indicates whether the site is disabled. +* `tags` - (Optional, Map) Tag description list. +* `type` - (Optional, String) Specifies how the site is connected to EdgeOne. +* `vanity_name_servers` - (Optional, List) User-defined name server information. + +The `vanity_name_servers` object supports the following: + +* `switch` - (Required, String) Whether to enable the custom name server. +* `servers` - (Optional, Set) List of custom name servers. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `area` - Acceleration area of the zone. Valid values: `mainland`, `overseas`. +* `cname_status` - Ownership verification status of the site when it accesses via CNAME. +* `created_on` - Site creation date. +* `modified_on` - Site modification date. +* `name_servers` - List of name servers assigned to users by Tencent Cloud. +* `original_name_servers` - List of name servers used. +* `status` - Site status. +* `vanity_name_servers_ips` - User-defined name server IP information. + * `ipv4` - IPv4 address of the custom name server. + * `name` - Name of the custom name server. + + +## Import + +teo zone can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_zone.zone zone_id +``` + diff --git a/website/docs/r/teo_zone_setting.html.markdown b/website/docs/r/teo_zone_setting.html.markdown new file mode 100644 index 0000000000..53ba481227 --- /dev/null +++ b/website/docs/r/teo_zone_setting.html.markdown @@ -0,0 +1,247 @@ +--- +subcategory: "Teo" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_zone_setting" +sidebar_current: "docs-tencentcloud-resource-teo_zone_setting" +description: |- + Provides a resource to create a teo zone_setting +--- + +# tencentcloud_teo_zone_setting + +Provides a resource to create a teo zone_setting + +## Example Usage + +```hcl +resource "tencentcloud_teo_zone_setting" "zone_setting" { + zone_id = tencentcloud_teo_zone.zone.id + + cache { + follow_origin { + switch = "off" + } + + no_cache { + switch = "off" + } + } + + cache_key { + full_url_cache = "off" + ignore_case = "on" + + query_string { + action = "excludeCustom" + switch = "on" + value = ["test", "apple"] + } + } + + cache_prefresh { + percent = 90 + switch = "off" + } + + client_ip_header { + switch = "off" + } + + compression { + switch = "off" + } + + force_redirect { + redirect_status_code = 302 + switch = "on" + } + + https { + http2 = "on" + ocsp_stapling = "off" + tls_version = [ + "TLSv1.2", + "TLSv1.3", + ] + + hsts { + include_sub_domains = "off" + max_age = 0 + preload = "off" + switch = "off" + } + } + + max_age { + follow_origin = "off" + max_age_time = 600 + } + + offline_cache { + switch = "off" + } + + origin { + origin_pull_protocol = "follow" + } + + post_max_size { + max_size = 524288000 + switch = "on" + } + + quic { + switch = "on" + } + + smart_routing { + switch = "on" + } + + upstream_http2 { + switch = "off" + } + + web_socket { + switch = "off" + timeout = 30 + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `zone_id` - (Required, String) Site ID. +* `cache_key` - (Optional, List) Node cache key configuration. +* `cache_prefresh` - (Optional, List) Cache pre-refresh configuration. +* `cache` - (Optional, List) Cache expiration time configuration. +* `client_ip_header` - (Optional, List) Origin-pull client IP header configuration. +* `compression` - (Optional, List) Smart compression configuration. +* `force_redirect` - (Optional, List) Force HTTPS redirect configuration. +* `https` - (Optional, List) HTTPS acceleration configuration. +* `max_age` - (Optional, List) Browser cache configuration. +* `offline_cache` - (Optional, List) Offline cache configuration. +* `origin` - (Optional, List) Origin server configuration. +* `post_max_size` - (Optional, List) Maximum size of files transferred over POST request. +* `quic` - (Optional, List) QUIC access configuration. +* `smart_routing` - (Optional, List) Smart acceleration configuration. +* `upstream_http2` - (Optional, List) HTTP2 origin-pull configuration. +* `web_socket` - (Optional, List) WebSocket configuration. + +The `cache_key` object supports the following: + +* `full_url_cache` - (Optional, String) Specifies whether to enable full-path cache.- on: Enable full-path cache (i.e., disable Ignore Query String).- off: Disable full-path cache (i.e., enable Ignore Query String).Note: This field may return null, indicating that no valid value can be obtained. +* `ignore_case` - (Optional, String) Specifies whether the cache key is case-sensitive.Note: This field may return null, indicating that no valid value can be obtained. +* `query_string` - (Optional, List) Request parameter contained in CacheKey.Note: This field may return null, indicating that no valid value can be obtained. + +The `cache_prefresh` object supports the following: + +* `switch` - (Required, String) Specifies whether to enable cache prefresh.- on: Enable.- off: Disable. +* `percent` - (Optional, Int) Percentage of cache time before try to prefresh. Value range: 1-99. + +The `cache` object supports the following: + +* `cache_time` - (Optional, Int) Cache expiration time settings.Unit: second. The maximum value is 365 days.Note: This field may return null, indicating that no valid value can be obtained. +* `ignore_cache_control` - (Optional, String) Specifies whether to enable force cache.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained. +* `switch` - (Optional, String) Cache configuration switch.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained. + +The `cache` object supports the following: + +* `cache` - (Optional, List) Cache configuration.Note: This field may return null, indicating that no valid value can be obtained. +* `follow_origin` - (Optional, List) Follows the origin server configuration.Note: This field may return null, indicating that no valid value can be obtained. +* `no_cache` - (Optional, List) No-cache configuration.Note: This field may return null, indicating that no valid value can be obtained. + +The `client_ip_header` object supports the following: + +* `switch` - (Required, String) Specifies whether to enable client IP header.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained. +* `header_name` - (Optional, String) Name of the origin-pull client IP request header.Note: This field may return null, indicating that no valid value can be obtained. + +The `compression` object supports the following: + +* `switch` - (Required, String) Whether to enable Smart compression.- on: Enable.- off: Disable. + +The `follow_origin` object supports the following: + +* `switch` - (Required, String) According to the configuration switch of the origin site, the values are: on: open; off: off. + +The `force_redirect` object supports the following: + +* `switch` - (Required, String) Whether to enable force redirect.- on: Enable.- off: Disable. +* `redirect_status_code` - (Optional, Int) Redirection status code.- 301- 302Note: This field may return null, indicating that no valid value can be obtained. + +The `hsts` object supports the following: + +* `switch` - (Required, String) - on: Enable.- off: Disable. +* `include_sub_domains` - (Optional, String) Specifies whether to include subdomain names. Valid values: `on` and `off`.Note: This field may return null, indicating that no valid value can be obtained. +* `max_age` - (Optional, Int) MaxAge value.Note: This field may return null, indicating that no valid value can be obtained. +* `preload` - (Optional, String) Specifies whether to preload. Valid values: `on` and `off`.Note: This field may return null, indicating that no valid value can be obtained. + +The `https` object supports the following: + +* `hsts` - (Optional, List) HSTS Configuration.Note: This field may return null, indicating that no valid value can be obtained. +* `http2` - (Optional, String) HTTP2 configuration switch.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained. +* `ocsp_stapling` - (Optional, String) OCSP configuration switch.- on: Enable.- off: Disable.It is disabled by default. Note: This field may return null, indicating that no valid value can be obtained. +* `tls_version` - (Optional, Set) TLS version settings. Valid values: `TLSv1`, `TLSV1.1`, `TLSV1.2`, and `TLSv1.3`.Only consecutive versions can be enabled at the same time.Note: This field may return null, indicating that no valid value can be obtained. + +The `max_age` object supports the following: + +* `follow_origin` - (Optional, String) Specifies whether to follow the max cache age of the origin server.- on: Enable.- off: Disable.If it's on, MaxAgeTime is ignored.Note: This field may return null, indicating that no valid value can be obtained. +* `max_age_time` - (Optional, Int) Specifies the max age of the cache (in seconds). The maximum value is 365 days.Note: the value 0 means not to cache.Note: This field may return null, indicating that no valid value can be obtained. + +The `no_cache` object supports the following: + +* `switch` - (Optional, String) Whether to cache the configuration.- on: Do not cache.- off: Cache.Note: This field may return null, indicating that no valid value can be obtained. + +The `offline_cache` object supports the following: + +* `switch` - (Required, String) Whether to enable offline cache.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained. + +The `origin` object supports the following: + +* `origin_pull_protocol` - (Optional, String) Origin-pull protocol.- http: Switch HTTPS requests to HTTP.- follow: Follow the protocol of the request.- https: Switch HTTP requests to HTTPS. This only supports port 443 on the origin server.Note: This field may return null, indicating that no valid value can be obtained. + +The `post_max_size` object supports the following: + +* `switch` - (Required, String) Specifies whether to enable custom setting of the maximum file size.- on: Enable. You can set a custom max size.- off: Disable. In this case, the max size defaults to 32 MB. +* `max_size` - (Optional, Int) Maximum size. Value range: 1-500 MB.Note: This field may return null, indicating that no valid value can be obtained. + +The `query_string` object supports the following: + +* `switch` - (Required, String) Whether to use QueryString as part of CacheKey.- on: Enable.- off: Disable.Note: This field may return null, indicating that no valid value can be obtained. +* `action` - (Optional, String) - includeCustom: Include the specified query strings.- excludeCustom: Exclude the specified query strings.Note: This field may return null, indicating that no valid value can be obtained. +* `value` - (Optional, Set) Array of query strings used/excluded.Note: This field may return null, indicating that no valid value can be obtained. + +The `quic` object supports the following: + +* `switch` - (Required, String) Whether to enable QUIC.- on: Enable.- off: Disable. + +The `smart_routing` object supports the following: + +* `switch` - (Required, String) Whether to enable smart acceleration.- on: Enable.- off: Disable. + +The `upstream_http2` object supports the following: + +* `switch` - (Required, String) Whether to enable HTTP2 origin-pull.- on: Enable.- off: Disable. + +The `web_socket` object supports the following: + +* `switch` - (Required, String) Whether to enable custom WebSocket timeout setting. When it's off: it means to keep the default WebSocket connection timeout period, which is 15 seconds. To change the timeout period, please set it to on. +* `timeout` - (Optional, Int) Sets timeout period in seconds. Maximum value: 120. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +teo zone_setting can be imported using the id, e.g. +``` +$ terraform import tencentcloud_teo_zone_setting.zone_setting zone_id +``` + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index a304f09396..6f1465d50f 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -1488,16 +1488,16 @@ Resources @@ -1659,6 +1659,57 @@ +
  • + Teo + +
  • VPN