diff --git a/go.mod b/go.mod index 8aee59d124..34804f678d 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1107 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1148 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1196 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1203 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1153 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1161 @@ -90,7 +90,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdcpg v1.0.533 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.955 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.578 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1182 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1203 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1196 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/trocket v1.0.947 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tse v1.0.857 diff --git a/go.sum b/go.sum index 7b02307c36..2b827b4833 100644 --- a/go.sum +++ b/go.sum @@ -991,6 +991,10 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1191 h1:Zj8 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1191/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1196 h1:2pRWolqipwF5RBtpSKp9YAg9cIvIPnhFCkj5FFhv8V8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1196/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1198 h1:lIVEEZ1zvhmetBu+A00DTkqv5wWnv1TpiOTG7nHU3vU= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1198/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1203 h1:Hn+SxpWbByY3UaKAf6Os97itkEQ8n9g9KOxYFsY4FBg= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1203/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU= @@ -1115,6 +1119,10 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1129 h1:9zrLWq github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1129/go.mod h1:Upcwa9By8gGR8qNLEiAetIKGbe4LmZbtXw0muPWXYc8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1182 h1:usJ5oGRWXkOufePi9JRP+kz5s0lTKUazpLDJJzVaJrQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1182/go.mod h1:lR5rdTT9V5RO9c0hXlFqO0o/bHdxn+R1+JMnWILzne0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1198 h1:XFQb2+gH2OghSKwc+PlXLVOM8soqtGw6Hbu4HG5RlHs= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1198/go.mod h1:G2tzJ6atg+3Cti3pmcoOBMaoccgF4ZrZn1KGQDffkwk= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1203 h1:oEpdN03XuHqqw1OaJ9DQVr8Npv56nq1RfNvB6zVanoc= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1203/go.mod h1:/tuR/74u27UEv+a36Y1x1Zdgf2WqixNq+/1wfC0QQQc= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998 h1:f4/n0dVKQTD06xJ84B5asHViNJHrZmGojdAWEPIsITM= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998/go.mod h1:fyi/HUwCwVe2NCCCjz8k/C5GwPu3QazCZO+OBJ3MhLk= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1038 h1:tmK0aSj8zJrTx7aubJR8DBvtySj1uO8UdFANUDFtbmo= diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 788b06e34d..a5c5cc02f7 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -1891,6 +1891,7 @@ func Provider() *schema.Provider { "tencentcloud_teo_dns_record": teo.ResourceTencentCloudTeoDnsRecord(), "tencentcloud_teo_bind_security_template": teo.ResourceTencentCloudTeoBindSecurityTemplate(), "tencentcloud_teo_plan": teo.ResourceTencentCloudTeoPlan(), + "tencentcloud_teo_origin_acl": teo.ResourceTencentCloudTeoOriginAcl(), "tencentcloud_tcm_mesh": tcm.ResourceTencentCloudTcmMesh(), "tencentcloud_tcm_cluster_attachment": tcm.ResourceTencentCloudTcmClusterAttachment(), "tencentcloud_tcm_prometheus_attachment": tcm.ResourceTencentCloudTcmPrometheusAttachment(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index 731dc8e6d8..2cbbd27a3d 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -1513,6 +1513,7 @@ tencentcloud_teo_security_ip_group tencentcloud_teo_security_policy_config tencentcloud_teo_dns_record tencentcloud_teo_bind_security_template +tencentcloud_teo_origin_acl TencentCloud ServiceMesh(TCM) Data Source diff --git a/tencentcloud/services/teo/resource_tc_teo_origin_acl.go b/tencentcloud/services/teo/resource_tc_teo_origin_acl.go new file mode 100644 index 0000000000..3491ad96ac --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_origin_acl.go @@ -0,0 +1,385 @@ +package teo + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + teov20220901 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudTeoOriginAcl() *schema.Resource { + return &schema.Resource{ + Create: ResourceTencentCloudTeoOriginAclCreate, + Read: ResourceTencentCloudTeoOriginAclRead, + Update: ResourceTencentCloudTeoOriginAclUpdate, + Delete: ResourceTencentCloudTeoOriginAclDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(30 * time.Minute), + Update: schema.DefaultTimeout(30 * time.Minute), + Delete: schema.DefaultTimeout(30 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Specifies the site ID.", + }, + + "l7_enable_mode": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: tccommon.ValidateAllowedStringValue([]string{"all", "specific"}), + Description: "The mode of configurating origin ACLs for L7 acceleration domains. - all: configurate origin ACLs for all L7 acceleration domains under the site. - specific: configurate origin ACLs for designated L7 acceleration domains under the site. When the parameter is empty, it defaults to specific.", + }, + + "l7_hosts": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The list of L7 acceleration domains that require enabling the origin ACLs. This list must be empty when the request parameter L7EnableMode is set to 'all'.", + }, + + "l4_enable_mode": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: tccommon.ValidateAllowedStringValue([]string{"all", "specific"}), + Description: "The mode of configurating origin ACLs for L4 proxy Instances. - all: configurate origin ACLs for all L4 proxy Instances under the site. - specific: configurate origin ACLs for designated L4 proxy Instances under the site. When the parameter is empty, it defaults to specific.", + }, + + "l4_proxy_ids": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "he list of L4 proxy Instances that require enabling origin ACLs. This list must be empty when the request parameter L4EnableMode is set to 'all'.", + }, + }, + } +} + +func ResourceTencentCloudTeoOriginAclCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_origin_acl.create")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + request = teov20220901.NewEnableOriginACLRequest() + zoneId string + ) + + if v, ok := d.GetOk("zone_id"); ok { + request.ZoneId = helper.String(v.(string)) + zoneId = v.(string) + } + + if v, ok := d.GetOk("l7_enable_mode"); ok { + request.L7EnableMode = helper.String(v.(string)) + } + + tmpL7Hosts := make([]interface{}, 0) + tmpL4ProxyIds := make([]interface{}, 0) + if v, ok := d.GetOk("l7_hosts"); ok { + l7Hosts := v.(*schema.Set).List() + if len(l7Hosts) > 200 { + l7Hosts = v.(*schema.Set).List()[:2] + tmpL7Hosts = v.(*schema.Set).List()[2:] + } + + for i := range l7Hosts { + if v, ok := l7Hosts[i].(string); ok && v != "" { + l7Host := l7Hosts[i].(string) + request.L7Hosts = append(request.L7Hosts, &l7Host) + } + } + } + + if v, ok := d.GetOk("l4_enable_mode"); ok { + request.L4EnableMode = helper.String(v.(string)) + } + + if v, ok := d.GetOk("l4_proxy_ids"); ok { + l4ProxyIds := v.(*schema.Set).List() + if len(l4ProxyIds) > 100 { + l4ProxyIds = v.(*schema.Set).List()[:1] + tmpL4ProxyIds = v.(*schema.Set).List()[1:] + } + + for i := range l4ProxyIds { + if v, ok := l4ProxyIds[i].(string); ok && v != "" { + l4ProxyId := l4ProxyIds[i].(string) + request.L4ProxyIds = append(request.L4ProxyIds, &l4ProxyId) + } + } + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().EnableOriginACLWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Enable teo origin acl failed, Response is nil.")) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s enable teo origin acl failed, reason:%+v", logId, err) + return err + } + + // wait + err = service.WaitTeoOriginACLById(ctx, d.Timeout(schema.TimeoutCreate), zoneId, "online") + if err != nil { + return err + } + + if len(tmpL7Hosts) > 0 || len(tmpL4ProxyIds) > 0 { + request := teov20220901.NewModifyOriginACLRequest() + request.ZoneId = &zoneId + if len(tmpL7Hosts) > 0 { + request.OriginACLEntities = append(request.OriginACLEntities, &teov20220901.OriginACLEntity{ + Type: helper.String("l7"), + Instances: helper.InterfacesStringsPoint(tmpL7Hosts), + OperationMode: helper.String("enable"), + }) + } + + if len(tmpL4ProxyIds) > 0 { + request.OriginACLEntities = append(request.OriginACLEntities, &teov20220901.OriginACLEntity{ + Type: helper.String("l4"), + Instances: helper.InterfacesStringsPoint(tmpL4ProxyIds), + OperationMode: helper.String("enable"), + }) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().ModifyOriginACLWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Modify teo origin acl failed, Response is nil.")) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s modify teo origin acl failed, reason:%+v", logId, err) + return err + } + + // wait + err = service.WaitTeoOriginACLById(ctx, d.Timeout(schema.TimeoutCreate), zoneId, "online") + if err != nil { + return err + } + } + + d.SetId(zoneId) + return ResourceTencentCloudTeoOriginAclRead(d, meta) +} + +func ResourceTencentCloudTeoOriginAclRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_origin_acl.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + zoneId = d.Id() + ) + + respData, err := service.DescribeTeoOriginACLById(ctx, zoneId) + if err != nil { + return err + } + + if respData == nil { + log.Printf("[WARN]%s resource `tencentcloud_teo_origin_acl` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + d.SetId("") + return nil + } + + _ = d.Set("zone_id", zoneId) + + if respData.L7Hosts != nil { + tmpList := make([]string, 0, len(respData.L7Hosts)) + for _, item := range respData.L7Hosts { + tmpList = append(tmpList, *item) + } + + _ = d.Set("l7_hosts", tmpList) + } + + if respData.L4ProxyIds != nil { + tmpList := make([]string, 0, len(respData.L4ProxyIds)) + for _, item := range respData.L4ProxyIds { + tmpList = append(tmpList, *item) + } + + _ = d.Set("l4_proxy_ids", tmpList) + } + + return nil +} + +func ResourceTencentCloudTeoOriginAclUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_origin_acl.update")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + zoneId = d.Id() + l7List, l4List []*teov20220901.OriginACLEntity + ) + + if d.HasChange("l7_hosts") { + o, n := d.GetChange("l7_hosts") + os := o.(*schema.Set) + ns := n.(*schema.Set) + add := ns.Difference(os).List() + remove := os.Difference(ns).List() + if len(add) > 0 { + l7List = append(l7List, &teov20220901.OriginACLEntity{ + Type: helper.String("l7"), + Instances: helper.InterfacesStringsPoint(add), + OperationMode: helper.String("enable"), + }) + } + + if len(remove) > 0 { + l7List = append(l7List, &teov20220901.OriginACLEntity{ + Type: helper.String("l7"), + Instances: helper.InterfacesStringsPoint(remove), + OperationMode: helper.String("disable"), + }) + } + } + + if d.HasChange("l4_proxy_ids") { + o, n := d.GetChange("l4_proxy_ids") + os := o.(*schema.Set) + ns := n.(*schema.Set) + add := ns.Difference(os).List() + remove := os.Difference(ns).List() + if len(add) > 0 { + l4List = append(l4List, &teov20220901.OriginACLEntity{ + Type: helper.String("l4"), + Instances: helper.InterfacesStringsPoint(add), + OperationMode: helper.String("enable"), + }) + } + + if len(remove) > 0 { + l4List = append(l4List, &teov20220901.OriginACLEntity{ + Type: helper.String("l4"), + Instances: helper.InterfacesStringsPoint(remove), + OperationMode: helper.String("disable"), + }) + } + } + + if len(l7List) > 0 || len(l4List) > 0 { + request := teov20220901.NewModifyOriginACLRequest() + request.ZoneId = &zoneId + if len(l7List) > 0 { + request.OriginACLEntities = append(request.OriginACLEntities, l7List...) + } + + if len(l4List) > 0 { + request.OriginACLEntities = append(request.OriginACLEntities, l4List...) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().ModifyOriginACLWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Modify teo origin acl failed, Response is nil.")) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s modify teo origin acl failed, reason:%+v", logId, err) + return err + } + + // wait + err = service.WaitTeoOriginACLById(ctx, d.Timeout(schema.TimeoutUpdate), zoneId, "online") + if err != nil { + return err + } + } + + return ResourceTencentCloudTeoOriginAclRead(d, meta) +} + +func ResourceTencentCloudTeoOriginAclDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_origin_acl.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + service = TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + request = teov20220901.NewDisableOriginACLRequest() + zoneId = d.Id() + ) + + request.ZoneId = &zoneId + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().DisableOriginACLWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s delete teo origin acl failed, reason:%+v", logId, err) + return err + } + + // wait + err = service.WaitTeoOriginACLById(ctx, d.Timeout(schema.TimeoutDelete), zoneId, "offline") + if err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/services/teo/resource_tc_teo_origin_acl.md b/tencentcloud/services/teo/resource_tc_teo_origin_acl.md new file mode 100644 index 0000000000..451c63552b --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_origin_acl.md @@ -0,0 +1,37 @@ +Provides a resource to create a TEO origin acl + +Example Usage + +```hcl +resource "tencentcloud_teo_origin_acl" "example" { + zone_id = "zone-39quuimqg8r6" + l7_enable_mode = "specific" + l7_hosts = [ + "example1.com", + "example2.com", + "example3.com", + ] + + l4_enable_mode = "specific" + l4_proxy_ids = [ + "sid-3dwf5252ravl", + "sid-3dwfxzt8ed3l", + "sid-3dwfy5mpwnk4", + "sid-3dwfyaj6qeys", + ] + + timeouts { + create = "30m" + update = "30m" + delete = "30m" + } +} +``` + +Import + +TEO origin acl can be imported using the zone_id, e.g. + +```` +terraform import tencentcloud_teo_origin_acl.example zone-39quuimqg8r6 +```` diff --git a/tencentcloud/services/teo/service_tencentcloud_teo.go b/tencentcloud/services/teo/service_tencentcloud_teo.go index 988746c884..89b94f7483 100644 --- a/tencentcloud/services/teo/service_tencentcloud_teo.go +++ b/tencentcloud/services/teo/service_tencentcloud_teo.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "strings" + "time" tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" @@ -1971,3 +1972,73 @@ func (me *TeoService) DescribeTeoPlansByFilters(ctx context.Context, paramMap ma return } + +func (me *TeoService) WaitTeoOriginACLById(ctx context.Context, timeout time.Duration, zoneId, status string) (errRet error) { + logId := tccommon.GetLogId(ctx) + request := teo.NewDescribeOriginACLRequest() + request.ZoneId = &zoneId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + errRet = resource.Retry(timeout, func() *resource.RetryError { + result, e := me.client.UseTeoClient().DescribeOriginACLWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + if result == nil || result.Response == nil || result.Response.OriginACLInfo == nil || result.Response.OriginACLInfo.Status == nil { + return resource.NonRetryableError(fmt.Errorf("Describe teo origin acl failed, Response is nil.")) + } + + if *result.Response.OriginACLInfo.Status == status { + return nil + } + + return resource.RetryableError(fmt.Errorf("TEO zone %s origin acl is still %s. Please contact TEO for assistance.", zoneId, *result.Response.OriginACLInfo.Status)) + }) + + return +} + +func (me *TeoService) DescribeTeoOriginACLById(ctx context.Context, zoneId string) (originACLInfo *teo.OriginACLInfo, errRet error) { + logId := tccommon.GetLogId(ctx) + request := teo.NewDescribeOriginACLRequest() + response := teo.NewDescribeOriginACLResponse() + request.ZoneId = &zoneId + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + errRet = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := me.client.UseTeoClient().DescribeOriginACLWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Describe teo origin acl failed, Response is nil.")) + } + + response = result + return nil + }) + + if errRet != nil { + log.Printf("[CRITAL]%s describe teo origin acl failed, reason:%+v", logId, errRet) + return + } + + originACLInfo = response.Response.OriginACLInfo + return +} 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 50786de631..6e7efe1e0c 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, requestClient string) params["Action"] = request.GetAction() params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) params["Nonce"] = strconv.Itoa(rand.Int()) - params["RequestClient"] = "SDK_GO_1.0.1196" + params["RequestClient"] = "SDK_GO_1.0.1203" if requestClient != "" { params["RequestClient"] += ": " + requestClient } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/client.go index 7fb3eee886..f655e86d3f 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// Copyright (c) 2017-2025 Tencent. 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. @@ -275,6 +275,63 @@ func (c *Client) CheckCnameStatusWithContext(ctx context.Context, request *Check return } +func NewConfirmOriginACLUpdateRequest() (request *ConfirmOriginACLUpdateRequest) { + request = &ConfirmOriginACLUpdateRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ConfirmOriginACLUpdate") + + + return +} + +func NewConfirmOriginACLUpdateResponse() (response *ConfirmOriginACLUpdateResponse) { + response = &ConfirmOriginACLUpdateResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ConfirmOriginACLUpdate +// 本接口用于回源 IP 网段发生变更时,确认已将最新回源 IP 网段更新至源站防火墙。确认已更新至最新的回源 IP 网段后,相关变更通知将会停止推送。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_LATESTVERSIONNOW = "OperationDenied.LatestVersionNow" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) ConfirmOriginACLUpdate(request *ConfirmOriginACLUpdateRequest) (response *ConfirmOriginACLUpdateResponse, err error) { + return c.ConfirmOriginACLUpdateWithContext(context.Background(), request) +} + +// ConfirmOriginACLUpdate +// 本接口用于回源 IP 网段发生变更时,确认已将最新回源 IP 网段更新至源站防火墙。确认已更新至最新的回源 IP 网段后,相关变更通知将会停止推送。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_LATESTVERSIONNOW = "OperationDenied.LatestVersionNow" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +func (c *Client) ConfirmOriginACLUpdateWithContext(ctx context.Context, request *ConfirmOriginACLUpdateRequest) (response *ConfirmOriginACLUpdateResponse, err error) { + if request == nil { + request = NewConfirmOriginACLUpdateRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ConfirmOriginACLUpdate require credential") + } + + request.SetContext(ctx) + + response = NewConfirmOriginACLUpdateResponse() + err = c.Send(request, response) + return +} + func NewCreateAccelerationDomainRequest() (request *CreateAccelerationDomainRequest) { request = &CreateAccelerationDomainRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -5332,6 +5389,63 @@ func (c *Client) DescribeLoadBalancerListWithContext(ctx context.Context, reques return } +func NewDescribeOriginACLRequest() (request *DescribeOriginACLRequest) { + request = &DescribeOriginACLRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeOriginACL") + + + return +} + +func NewDescribeOriginACLResponse() (response *DescribeOriginACLResponse) { + response = &DescribeOriginACLResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeOriginACL +// 本接口用于查询站点下的七层加速域名/四层代理实例与回源 IP 网段的绑定关系,以及回源 IP 网段详情。如果您想通过自动化脚本定期获取回源 IP 网段的最新版本,可以较低频率(建议每三天一次)轮询本接口,若 NextOriginACL 字段有返回值,则将最新的回源 IP 网段同步到源站防火墙配置中。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +// UNAUTHORIZEDOPERATION_UNKNOWN = "UnauthorizedOperation.Unknown" +func (c *Client) DescribeOriginACL(request *DescribeOriginACLRequest) (response *DescribeOriginACLResponse, err error) { + return c.DescribeOriginACLWithContext(context.Background(), request) +} + +// DescribeOriginACL +// 本接口用于查询站点下的七层加速域名/四层代理实例与回源 IP 网段的绑定关系,以及回源 IP 网段详情。如果您想通过自动化脚本定期获取回源 IP 网段的最新版本,可以较低频率(建议每三天一次)轮询本接口,若 NextOriginACL 字段有返回值,则将最新的回源 IP 网段同步到源站防火墙配置中。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +// UNAUTHORIZEDOPERATION_NOPERMISSION = "UnauthorizedOperation.NoPermission" +// UNAUTHORIZEDOPERATION_UNKNOWN = "UnauthorizedOperation.Unknown" +func (c *Client) DescribeOriginACLWithContext(ctx context.Context, request *DescribeOriginACLRequest) (response *DescribeOriginACLResponse, err error) { + if request == nil { + request = NewDescribeOriginACLRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeOriginACL require credential") + } + + request.SetContext(ctx) + + response = NewDescribeOriginACLResponse() + err = c.Send(request, response) + return +} + func NewDescribeOriginGroupRequest() (request *DescribeOriginGroupRequest) { request = &DescribeOriginGroupRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -5458,7 +5572,11 @@ func NewDescribeOriginProtectionResponse() (response *DescribeOriginProtectionRe } // DescribeOriginProtection -// 查询源站防护信息 +// 本接口为旧版本查询源站防护接口,EdgeOne 于 2025 年 6 月 27 日已对源站防护相关接口全面升级,新版本查询源站防护接口详情请参考 [DescribeOriginACL](https://cloud.tencent.com/document/product/1552/120408)。 +// +// +// +//
注意:自 2025 年 6 月 27 日起,旧版接口停止更新迭代,后续新增功能将仅在新版接口中提供。为避免在使用旧版接口时出现数据字段冲突,建议您尽早迁移到新版源站防护接口。
// // 可能返回的错误码: // INTERNALERROR = "InternalError" @@ -5471,7 +5589,11 @@ func (c *Client) DescribeOriginProtection(request *DescribeOriginProtectionReque } // DescribeOriginProtection -// 查询源站防护信息 +// 本接口为旧版本查询源站防护接口,EdgeOne 于 2025 年 6 月 27 日已对源站防护相关接口全面升级,新版本查询源站防护接口详情请参考 [DescribeOriginACL](https://cloud.tencent.com/document/product/1552/120408)。 +// +// +// +//注意:自 2025 年 6 月 27 日起,旧版接口停止更新迭代,后续新增功能将仅在新版接口中提供。为避免在使用旧版接口时出现数据字段冲突,建议您尽早迁移到新版源站防护接口。
// // 可能返回的错误码: // INTERNALERROR = "InternalError" @@ -5896,7 +6018,7 @@ func NewDescribeSecurityIPGroupResponse() (response *DescribeSecurityIPGroupResp } // DescribeSecurityIPGroup -// 查询安全 IP 组的配置信息,包括安全 IP 组的 ID、名称和内容。 +// 查询安全 IP 组的配置信息,包括安全 IP 组的 ID、名称和内容。本接口的查询结果中,每个 IP 组最多只返回 2000 个 IP / 网段。如果存在超过 2000 个 IP / 网段的超大 IP 组,请调用 DescribeSecurityIPGroupContent 进行分页查询。 // // 可能返回的错误码: // INTERNALERROR_ROUTEERROR = "InternalError.RouteError" @@ -5907,7 +6029,7 @@ func (c *Client) DescribeSecurityIPGroup(request *DescribeSecurityIPGroupRequest } // DescribeSecurityIPGroup -// 查询安全 IP 组的配置信息,包括安全 IP 组的 ID、名称和内容。 +// 查询安全 IP 组的配置信息,包括安全 IP 组的 ID、名称和内容。本接口的查询结果中,每个 IP 组最多只返回 2000 个 IP / 网段。如果存在超过 2000 个 IP / 网段的超大 IP 组,请调用 DescribeSecurityIPGroupContent 进行分页查询。 // // 可能返回的错误码: // INTERNALERROR_ROUTEERROR = "InternalError.RouteError" @@ -6667,6 +6789,61 @@ func (c *Client) DestroyPlanWithContext(ctx context.Context, request *DestroyPla return } +func NewDisableOriginACLRequest() (request *DisableOriginACLRequest) { + request = &DisableOriginACLRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DisableOriginACL") + + + return +} + +func NewDisableOriginACLResponse() (response *DisableOriginACLResponse) { + response = &DisableOriginACLResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DisableOriginACL +// 本接口用于关闭站点的源站防护功能。停用后,相关资源不再仅使用「源站防护」提供的回源 IP 网段请求您的源站,同时停止发送回源 IP 网段更新通知。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DisableOriginACL(request *DisableOriginACLRequest) (response *DisableOriginACLResponse, err error) { + return c.DisableOriginACLWithContext(context.Background(), request) +} + +// DisableOriginACL +// 本接口用于关闭站点的源站防护功能。停用后,相关资源不再仅使用「源站防护」提供的回源 IP 网段请求您的源站,同时停止发送回源 IP 网段更新通知。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// OPERATIONDENIED = "OperationDenied" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) DisableOriginACLWithContext(ctx context.Context, request *DisableOriginACLRequest) (response *DisableOriginACLResponse, err error) { + if request == nil { + request = NewDisableOriginACLRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DisableOriginACL require credential") + } + + request.SetContext(ctx) + + response = NewDisableOriginACLResponse() + err = c.Send(request, response) + return +} + func NewDownloadL4LogsRequest() (request *DownloadL4LogsRequest) { request = &DownloadL4LogsRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -6769,6 +6946,87 @@ func (c *Client) DownloadL7LogsWithContext(ctx context.Context, request *Downloa return } +func NewEnableOriginACLRequest() (request *EnableOriginACLRequest) { + request = &EnableOriginACLRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "EnableOriginACL") + + + return +} + +func NewEnableOriginACLResponse() (response *EnableOriginACLResponse) { + response = &EnableOriginACLResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// EnableOriginACL +// 本接口用于站点首次开启源站防护,启用后 EdgeOne 将会使用特定的回源 IP 网段为七层加速域名/四层代理实例回源。单次支持提交的七层加速域名的数量最大为 200,四层代理实例的数量最大为 100,支持七层加速域名/四层代理实例混合提交,总实例个数最大为 200。如需要启用超过 200 个资源,可先通过指定资源的方式以最大数量启用,剩余资源通过 ModifyOriginACL 接口启用。后续新增七层加速域名/四层代理实例均请通过 ModifyOriginACL 接口配置。 +// +// +// +// 注意: +// +// - 调用本接口视为同意 [源站防护启用特别约定](https://cloud.tencent.com/document/product/1552/120141); +// +// - 回源 IP 网段会不定期变更,EdgeOne 将在回源 IP 网段变更前 14 天、前 7 天、前 3 天和前 1 天分别通过站内信、短信、邮件等一种或多种方式发起通知,为了能正常收到回源 IP 网段的变更通知,请务必确保您在 [腾讯云消息中心控制台](https://console.cloud.tencent.com/message)内,已勾选边缘安全加速平台 EO 的产品服务相关消息通知,并配置正确的消息接收人。配置方式请参考 [消息订阅管理](https://cloud.tencent.com/document/product/567/43476)。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" +// INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" +// OPERATIONDENIED_VERSIONCONTROLISGRAYING = "OperationDenied.VersionControlIsGraying" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) EnableOriginACL(request *EnableOriginACLRequest) (response *EnableOriginACLResponse, err error) { + return c.EnableOriginACLWithContext(context.Background(), request) +} + +// EnableOriginACL +// 本接口用于站点首次开启源站防护,启用后 EdgeOne 将会使用特定的回源 IP 网段为七层加速域名/四层代理实例回源。单次支持提交的七层加速域名的数量最大为 200,四层代理实例的数量最大为 100,支持七层加速域名/四层代理实例混合提交,总实例个数最大为 200。如需要启用超过 200 个资源,可先通过指定资源的方式以最大数量启用,剩余资源通过 ModifyOriginACL 接口启用。后续新增七层加速域名/四层代理实例均请通过 ModifyOriginACL 接口配置。 +// +// +// +// 注意: +// +// - 调用本接口视为同意 [源站防护启用特别约定](https://cloud.tencent.com/document/product/1552/120141); +// +// - 回源 IP 网段会不定期变更,EdgeOne 将在回源 IP 网段变更前 14 天、前 7 天、前 3 天和前 1 天分别通过站内信、短信、邮件等一种或多种方式发起通知,为了能正常收到回源 IP 网段的变更通知,请务必确保您在 [腾讯云消息中心控制台](https://console.cloud.tencent.com/message)内,已勾选边缘安全加速平台 EO 的产品服务相关消息通知,并配置正确的消息接收人。配置方式请参考 [消息订阅管理](https://cloud.tencent.com/document/product/567/43476)。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" +// INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" +// OPERATIONDENIED_VERSIONCONTROLISGRAYING = "OperationDenied.VersionControlIsGraying" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) EnableOriginACLWithContext(ctx context.Context, request *EnableOriginACLRequest) (response *EnableOriginACLResponse, err error) { + if request == nil { + request = NewEnableOriginACLRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("EnableOriginACL require credential") + } + + request.SetContext(ctx) + + response = NewEnableOriginACLResponse() + err = c.Send(request, response) + return +} + func NewExportZoneConfigRequest() (request *ExportZoneConfigRequest) { request = &ExportZoneConfigRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -6792,8 +7050,14 @@ func NewExportZoneConfigResponse() (response *ExportZoneConfigResponse) { // 导出站点配置接口,本接口支持用户根据需要的配置项进行配置导出,导出的配置用于导入站点配置接口(ImportZoneConfig)进行配置导入。该功能仅支持标准版和企业版套餐站点使用。 // // 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" +// INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" // OPERATIONDENIED = "OperationDenied" -// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" +// OPERATIONDENIED_VERSIONCONTROLISGRAYING = "OperationDenied.VersionControlIsGraying" // UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" func (c *Client) ExportZoneConfig(request *ExportZoneConfigRequest) (response *ExportZoneConfigResponse, err error) { return c.ExportZoneConfigWithContext(context.Background(), request) @@ -6803,8 +7067,14 @@ func (c *Client) ExportZoneConfig(request *ExportZoneConfigRequest) (response *E // 导出站点配置接口,本接口支持用户根据需要的配置项进行配置导出,导出的配置用于导入站点配置接口(ImportZoneConfig)进行配置导入。该功能仅支持标准版和企业版套餐站点使用。 // // 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" +// INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" // OPERATIONDENIED = "OperationDenied" -// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" +// OPERATIONDENIED_VERSIONCONTROLISGRAYING = "OperationDenied.VersionControlIsGraying" // UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" func (c *Client) ExportZoneConfigWithContext(ctx context.Context, request *ExportZoneConfigRequest) (response *ExportZoneConfigResponse, err error) { if request == nil { @@ -8920,6 +9190,67 @@ func (c *Client) ModifyLoadBalancerWithContext(ctx context.Context, request *Mod return } +func NewModifyOriginACLRequest() (request *ModifyOriginACLRequest) { + request = &ModifyOriginACLRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyOriginACL") + + + return +} + +func NewModifyOriginACLResponse() (response *ModifyOriginACLResponse) { + response = &ModifyOriginACLResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyOriginACL +// 本接口用于对七层加速域名/四层代理实例启用/关闭特定回源 IP 网段回源。单次支持提交的七层加速域名的数量最大为 200,四层代理实例的数量最大为 100,支持七层加速域名/四层代理实例混合提交,总实例个数最大为 200。如需变更超过 200 个实例,请通过本接口分批提交。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" +// INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" +// OPERATIONDENIED_UPDATEIPWHITELISTFIRST = "OperationDenied.UpdateIPWhitelistFirst" +func (c *Client) ModifyOriginACL(request *ModifyOriginACLRequest) (response *ModifyOriginACLResponse, err error) { + return c.ModifyOriginACLWithContext(context.Background(), request) +} + +// ModifyOriginACL +// 本接口用于对七层加速域名/四层代理实例启用/关闭特定回源 IP 网段回源。单次支持提交的七层加速域名的数量最大为 200,四层代理实例的数量最大为 100,支持七层加速域名/四层代理实例混合提交,总实例个数最大为 200。如需变更超过 200 个实例,请通过本接口分批提交。 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" +// INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" +// OPERATIONDENIED = "OperationDenied" +// OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" +// OPERATIONDENIED_UPDATEIPWHITELISTFIRST = "OperationDenied.UpdateIPWhitelistFirst" +func (c *Client) ModifyOriginACLWithContext(ctx context.Context, request *ModifyOriginACLRequest) (response *ModifyOriginACLResponse, err error) { + if request == nil { + request = NewModifyOriginACLRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyOriginACL require credential") + } + + request.SetContext(ctx) + + response = NewModifyOriginACLResponse() + err = c.Send(request, response) + return +} + func NewModifyOriginGroupRequest() (request *ModifyOriginGroupRequest) { request = &ModifyOriginGroupRequest{ BaseRequest: &tchttp.BaseRequest{}, diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/errors.go index 9529e789b4..1fb8c343b0 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/errors.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/errors.go @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// Copyright (c) 2017-2025 Tencent. 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. @@ -404,6 +404,9 @@ const ( // 无效的回源配置,源站类型为对象存储时,源站地址必须为对象存储域名。 INVALIDPARAMETER_INVALIDCOSDOMAIN = "InvalidParameter.InvalidCosDomain" + // 域名非法,请检查入参中是否传入不存在的域名。 + INVALIDPARAMETER_INVALIDDOMAINS = "InvalidParameter.InvalidDomains" + // 无效的智能加速。 INVALIDPARAMETER_INVALIDDYNAMICROUTINE = "InvalidParameter.InvalidDynamicRoutine" @@ -497,6 +500,9 @@ const ( // 请指定PrivateAccess参数值为on/off。 INVALIDPARAMETER_INVALIDPRIVATEACCESSSWITCH = "InvalidParameter.InvalidPrivateAccessSwitch" + // 四层代理非法,请检查入参中是否传入不存在的代理。 + INVALIDPARAMETER_INVALIDPROXIES = "InvalidParameter.InvalidProxies" + // 套餐包不支持Quic配置。 INVALIDPARAMETER_INVALIDQUICBILLING = "InvalidParameter.InvalidQuicBilling" @@ -1064,6 +1070,9 @@ const ( // 存在加速域名处于部署中状态,暂不支持停用站点。 OPERATIONDENIED_L7HOSTINPROCESSSTATUS = "OperationDenied.L7HostInProcessStatus" + // 回源白名单已经是最新版本,无需更新。 + OPERATIONDENIED_LATESTVERSIONNOW = "OperationDenied.LatestVersionNow" + // 绑定负载均衡有处于非运行中的状态,禁止操作。 OPERATIONDENIED_LOADBALANCESTATUSNOTINONLINE = "OperationDenied.LoadBalanceStatusNotInOnline" @@ -1151,6 +1160,12 @@ const ( // 当前并不支持关闭回源双向认证,如需关闭,请通过将边缘 HTTPS 证书更改为不配置来关闭。 OPERATIONDENIED_UNSUPPORTTOCLOSEUPSTREAMMTLS = "OperationDenied.UnSupportToCloseUpstreamMTLS" + // 套餐不支持。 + OPERATIONDENIED_UNSUPPORTEDPLAN = "OperationDenied.UnsupportedPlan" + + // 请先更新IP白名单。 + OPERATIONDENIED_UPDATEIPWHITELISTFIRST = "OperationDenied.UpdateIPWhitelistFirst" + // 如需启用回源双向认证,请先配置边缘 HTTPS 证书。 OPERATIONDENIED_USEUPSTREAMMTLSNEEDOPENHTTPS = "OperationDenied.UseUpstreamMTLSNeedOpenHttps" diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/models.go index e05d97be2c..236decf8e0 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901/models.go @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. +// Copyright (c) 2017-2025 Tencent. 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. @@ -323,6 +323,14 @@ type AdaptiveFrequencyControl struct { Action *SecurityAction `json:"Action,omitnil,omitempty" name:"Action"` } +type Addresses struct { + // IPv4 网段列表。 + IPv4 []*string `json:"IPv4,omitnil,omitempty" name:"IPv4"` + + // IPv6 网段列表。 + IPv6 []*string `json:"IPv6,omitnil,omitempty" name:"IPv6"` +} + type AdvancedFilter struct { // 需要过滤的字段。 Name *string `json:"Name,omitnil,omitempty" name:"Name"` @@ -467,6 +475,14 @@ type AliasDomain struct { ModifiedOn *string `json:"ModifiedOn,omitnil,omitempty" name:"ModifiedOn"` } +type AllowActionParameters struct { + // 最小延迟响应时间,当配置为 0s 时,表示不延迟直接响应。支持的单位有: