diff --git a/.changelog/4187.txt b/.changelog/4187.txt new file mode 100644 index 0000000000..776c9a3caf --- /dev/null +++ b/.changelog/4187.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +tencentcloud_teo_edge_k_v_namespace +``` diff --git a/go.mod b/go.mod index 55e2c04f1d..342e67795c 100644 --- a/go.mod +++ b/go.mod @@ -93,7 +93,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdcpg v1.0.533 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.3.46 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.578 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.90 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.108 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.3.86 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/trocket v1.1.0 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tse v1.0.857 diff --git a/go.sum b/go.sum index 2da347a05b..1a9bf50cae 100644 --- a/go.sum +++ b/go.sum @@ -837,8 +837,6 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apm v1.3.8 h1:v/G/D3bqU github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apm v1.3.8/go.mod h1:DarTPk6LPu4LtKwDRbF2V2Af4KKXVXnzyteNhAifWm8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.3.16 h1:0YPLYvTF/Jb2kzLQPTE9+SUHoOTinqxzLJpQNOg4Gcc= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.3.16/go.mod h1:1JNwb292Pt2CuxQOsgwdXFs2a79nLdwiFRXT0xKACkg= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bh v1.3.68 h1:yyH8702x16BIh46K6vEeHoQiIHuKsYCye2Lj4lmtX98= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bh v1.3.68/go.mod h1:ernIVPt8moCpVWvuoFsJ2OU29Gm6q0XCsY9gemtcR/0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bh v1.3.93 h1:6tYneudwMIvczAIH+6UT4A6DUKF9VPm6er+TIVGMyKg= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bh v1.3.93/go.mod h1:4VE2PmQ0iUVzFkamod4wE2eKjW95NkfqP/sWymsReR4= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bi v1.0.824 h1:DVKvZ6h+qd7tadUrCjVAkCCmE3TsbK2ZmwGd3AJcpWc= @@ -1075,8 +1073,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.3.46 h1:hnBTV4y github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.3.46/go.mod h1:brB63yRDKDgCzEBFU5G3OBV+wQ+lpnOnedxwdnLgjjk= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.578 h1:vBpQhUroO+FAslUmsDWGi8nvczsqZBWVgQwlnyT0Aj8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.578/go.mod h1:UlojGQh/9wb7/uXPNi7PvMral1CNAskVDNgqJEV83l0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.90 h1:UAefUxiVLj639m5jplPyTyOkF5vT8W0d8TrWZ7cepj4= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.90/go.mod h1:YV/JlZueAHyf9eyLmowdbeX90MR5jJmy0Dn6gZwPT2M= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.108 h1:cAw2o4gMuAUZnjdo+WDZmUTHgH6FdysXeUDI1YcBjgI= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.108/go.mod h1:/+JtDwgVSkaDGMU42zTWtidw/p56hl2N46zkWJLAr9U= 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.3.86 h1:vTpLGPpzAbZHOv0F6hmy8C9IBwJIUfhTrXH0vi7eiGA= diff --git a/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/.openspec.yaml b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/.openspec.yaml new file mode 100644 index 0000000000..0ba725fbf0 --- /dev/null +++ b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-06-03 diff --git a/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/design.md b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/design.md new file mode 100644 index 0000000000..e41a6b7662 --- /dev/null +++ b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/design.md @@ -0,0 +1,57 @@ +## Context + +TencentCloud TEO (EdgeOne) 提供 Edge KV 命名空间管理的云 API,包括 CreateEdgeKVNamespace、DescribeEdgeKVNamespaces、ModifyEdgeKVNamespace、DeleteEdgeKVNamespace 四个接口。这些接口已在 vendor 中可用(`github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901`)。当前 provider 已有 TEO 服务目录(`tencentcloud/services/teo/`),需要在其中新增资源文件。 + +## Goals / Non-Goals + +**Goals:** +- 实现 `tencentcloud_teo_edge_k_v_namespace` 资源的完整 CRUD 生命周期 +- 使用 `zone_id#namespace` 联合 ID,支持 terraform import +- 遵循项目现有代码风格(参考 `tencentcloud_igtm_strategy` 资源) +- 提供单元测试(使用 gomonkey mock 云 API) +- 提供资源文档(.md 文件) + +**Non-Goals:** +- 不实现 Edge KV 键值对的 CRUD(仅管理命名空间) +- 不实现 datasource 类型资源 +- 不新增 service 层文件(直接在资源文件中调用 API) + +## Decisions + +### 1. 资源 ID 设计:使用 zone_id + namespace 联合 ID + +**选择**: 使用 `tccommon.FILED_SP`(即 `#`)作为分隔符拼接 `zone_id` 和 `namespace` 作为资源 ID。 + +**理由**: CreateEdgeKVNamespace 接口不返回独立的资源 ID,命名空间通过 zone_id + namespace 唯一标识。这与项目中其他类似资源的做法一致。 + +**替代方案**: 仅使用 namespace 作为 ID → 不可行,因为 namespace 在不同 zone 下可能重复。 + +### 2. ForceNew 字段设计 + +**选择**: `zone_id` 和 `namespace` 设为 ForceNew。 + +**理由**: ModifyEdgeKVNamespace 接口仅支持修改 `remark` 字段,`zone_id` 和 `namespace` 是定位资源的标识符,不可变更。 + +### 3. Update 方法设计 + +**选择**: Update 方法仅处理 `remark` 字段的变更,通过 ModifyEdgeKVNamespace 接口实现。 + +**理由**: 云 API ModifyEdgeKVNamespace 仅支持修改 remark。zone_id 和 namespace 已设为 ForceNew,变更时会触发 destroy + create。 + +### 4. Read 方法设计:使用 Filters 过滤 + +**选择**: 在 DescribeEdgeKVNamespaces 请求中使用 `namespace` 过滤条件精确查询目标命名空间,Limit 设为 1000(接口最大值)。 + +**理由**: DescribeEdgeKVNamespaces 是列表查询接口,通过 Filters 按 namespace 名称过滤可精确定位目标资源。设置最大 Limit 确保不会因分页遗漏。 + +### 5. 测试方案:gomonkey mock + +**选择**: 使用 gomonkey 对云 API 调用进行 mock,编写纯业务逻辑单元测试。 + +**理由**: 项目要求新增资源使用 mock 方式进行单元测试,不依赖真实云环境。 + +## Risks / Trade-offs + +- [DescribeEdgeKVNamespaces 使用模糊匹配] → 在 Read 方法中遍历返回结果,精确匹配 namespace 名称,避免模糊查询返回多个结果时取错数据。 +- [CreateEdgeKVNamespace 不返回资源 ID] → 创建成功后直接使用入参 zone_id + namespace 组合为 ID,无需从响应中提取。 +- [并发创建同名 namespace] → 依赖云 API 侧的唯一性校验,Terraform 层面不做额外处理。 diff --git a/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/proposal.md b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/proposal.md new file mode 100644 index 0000000000..e2f38e6f52 --- /dev/null +++ b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/proposal.md @@ -0,0 +1,32 @@ +## Why + +TencentCloud TEO (EdgeOne) 提供了 Edge KV 命名空间功能,允许用户在边缘节点创建和管理 KV 存储命名空间。当前 Terraform Provider 缺少对该资源的支持,用户无法通过 IaC 方式管理 TEO Edge KV 命名空间的生命周期(创建、查询、修改、删除)。新增此资源以补全 TEO 产品的 Terraform 覆盖度。 + +## What Changes + +- 新增 Terraform 资源 `tencentcloud_teo_edge_k_v_namespace`,支持完整的 CRUD 生命周期管理 +- 资源使用 `zone_id` + `namespace` 作为联合 ID,支持 import +- 支持创建时指定 `zone_id`、`namespace`、`remark` 参数 +- 支持通过 `ModifyEdgeKVNamespace` 接口更新 `remark` 字段 +- 支持通过 `DeleteEdgeKVNamespace` 接口删除命名空间 +- Read 方法通过 `DescribeEdgeKVNamespaces` 接口查询命名空间详情 +- 在 `provider.go` 和 `provider.md` 中注册新资源 + +## Capabilities + +### New Capabilities + +- `teo-edge-kv-namespace-resource`: 提供 TEO Edge KV 命名空间的 CRUD 资源管理能力,包括创建、读取、更新(remark)、删除命名空间,以及 import 支持 + +### Modified Capabilities + +(无) + +## Impact + +- 新增文件: `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.go` +- 新增文件: `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace_test.go` +- 新增文件: `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md` +- 修改文件: `tencentcloud/provider.go`(注册资源) +- 修改文件: `tencentcloud/provider.md`(添加资源文档引用) +- 依赖: `github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901`(已在 vendor 中) diff --git a/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/specs/teo-edge-kv-namespace-resource/spec.md b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/specs/teo-edge-kv-namespace-resource/spec.md new file mode 100644 index 0000000000..6abb02de2b --- /dev/null +++ b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/specs/teo-edge-kv-namespace-resource/spec.md @@ -0,0 +1,93 @@ +## ADDED Requirements + +### Requirement: Resource schema definition + +The resource `tencentcloud_teo_edge_k_v_namespace` SHALL define the following schema fields: +- `zone_id` (Required, ForceNew, String): 站点 ID +- `namespace` (Required, ForceNew, String): 命名空间名称,1-50 个字符,允许 a-z、A-Z、0-9、- +- `remark` (Optional, String): 命名空间描述,最大 256 个字符 + +The resource SHALL use `zone_id#namespace` as the composite resource ID (using `tccommon.FILED_SP` as separator). + +#### Scenario: Schema fields are correctly defined +- **WHEN** user defines a `tencentcloud_teo_edge_k_v_namespace` resource block with `zone_id`, `namespace`, and `remark` +- **THEN** Terraform SHALL accept the configuration and plan the resource creation + +#### Scenario: Import with composite ID +- **WHEN** user runs `terraform import tencentcloud_teo_edge_k_v_namespace.example zone-xxx#my-namespace` +- **THEN** the resource SHALL be imported successfully by parsing `zone_id` and `namespace` from the composite ID + +### Requirement: Create operation + +The resource Create function SHALL call `CreateEdgeKVNamespace` API with `ZoneId`, `Namespace`, and `Remark` parameters. After successful creation, the resource ID SHALL be set to `zone_id#namespace`. The Create function SHALL verify that the API call succeeds before setting the ID. + +#### Scenario: Successful creation +- **WHEN** user applies a configuration with valid `zone_id`, `namespace`, and `remark` +- **THEN** the system SHALL call `CreateEdgeKVNamespace` API and set the resource ID to `zone_id#namespace` + +#### Scenario: Creation with retry on failure +- **WHEN** the `CreateEdgeKVNamespace` API call fails with a retryable error +- **THEN** the system SHALL retry the request using `tccommon.ReadRetryTimeout` and `resource.RetryContext` + +### Requirement: Read operation + +The resource Read function SHALL call `DescribeEdgeKVNamespaces` API with `ZoneId` and a `namespace` filter to retrieve the namespace details. It SHALL set `zone_id`, `namespace`, and `remark` from the response. If the namespace is not found, it SHALL remove the resource from state. + +#### Scenario: Successful read +- **WHEN** the resource exists in the cloud +- **THEN** the system SHALL call `DescribeEdgeKVNamespaces` with namespace filter, find the matching namespace, and set `zone_id`, `namespace`, `remark` in state + +#### Scenario: Resource not found +- **WHEN** the `DescribeEdgeKVNamespaces` API returns empty results for the namespace +- **THEN** the system SHALL remove the resource from Terraform state (call `d.SetId("")`) + +### Requirement: Update operation + +The resource Update function SHALL call `ModifyEdgeKVNamespace` API when `remark` changes. Since `zone_id` and `namespace` are ForceNew, they cannot be updated in-place. + +#### Scenario: Update remark +- **WHEN** user changes the `remark` field value +- **THEN** the system SHALL call `ModifyEdgeKVNamespace` API with the new `remark` value + +#### Scenario: Update with retry on failure +- **WHEN** the `ModifyEdgeKVNamespace` API call fails with a retryable error +- **THEN** the system SHALL retry the request using `tccommon.ReadRetryTimeout` and `resource.RetryContext` + +### Requirement: Delete operation + +The resource Delete function SHALL call `DeleteEdgeKVNamespace` API with `ZoneId` and `Namespace` parameters to remove the namespace. + +#### Scenario: Successful deletion +- **WHEN** user destroys the resource +- **THEN** the system SHALL call `DeleteEdgeKVNamespace` API with the correct `ZoneId` and `Namespace` + +#### Scenario: Delete with retry on failure +- **WHEN** the `DeleteEdgeKVNamespace` API call fails with a retryable error +- **THEN** the system SHALL retry the request using `tccommon.ReadRetryTimeout` and `resource.RetryContext` + +### Requirement: Provider registration + +The resource SHALL be registered in `tencentcloud/provider.go` under the TEO service section, and referenced in `tencentcloud/provider.md`. + +#### Scenario: Resource is available in provider +- **WHEN** user configures the tencentcloud provider +- **THEN** the resource `tencentcloud_teo_edge_k_v_namespace` SHALL be available for use + +### Requirement: Unit tests with gomonkey mock + +The resource SHALL have unit tests in `resource_tc_teo_edge_k_v_namespace_test.go` that use gomonkey to mock cloud API calls. Tests SHALL cover Create, Read, Update, and Delete operations and SHALL pass with `go test -gcflags=all=-l`. + +#### Scenario: Unit tests pass +- **WHEN** running `go test -gcflags=all=-l` on the test file +- **THEN** all unit tests SHALL pass without requiring real cloud credentials + +### Requirement: Resource documentation + +The resource SHALL have a documentation file at `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md` with: +- A one-line description mentioning TEO product +- Example Usage section +- Import section showing the composite ID format `zone_id#namespace` + +#### Scenario: Documentation is complete +- **WHEN** the documentation file is generated +- **THEN** it SHALL contain description, Example Usage, and Import sections diff --git a/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/tasks.md b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/tasks.md new file mode 100644 index 0000000000..0fae0080f0 --- /dev/null +++ b/openspec/changes/archive/2026-06-03-add-teo-edge-kv-namespace-resource/tasks.md @@ -0,0 +1,21 @@ +## 1. Resource Implementation + +- [x] 1.1 Create resource file `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.go` with schema definition (zone_id, namespace, remark) and CRUD functions (Create, Read, Update, Delete) following the igtm_strategy resource pattern +- [x] 1.2 Implement Create function: call CreateEdgeKVNamespace API with retry, set composite ID (zone_id#namespace) +- [x] 1.3 Implement Read function: call DescribeEdgeKVNamespaces API with namespace filter, set state fields, handle resource not found +- [x] 1.4 Implement Update function: call ModifyEdgeKVNamespace API with retry when remark changes +- [x] 1.5 Implement Delete function: call DeleteEdgeKVNamespace API with retry + +## 2. Provider Registration + +- [x] 2.1 Register `tencentcloud_teo_edge_k_v_namespace` resource in `tencentcloud/provider.go` under TEO service section +- [x] 2.2 Add resource reference in `tencentcloud/provider.md` + +## 3. Documentation + +- [x] 3.1 Create resource documentation file `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md` with description, Example Usage, and Import sections + +## 4. Unit Tests + +- [x] 4.1 Create unit test file `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace_test.go` with gomonkey mock tests covering Create, Read, Update, and Delete operations +- [x] 4.2 Run unit tests with `go test -gcflags=all=-l` to verify they pass diff --git a/openspec/specs/teo-edge-kv-namespace-resource/spec.md b/openspec/specs/teo-edge-kv-namespace-resource/spec.md new file mode 100644 index 0000000000..6abb02de2b --- /dev/null +++ b/openspec/specs/teo-edge-kv-namespace-resource/spec.md @@ -0,0 +1,93 @@ +## ADDED Requirements + +### Requirement: Resource schema definition + +The resource `tencentcloud_teo_edge_k_v_namespace` SHALL define the following schema fields: +- `zone_id` (Required, ForceNew, String): 站点 ID +- `namespace` (Required, ForceNew, String): 命名空间名称,1-50 个字符,允许 a-z、A-Z、0-9、- +- `remark` (Optional, String): 命名空间描述,最大 256 个字符 + +The resource SHALL use `zone_id#namespace` as the composite resource ID (using `tccommon.FILED_SP` as separator). + +#### Scenario: Schema fields are correctly defined +- **WHEN** user defines a `tencentcloud_teo_edge_k_v_namespace` resource block with `zone_id`, `namespace`, and `remark` +- **THEN** Terraform SHALL accept the configuration and plan the resource creation + +#### Scenario: Import with composite ID +- **WHEN** user runs `terraform import tencentcloud_teo_edge_k_v_namespace.example zone-xxx#my-namespace` +- **THEN** the resource SHALL be imported successfully by parsing `zone_id` and `namespace` from the composite ID + +### Requirement: Create operation + +The resource Create function SHALL call `CreateEdgeKVNamespace` API with `ZoneId`, `Namespace`, and `Remark` parameters. After successful creation, the resource ID SHALL be set to `zone_id#namespace`. The Create function SHALL verify that the API call succeeds before setting the ID. + +#### Scenario: Successful creation +- **WHEN** user applies a configuration with valid `zone_id`, `namespace`, and `remark` +- **THEN** the system SHALL call `CreateEdgeKVNamespace` API and set the resource ID to `zone_id#namespace` + +#### Scenario: Creation with retry on failure +- **WHEN** the `CreateEdgeKVNamespace` API call fails with a retryable error +- **THEN** the system SHALL retry the request using `tccommon.ReadRetryTimeout` and `resource.RetryContext` + +### Requirement: Read operation + +The resource Read function SHALL call `DescribeEdgeKVNamespaces` API with `ZoneId` and a `namespace` filter to retrieve the namespace details. It SHALL set `zone_id`, `namespace`, and `remark` from the response. If the namespace is not found, it SHALL remove the resource from state. + +#### Scenario: Successful read +- **WHEN** the resource exists in the cloud +- **THEN** the system SHALL call `DescribeEdgeKVNamespaces` with namespace filter, find the matching namespace, and set `zone_id`, `namespace`, `remark` in state + +#### Scenario: Resource not found +- **WHEN** the `DescribeEdgeKVNamespaces` API returns empty results for the namespace +- **THEN** the system SHALL remove the resource from Terraform state (call `d.SetId("")`) + +### Requirement: Update operation + +The resource Update function SHALL call `ModifyEdgeKVNamespace` API when `remark` changes. Since `zone_id` and `namespace` are ForceNew, they cannot be updated in-place. + +#### Scenario: Update remark +- **WHEN** user changes the `remark` field value +- **THEN** the system SHALL call `ModifyEdgeKVNamespace` API with the new `remark` value + +#### Scenario: Update with retry on failure +- **WHEN** the `ModifyEdgeKVNamespace` API call fails with a retryable error +- **THEN** the system SHALL retry the request using `tccommon.ReadRetryTimeout` and `resource.RetryContext` + +### Requirement: Delete operation + +The resource Delete function SHALL call `DeleteEdgeKVNamespace` API with `ZoneId` and `Namespace` parameters to remove the namespace. + +#### Scenario: Successful deletion +- **WHEN** user destroys the resource +- **THEN** the system SHALL call `DeleteEdgeKVNamespace` API with the correct `ZoneId` and `Namespace` + +#### Scenario: Delete with retry on failure +- **WHEN** the `DeleteEdgeKVNamespace` API call fails with a retryable error +- **THEN** the system SHALL retry the request using `tccommon.ReadRetryTimeout` and `resource.RetryContext` + +### Requirement: Provider registration + +The resource SHALL be registered in `tencentcloud/provider.go` under the TEO service section, and referenced in `tencentcloud/provider.md`. + +#### Scenario: Resource is available in provider +- **WHEN** user configures the tencentcloud provider +- **THEN** the resource `tencentcloud_teo_edge_k_v_namespace` SHALL be available for use + +### Requirement: Unit tests with gomonkey mock + +The resource SHALL have unit tests in `resource_tc_teo_edge_k_v_namespace_test.go` that use gomonkey to mock cloud API calls. Tests SHALL cover Create, Read, Update, and Delete operations and SHALL pass with `go test -gcflags=all=-l`. + +#### Scenario: Unit tests pass +- **WHEN** running `go test -gcflags=all=-l` on the test file +- **THEN** all unit tests SHALL pass without requiring real cloud credentials + +### Requirement: Resource documentation + +The resource SHALL have a documentation file at `tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md` with: +- A one-line description mentioning TEO product +- Example Usage section +- Import section showing the composite ID format `zone_id#namespace` + +#### Scenario: Documentation is complete +- **WHEN** the documentation file is generated +- **THEN** it SHALL contain description, Example Usage, and Import sections diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index bc3062d9c9..9854754bed 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -2118,6 +2118,7 @@ func Provider() *schema.Provider { "tencentcloud_teo_just_in_time_transcode_template": teo.ResourceTencentCloudTeoJustInTimeTranscodeTemplate(), "tencentcloud_teo_customize_error_page": teo.ResourceTencentCloudTeoCustomizeErrorPage(), "tencentcloud_teo_origin_acl": teo.ResourceTencentCloudTeoOriginAcl(), + "tencentcloud_teo_edge_k_v_namespace": teo.ResourceTencentCloudTeoEdgeKVNamespace(), "tencentcloud_teo_ddos_protection_config": teo.ResourceTencentCloudTeoDdosProtectionConfig(), "tencentcloud_teo_multi_path_gateway_secret_key": teo.ResourceTencentCloudTeoMultiPathGatewaySecretKeyConfig(), "tencentcloud_teo_multi_path_gateway": teo.ResourceTencentCloudTeoMultiPathGateway(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index db96270a03..49cc1628d9 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -1596,6 +1596,7 @@ tencentcloud_teo_bind_security_template tencentcloud_teo_content_identifier tencentcloud_teo_customize_error_page tencentcloud_teo_origin_acl +tencentcloud_teo_edge_k_v_namespace tencentcloud_teo_ddos_protection_config tencentcloud_teo_multi_path_gateway_secret_key tencentcloud_teo_multi_path_gateway diff --git a/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.go b/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.go new file mode 100644 index 0000000000..30c11f11d3 --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.go @@ -0,0 +1,267 @@ +package teo + +import ( + "context" + "fmt" + "log" + "strings" + + "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 ResourceTencentCloudTeoEdgeKVNamespace() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudTeoEdgeKVNamespaceCreate, + Read: resourceTencentCloudTeoEdgeKVNamespaceRead, + Update: resourceTencentCloudTeoEdgeKVNamespaceUpdate, + Delete: resourceTencentCloudTeoEdgeKVNamespaceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Site ID.", + }, + "namespace": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Namespace name. Supports 1-50 characters, allowed characters are a-z, A-Z, 0-9, -.", + }, + "remark": { + Type: schema.TypeString, + Optional: true, + Description: "Namespace description. Maximum 256 characters.", + }, + }, + } +} + +func resourceTencentCloudTeoEdgeKVNamespaceCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_edge_k_v_namespace.create")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + request = teov20220901.NewCreateEdgeKVNamespaceRequest() + zoneId string + namespace string + ) + + if v, ok := d.GetOk("zone_id"); ok { + request.ZoneId = helper.String(v.(string)) + zoneId = v.(string) + } + + if v, ok := d.GetOk("namespace"); ok { + request.Namespace = helper.String(v.(string)) + namespace = v.(string) + } + + if v, ok := d.GetOk("remark"); ok { + request.Remark = helper.String(v.(string)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().CreateEdgeKVNamespaceWithContext(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("Create teo edge kv namespace failed, Response is nil.")) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s create teo edge kv namespace failed, reason:%+v", logId, err) + return err + } + + d.SetId(strings.Join([]string{zoneId, namespace}, tccommon.FILED_SP)) + return resourceTencentCloudTeoEdgeKVNamespaceRead(d, meta) +} + +func resourceTencentCloudTeoEdgeKVNamespaceRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_edge_k_v_namespace.read")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + request = teov20220901.NewDescribeEdgeKVNamespacesRequest() + ) + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + + zoneId := idSplit[0] + namespace := idSplit[1] + + request.ZoneId = &zoneId + request.Limit = helper.Int64(1000) + request.Filters = []*teov20220901.AdvancedFilter{ + { + Name: helper.String("namespace"), + Values: []*string{&namespace}, + Fuzzy: helper.Bool(false), + }, + } + + var kvNamespace *teov20220901.KVNamespace + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().DescribeEdgeKVNamespacesWithContext(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 edge kv namespaces failed, Response is nil.")) + } + + for _, ns := range result.Response.KVNamespaces { + if ns.Namespace != nil && *ns.Namespace == namespace { + kvNamespace = ns + break + } + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s read teo edge kv namespace failed, reason:%+v", logId, err) + return err + } + + if kvNamespace == nil { + log.Printf("[WARN]%s resource `tencentcloud_teo_edge_k_v_namespace` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + d.SetId("") + return nil + } + + _ = d.Set("zone_id", zoneId) + + if kvNamespace.Namespace != nil { + _ = d.Set("namespace", kvNamespace.Namespace) + } + + if kvNamespace.Remark != nil { + _ = d.Set("remark", kvNamespace.Remark) + } + + return nil +} + +func resourceTencentCloudTeoEdgeKVNamespaceUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_edge_k_v_namespace.update")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + ) + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + + zoneId := idSplit[0] + namespace := idSplit[1] + + if d.HasChange("remark") { + request := teov20220901.NewModifyEdgeKVNamespaceRequest() + request.ZoneId = &zoneId + request.Namespace = &namespace + + if v, ok := d.GetOk("remark"); ok { + request.Remark = helper.String(v.(string)) + } else { + request.Remark = helper.String("") + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().ModifyEdgeKVNamespaceWithContext(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 edge kv namespace failed, Response is nil.")) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s update teo edge kv namespace failed, reason:%+v", logId, err) + return err + } + } + + return resourceTencentCloudTeoEdgeKVNamespaceRead(d, meta) +} + +func resourceTencentCloudTeoEdgeKVNamespaceDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_edge_k_v_namespace.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + request = teov20220901.NewDeleteEdgeKVNamespaceRequest() + ) + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + + zoneId := idSplit[0] + namespace := idSplit[1] + + request.ZoneId = &zoneId + request.Namespace = &namespace + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().DeleteEdgeKVNamespaceWithContext(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("Delete teo edge kv namespace failed, Response is nil.")) + } + + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s delete teo edge kv namespace failed, reason:%+v", logId, err) + return err + } + + return nil +} diff --git a/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md b/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md new file mode 100644 index 0000000000..3a2cb1bbfe --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace.md @@ -0,0 +1,19 @@ +Provides a resource to create a TEO edge KV namespace + +Example Usage + +```hcl +resource "tencentcloud_teo_edge_k_v_namespace" "example" { + zone_id = "zone-2o3h21ed2t68" + namespace = "my-namespace" + remark = "This is an example namespace" +} +``` + +Import + +TEO edge KV namespace can be imported using the composite id (zone_id#namespace), e.g. + +```` +terraform import tencentcloud_teo_edge_k_v_namespace.example zone-2o3h21ed2t68#my-namespace +```` diff --git a/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace_test.go b/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace_test.go new file mode 100644 index 0000000000..7f4fe59aa3 --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_edge_k_v_namespace_test.go @@ -0,0 +1,258 @@ +package teo_test + +import ( + "context" + "testing" + + "github.com/agiledragon/gomonkey/v2" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/stretchr/testify/assert" + 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/connectivity" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/teo" +) + +type mockMetaEdgeKVNamespace struct { + client *connectivity.TencentCloudClient +} + +func (m *mockMetaEdgeKVNamespace) GetAPIV3Conn() *connectivity.TencentCloudClient { + return m.client +} + +var _ tccommon.ProviderMeta = &mockMetaEdgeKVNamespace{} + +func newMockMetaEdgeKVNamespace() *mockMetaEdgeKVNamespace { + return &mockMetaEdgeKVNamespace{client: &connectivity.TencentCloudClient{}} +} + +func ptrStringEdgeKVNamespace(s string) *string { + return &s +} + +func helper_int64(v int64) *int64 { + return &v +} + +// go test ./tencentcloud/services/teo/ -run "TestTeoEdgeKVNamespace" -v -count=1 -gcflags="all=-l" + +// TestTeoEdgeKVNamespace_Create tests Create operation +func TestTeoEdgeKVNamespace_Create(t *testing.T) { + patches := gomonkey.NewPatches() + defer patches.Reset() + + teoClient := &teov20220901.Client{} + patches.ApplyMethodReturn(newMockMetaEdgeKVNamespace().client, "UseTeoV20220901Client", teoClient) + + patches.ApplyMethodFunc(teoClient, "CreateEdgeKVNamespaceWithContext", func(_ context.Context, request *teov20220901.CreateEdgeKVNamespaceRequest) (*teov20220901.CreateEdgeKVNamespaceResponse, error) { + assert.NotNil(t, request.ZoneId) + assert.Equal(t, "zone-2o3h21ed2t68", *request.ZoneId) + assert.NotNil(t, request.Namespace) + assert.Equal(t, "my-namespace", *request.Namespace) + assert.NotNil(t, request.Remark) + assert.Equal(t, "test remark", *request.Remark) + + resp := teov20220901.NewCreateEdgeKVNamespaceResponse() + resp.Response = &teov20220901.CreateEdgeKVNamespaceResponseParams{ + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + patches.ApplyMethodFunc(teoClient, "DescribeEdgeKVNamespacesWithContext", func(_ context.Context, request *teov20220901.DescribeEdgeKVNamespacesRequest) (*teov20220901.DescribeEdgeKVNamespacesResponse, error) { + assert.NotNil(t, request.ZoneId) + assert.Equal(t, "zone-2o3h21ed2t68", *request.ZoneId) + + resp := teov20220901.NewDescribeEdgeKVNamespacesResponse() + resp.Response = &teov20220901.DescribeEdgeKVNamespacesResponseParams{ + TotalCount: helper_int64(1), + KVNamespaces: []*teov20220901.KVNamespace{ + { + Namespace: ptrStringEdgeKVNamespace("my-namespace"), + Remark: ptrStringEdgeKVNamespace("test remark"), + }, + }, + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + meta := newMockMetaEdgeKVNamespace() + res := teo.ResourceTencentCloudTeoEdgeKVNamespace() + d := schema.TestResourceDataRaw(t, res.Schema, map[string]interface{}{ + "zone_id": "zone-2o3h21ed2t68", + "namespace": "my-namespace", + "remark": "test remark", + }) + + err := res.Create(d, meta) + assert.NoError(t, err) + assert.Equal(t, "zone-2o3h21ed2t68#my-namespace", d.Id()) + assert.Equal(t, "test remark", d.Get("remark")) +} + +// TestTeoEdgeKVNamespace_Read tests Read operation +func TestTeoEdgeKVNamespace_Read(t *testing.T) { + patches := gomonkey.NewPatches() + defer patches.Reset() + + teoClient := &teov20220901.Client{} + patches.ApplyMethodReturn(newMockMetaEdgeKVNamespace().client, "UseTeoV20220901Client", teoClient) + + patches.ApplyMethodFunc(teoClient, "DescribeEdgeKVNamespacesWithContext", func(_ context.Context, request *teov20220901.DescribeEdgeKVNamespacesRequest) (*teov20220901.DescribeEdgeKVNamespacesResponse, error) { + assert.NotNil(t, request.ZoneId) + assert.Equal(t, "zone-2o3h21ed2t68", *request.ZoneId) + + resp := teov20220901.NewDescribeEdgeKVNamespacesResponse() + resp.Response = &teov20220901.DescribeEdgeKVNamespacesResponseParams{ + TotalCount: helper_int64(1), + KVNamespaces: []*teov20220901.KVNamespace{ + { + Namespace: ptrStringEdgeKVNamespace("my-namespace"), + Remark: ptrStringEdgeKVNamespace("test remark"), + }, + }, + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + meta := newMockMetaEdgeKVNamespace() + res := teo.ResourceTencentCloudTeoEdgeKVNamespace() + d := schema.TestResourceDataRaw(t, res.Schema, map[string]interface{}{ + "zone_id": "zone-2o3h21ed2t68", + "namespace": "my-namespace", + }) + d.SetId("zone-2o3h21ed2t68#my-namespace") + + err := res.Read(d, meta) + assert.NoError(t, err) + assert.Equal(t, "zone-2o3h21ed2t68", d.Get("zone_id")) + assert.Equal(t, "my-namespace", d.Get("namespace")) + assert.Equal(t, "test remark", d.Get("remark")) +} + +// TestTeoEdgeKVNamespace_ReadNotFound tests Read when resource is not found +func TestTeoEdgeKVNamespace_ReadNotFound(t *testing.T) { + patches := gomonkey.NewPatches() + defer patches.Reset() + + teoClient := &teov20220901.Client{} + patches.ApplyMethodReturn(newMockMetaEdgeKVNamespace().client, "UseTeoV20220901Client", teoClient) + + patches.ApplyMethodFunc(teoClient, "DescribeEdgeKVNamespacesWithContext", func(_ context.Context, request *teov20220901.DescribeEdgeKVNamespacesRequest) (*teov20220901.DescribeEdgeKVNamespacesResponse, error) { + resp := teov20220901.NewDescribeEdgeKVNamespacesResponse() + resp.Response = &teov20220901.DescribeEdgeKVNamespacesResponseParams{ + TotalCount: helper_int64(0), + KVNamespaces: []*teov20220901.KVNamespace{}, + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + meta := newMockMetaEdgeKVNamespace() + res := teo.ResourceTencentCloudTeoEdgeKVNamespace() + d := schema.TestResourceDataRaw(t, res.Schema, map[string]interface{}{ + "zone_id": "zone-2o3h21ed2t68", + "namespace": "my-namespace", + }) + d.SetId("zone-2o3h21ed2t68#my-namespace") + + err := res.Read(d, meta) + assert.NoError(t, err) + assert.Equal(t, "", d.Id()) +} + +// TestTeoEdgeKVNamespace_Update tests Update operation +func TestTeoEdgeKVNamespace_Update(t *testing.T) { + patches := gomonkey.NewPatches() + defer patches.Reset() + + teoClient := &teov20220901.Client{} + patches.ApplyMethodReturn(newMockMetaEdgeKVNamespace().client, "UseTeoV20220901Client", teoClient) + + modifyCalled := false + patches.ApplyMethodFunc(teoClient, "ModifyEdgeKVNamespaceWithContext", func(_ context.Context, request *teov20220901.ModifyEdgeKVNamespaceRequest) (*teov20220901.ModifyEdgeKVNamespaceResponse, error) { + assert.NotNil(t, request.ZoneId) + assert.Equal(t, "zone-2o3h21ed2t68", *request.ZoneId) + assert.NotNil(t, request.Namespace) + assert.Equal(t, "my-namespace", *request.Namespace) + assert.NotNil(t, request.Remark) + assert.Equal(t, "updated remark", *request.Remark) + modifyCalled = true + + resp := teov20220901.NewModifyEdgeKVNamespaceResponse() + resp.Response = &teov20220901.ModifyEdgeKVNamespaceResponseParams{ + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + patches.ApplyMethodFunc(teoClient, "DescribeEdgeKVNamespacesWithContext", func(_ context.Context, request *teov20220901.DescribeEdgeKVNamespacesRequest) (*teov20220901.DescribeEdgeKVNamespacesResponse, error) { + resp := teov20220901.NewDescribeEdgeKVNamespacesResponse() + resp.Response = &teov20220901.DescribeEdgeKVNamespacesResponseParams{ + TotalCount: helper_int64(1), + KVNamespaces: []*teov20220901.KVNamespace{ + { + Namespace: ptrStringEdgeKVNamespace("my-namespace"), + Remark: ptrStringEdgeKVNamespace("updated remark"), + }, + }, + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + meta := newMockMetaEdgeKVNamespace() + res := teo.ResourceTencentCloudTeoEdgeKVNamespace() + d := schema.TestResourceDataRaw(t, res.Schema, map[string]interface{}{ + "zone_id": "zone-2o3h21ed2t68", + "namespace": "my-namespace", + "remark": "updated remark", + }) + d.SetId("zone-2o3h21ed2t68#my-namespace") + + err := res.Update(d, meta) + assert.NoError(t, err) + assert.True(t, modifyCalled) + assert.Equal(t, "updated remark", d.Get("remark")) +} + +// TestTeoEdgeKVNamespace_Delete tests Delete operation +func TestTeoEdgeKVNamespace_Delete(t *testing.T) { + patches := gomonkey.NewPatches() + defer patches.Reset() + + teoClient := &teov20220901.Client{} + patches.ApplyMethodReturn(newMockMetaEdgeKVNamespace().client, "UseTeoV20220901Client", teoClient) + + deleteCalled := false + patches.ApplyMethodFunc(teoClient, "DeleteEdgeKVNamespaceWithContext", func(_ context.Context, request *teov20220901.DeleteEdgeKVNamespaceRequest) (*teov20220901.DeleteEdgeKVNamespaceResponse, error) { + assert.NotNil(t, request.ZoneId) + assert.Equal(t, "zone-2o3h21ed2t68", *request.ZoneId) + assert.NotNil(t, request.Namespace) + assert.Equal(t, "my-namespace", *request.Namespace) + deleteCalled = true + + resp := teov20220901.NewDeleteEdgeKVNamespaceResponse() + resp.Response = &teov20220901.DeleteEdgeKVNamespaceResponseParams{ + RequestId: ptrStringEdgeKVNamespace("fake-request-id"), + } + return resp, nil + }) + + meta := newMockMetaEdgeKVNamespace() + res := teo.ResourceTencentCloudTeoEdgeKVNamespace() + d := schema.TestResourceDataRaw(t, res.Schema, map[string]interface{}{ + "zone_id": "zone-2o3h21ed2t68", + "namespace": "my-namespace", + "remark": "test remark", + }) + d.SetId("zone-2o3h21ed2t68#my-namespace") + + err := res.Delete(d, meta) + assert.NoError(t, err) + assert.True(t, deleteCalled) +} 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 fcb95fb7f6..eac0ede091 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 @@ -600,7 +600,9 @@ func NewCreateAccelerationDomainResponse() (response *CreateAccelerationDomainRe // INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" // INVALIDPARAMETERVALUE_INVALIDDOMAINNAME = "InvalidParameterValue.InvalidDomainName" // INVALIDPARAMETERVALUE_INVALIDPROXYORIGIN = "InvalidParameterValue.InvalidProxyOrigin" +// INVALIDPARAMETERVALUE_INVALIDSITEFAILOVERUNSUPPORTED = "InvalidParameterValue.InvalidSiteFailoverUnsupported" // INVALIDPARAMETERVALUE_ORIGINGROUPNOTEXISTS = "InvalidParameterValue.OriginGroupNotExists" +// INVALIDPARAMETERVALUE_SITEFAILOVERNOTSUPPORTHOSTORIGINTYPEVOD = "InvalidParameterValue.SiteFailoverNotSupportHostOriginTypeVod" // OPERATIONDENIED = "OperationDenied" // OPERATIONDENIED_ACCELERATEMAINLANDDISABLE = "OperationDenied.AccelerateMainlandDisable" // OPERATIONDENIED_CONFIGLOCKED = "OperationDenied.ConfigLocked" @@ -662,7 +664,9 @@ func (c *Client) CreateAccelerationDomain(request *CreateAccelerationDomainReque // INVALIDPARAMETERVALUE_INVALIDDNSNAME = "InvalidParameterValue.InvalidDNSName" // INVALIDPARAMETERVALUE_INVALIDDOMAINNAME = "InvalidParameterValue.InvalidDomainName" // INVALIDPARAMETERVALUE_INVALIDPROXYORIGIN = "InvalidParameterValue.InvalidProxyOrigin" +// INVALIDPARAMETERVALUE_INVALIDSITEFAILOVERUNSUPPORTED = "InvalidParameterValue.InvalidSiteFailoverUnsupported" // INVALIDPARAMETERVALUE_ORIGINGROUPNOTEXISTS = "InvalidParameterValue.OriginGroupNotExists" +// INVALIDPARAMETERVALUE_SITEFAILOVERNOTSUPPORTHOSTORIGINTYPEVOD = "InvalidParameterValue.SiteFailoverNotSupportHostOriginTypeVod" // OPERATIONDENIED = "OperationDenied" // OPERATIONDENIED_ACCELERATEMAINLANDDISABLE = "OperationDenied.AccelerateMainlandDisable" // OPERATIONDENIED_CONFIGLOCKED = "OperationDenied.ConfigLocked" @@ -1503,6 +1507,78 @@ func (c *Client) CreateFunctionWithContext(ctx context.Context, request *CreateF return } +func NewCreateFunctionReplicaRequest() (request *CreateFunctionReplicaRequest) { + request = &CreateFunctionReplicaRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "CreateFunctionReplica") + + + return +} + +func NewCreateFunctionReplicaResponse() (response *CreateFunctionReplicaResponse) { + response = &CreateFunctionReplicaResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// CreateFunctionReplica +// 本接口用于创建指定边缘函数的副本。创建副本后,当客户端请求匹配已配置的触发规则或默认域名时,您可以通过在请求头中添加 EO-Function-Replica-Name:[副本名称] 来访问特定的函数副本。每个函数默认支持创建两个副本。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_FUNCTIONDEPLOYING = "FailedOperation.FunctionDeploying" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INVALIDPARAMETER_BADCONTENT = "InvalidParameter.BadContent" +// INVALIDPARAMETER_BADFUNCTIONNAME = "InvalidParameter.BadFunctionName" +// INVALIDPARAMETER_CONTENTEXCEEDSLIMIT = "InvalidParameter.ContentExceedsLimit" +// INVALIDPARAMETER_FUNCTIONNAMECONFLICT = "InvalidParameter.FunctionNameConflict" +// INVALIDPARAMETER_LENGTHEXCEEDSLIMIT = "InvalidParameter.LengthExceedsLimit" +// LIMITEXCEEDED_FUNCTIONLIMITEXCEEDED = "LimitExceeded.FunctionLimitExceeded" +// OPERATIONDENIED_VERSIONCONTROLLOCKED = "OperationDenied.VersionControlLocked" +// RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreateFunctionReplica(request *CreateFunctionReplicaRequest) (response *CreateFunctionReplicaResponse, err error) { + return c.CreateFunctionReplicaWithContext(context.Background(), request) +} + +// CreateFunctionReplica +// 本接口用于创建指定边缘函数的副本。创建副本后,当客户端请求匹配已配置的触发规则或默认域名时,您可以通过在请求头中添加 EO-Function-Replica-Name:[副本名称] 来访问特定的函数副本。每个函数默认支持创建两个副本。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_FUNCTIONDEPLOYING = "FailedOperation.FunctionDeploying" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INVALIDPARAMETER_BADCONTENT = "InvalidParameter.BadContent" +// INVALIDPARAMETER_BADFUNCTIONNAME = "InvalidParameter.BadFunctionName" +// INVALIDPARAMETER_CONTENTEXCEEDSLIMIT = "InvalidParameter.ContentExceedsLimit" +// INVALIDPARAMETER_FUNCTIONNAMECONFLICT = "InvalidParameter.FunctionNameConflict" +// INVALIDPARAMETER_LENGTHEXCEEDSLIMIT = "InvalidParameter.LengthExceedsLimit" +// LIMITEXCEEDED_FUNCTIONLIMITEXCEEDED = "LimitExceeded.FunctionLimitExceeded" +// OPERATIONDENIED_VERSIONCONTROLLOCKED = "OperationDenied.VersionControlLocked" +// RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" +// UNAUTHORIZEDOPERATION_CAMUNAUTHORIZED = "UnauthorizedOperation.CamUnauthorized" +func (c *Client) CreateFunctionReplicaWithContext(ctx context.Context, request *CreateFunctionReplicaRequest) (response *CreateFunctionReplicaResponse, err error) { + if request == nil { + request = NewCreateFunctionReplicaRequest() + } + c.InitBaseRequest(&request.BaseRequest, "teo", APIVersion, "CreateFunctionReplica") + + if c.GetCredential() == nil { + return nil, errors.New("CreateFunctionReplica require credential") + } + + request.SetContext(ctx) + + response = NewCreateFunctionReplicaResponse() + err = c.Send(request, response) + return +} + func NewCreateFunctionRuleRequest() (request *CreateFunctionRuleRequest) { request = &CreateFunctionRuleRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -2667,7 +2743,7 @@ func NewCreateRealtimeLogDeliveryTaskResponse() (response *CreateRealtimeLogDeli // // - 当数据投递类型(LogType)为速率限制和 CC 攻击防护日志、托管规则日志、自定义规则日志、Bot 管理日志时,同一个实体在同种数据投递类型(LogType)和数据投递区域(Area)的组合下,只能被添加到一个实时日志投递任务中。 // -// - 当实时日志投递任务类型(TaskType)为 EdgeOne 日志分析(log_analysis)时,只支持数据投递类型(LogType)为站点加速日志(domain);在同一站点(ZoneId)和数据投递区域(Area)的组合下,只能添加一个推送至 EdgeOne 日志分析的实时日志投递任务;。 +// - 当实时日志投递任务类型(TaskType)为 EdgeOne 日志分析(log_analysis)时,只支持数据投递类型(LogType)为站点加速日志(domain)或托管规则日志(web-attack);在同一站点(ZoneId)、同一数据投递区域(Area)和数据的组合下,每种数据投递类型(LogType)只能添加一个推送至 EdgeOne 日志分析的实时日志投递任务。 // // // @@ -2711,7 +2787,7 @@ func (c *Client) CreateRealtimeLogDeliveryTask(request *CreateRealtimeLogDeliver // // - 当数据投递类型(LogType)为速率限制和 CC 攻击防护日志、托管规则日志、自定义规则日志、Bot 管理日志时,同一个实体在同种数据投递类型(LogType)和数据投递区域(Area)的组合下,只能被添加到一个实时日志投递任务中。 // -// - 当实时日志投递任务类型(TaskType)为 EdgeOne 日志分析(log_analysis)时,只支持数据投递类型(LogType)为站点加速日志(domain);在同一站点(ZoneId)和数据投递区域(Area)的组合下,只能添加一个推送至 EdgeOne 日志分析的实时日志投递任务;。 +// - 当实时日志投递任务类型(TaskType)为 EdgeOne 日志分析(log_analysis)时,只支持数据投递类型(LogType)为站点加速日志(domain)或托管规则日志(web-attack);在同一站点(ZoneId)、同一数据投递区域(Area)和数据的组合下,每种数据投递类型(LogType)只能添加一个推送至 EdgeOne 日志分析的实时日志投递任务。 // // // @@ -4553,6 +4629,66 @@ func (c *Client) DeleteFunctionWithContext(ctx context.Context, request *DeleteF return } +func NewDeleteFunctionReplicaRequest() (request *DeleteFunctionReplicaRequest) { + request = &DeleteFunctionReplicaRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DeleteFunctionReplica") + + + return +} + +func NewDeleteFunctionReplicaResponse() (response *DeleteFunctionReplicaResponse) { + response = &DeleteFunctionReplicaResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeleteFunctionReplica +// 本接口用于删除指定的边缘函数副本。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RULEOPERATIONCONFLICT = "FailedOperation.RuleOperationConflict" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// OPERATIONDENIED_VERSIONCONTROLLOCKED = "OperationDenied.VersionControlLocked" +// RESOURCEUNAVAILABLE_FUNCTIONNOTFOUND = "ResourceUnavailable.FunctionNotFound" +// RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" +func (c *Client) DeleteFunctionReplica(request *DeleteFunctionReplicaRequest) (response *DeleteFunctionReplicaResponse, err error) { + return c.DeleteFunctionReplicaWithContext(context.Background(), request) +} + +// DeleteFunctionReplica +// 本接口用于删除指定的边缘函数副本。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_RULEOPERATIONCONFLICT = "FailedOperation.RuleOperationConflict" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// OPERATIONDENIED_VERSIONCONTROLLOCKED = "OperationDenied.VersionControlLocked" +// RESOURCEUNAVAILABLE_FUNCTIONNOTFOUND = "ResourceUnavailable.FunctionNotFound" +// RESOURCEUNAVAILABLE_ZONENOTFOUND = "ResourceUnavailable.ZoneNotFound" +func (c *Client) DeleteFunctionReplicaWithContext(ctx context.Context, request *DeleteFunctionReplicaRequest) (response *DeleteFunctionReplicaResponse, err error) { + if request == nil { + request = NewDeleteFunctionReplicaRequest() + } + c.InitBaseRequest(&request.BaseRequest, "teo", APIVersion, "DeleteFunctionReplica") + + if c.GetCredential() == nil { + return nil, errors.New("DeleteFunctionReplica require credential") + } + + request.SetContext(ctx) + + response = NewDeleteFunctionReplicaResponse() + err = c.Send(request, response) + return +} + func NewDeleteFunctionRulesRequest() (request *DeleteFunctionRulesRequest) { request = &DeleteFunctionRulesRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -6993,6 +7129,60 @@ func (c *Client) DescribeFunctionComponentBindingsWithContext(ctx context.Contex return } +func NewDescribeFunctionReplicasRequest() (request *DescribeFunctionReplicasRequest) { + request = &DescribeFunctionReplicasRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "DescribeFunctionReplicas") + + + return +} + +func NewDescribeFunctionReplicasResponse() (response *DescribeFunctionReplicasResponse) { + response = &DescribeFunctionReplicasResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeFunctionReplicas +// 本接口用于查询边缘函数的副本列表。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INVALIDPARAMETER_INVALIDFILTERNAME = "InvalidParameter.InvalidFilterName" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +func (c *Client) DescribeFunctionReplicas(request *DescribeFunctionReplicasRequest) (response *DescribeFunctionReplicasResponse, err error) { + return c.DescribeFunctionReplicasWithContext(context.Background(), request) +} + +// DescribeFunctionReplicas +// 本接口用于查询边缘函数的副本列表。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INVALIDPARAMETER_INVALIDFILTERNAME = "InvalidParameter.InvalidFilterName" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +func (c *Client) DescribeFunctionReplicasWithContext(ctx context.Context, request *DescribeFunctionReplicasRequest) (response *DescribeFunctionReplicasResponse, err error) { + if request == nil { + request = NewDescribeFunctionReplicasRequest() + } + c.InitBaseRequest(&request.BaseRequest, "teo", APIVersion, "DescribeFunctionReplicas") + + if c.GetCredential() == nil { + return nil, errors.New("DescribeFunctionReplicas require credential") + } + + request.SetContext(ctx) + + response = NewDescribeFunctionReplicasResponse() + err = c.Send(request, response) + return +} + func NewDescribeFunctionRulesRequest() (request *DescribeFunctionRulesRequest) { request = &DescribeFunctionRulesRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -9499,125 +9689,9 @@ func NewDescribeTimingL7OriginPullDataResponse() (response *DescribeTimingL7Orig } // DescribeTimingL7OriginPullData -// 本接口用以查询七层域名业务的回源时序数据,可以通过指定查询维度 DimensionName 进行分组查询,返回多组时序数据。 -// -// -// -//

单次请求最多返回 50,000 个数据项 TimingDataItem 。数据项总数的计算规则如下:

-// -//
-//
-//    指标个数 * 时间点个数 * 维度值个数 = 数据项总数
-//
-// 
-// -// -// -// -// -//

DimensionName 可以与 Filters 组合使用,通过在 Filters 中指定 DimensionName 对应的过滤条件以限制维度值个数。

-// -// -// -//

示例

-// -//

以查询某一小时的具体状态码维度的时序数据为例,假设查询条件如下:

-// -// -// -//

则数据项总数为:

-// -//
1 × 60 × 201 = 12060 
-// -//

未超过限制。

-// -// -// -//

注意:若查询的数据项总数超过 50,000,系统会返回错误 LimitExceeded.TimingDataItemLimitExceeded

-// -//

此时,请通过调整入参减少单次查询的数据项至 50,000 以内,可采取的做法有:

-// -//
    -// -//
  1. -// -// 减少时间点个数: -// -// -// -//
  2. -// -//
  3. -// -// 减少维度值个数: -// -// -// -//
  4. -// -//
  5. -// -// 减少指标值个数: -// -// -// -//
  6. -// -//
+// 您可以选择通过指定查询维度 DimensionName 进行分组查询,返回多组时序数据,详细指引与使用限制请参考 [如何使用 API 实现单次调用中的分组查询](https://cloud.tencent.com/document/product/1552/127501)。 // // 可能返回的错误码: // INVALIDPARAMETER_ACTIONINPROGRESS = "InvalidParameter.ActionInProgress" @@ -9630,125 +9704,9 @@ func (c *Client) DescribeTimingL7OriginPullData(request *DescribeTimingL7OriginP } // DescribeTimingL7OriginPullData -// 本接口用以查询七层域名业务的回源时序数据,可以通过指定查询维度 DimensionName 进行分组查询,返回多组时序数据。 -// -// -// -//

单次请求最多返回 50,000 个数据项 TimingDataItem 。数据项总数的计算规则如下:

-// -//
-//
-//    指标个数 * 时间点个数 * 维度值个数 = 数据项总数
-//
-// 
-// -// -// -// -// -//

DimensionName 可以与 Filters 组合使用,通过在 Filters 中指定 DimensionName 对应的过滤条件以限制维度值个数。

-// -// -// -//

示例

-// -//

以查询某一小时的具体状态码维度的时序数据为例,假设查询条件如下:

-// -// +// 本接口用以查询七层域名业务的回源时序数据。 // -//

则数据项总数为:

-// -//
1 × 60 × 201 = 12060 
-// -//

未超过限制。

-// -// -// -//

注意:若查询的数据项总数超过 50,000,系统会返回错误 LimitExceeded.TimingDataItemLimitExceeded

-// -//

此时,请通过调整入参减少单次查询的数据项至 50,000 以内,可采取的做法有:

-// -//
    -// -//
  1. -// -// 减少时间点个数: -// -// -// -//
  2. -// -//
  3. -// -// 减少维度值个数: -// -// -// -//
  4. -// -//
  5. -// -// 减少指标值个数: -// -// -// -//
  6. -// -//
+// 您可以选择通过指定查询维度 DimensionName 进行分组查询,返回多组时序数据,详细指引与使用限制请参考 [如何使用 API 实现单次调用中的分组查询](https://cloud.tencent.com/document/product/1552/127501)。 // // 可能返回的错误码: // INVALIDPARAMETER_ACTIONINPROGRESS = "InvalidParameter.ActionInProgress" @@ -11086,6 +11044,7 @@ func NewModifyAccelerationDomainResponse() (response *ModifyAccelerationDomainRe // INVALIDPARAMETERVALUE_CONFLICTRECORD = "InvalidParameterValue.ConflictRecord" // INVALIDPARAMETERVALUE_DOMAINNOTMATCHZONE = "InvalidParameterValue.DomainNotMatchZone" // INVALIDPARAMETERVALUE_INVALIDDOMAINSTATUS = "InvalidParameterValue.InvalidDomainStatus" +// INVALIDPARAMETERVALUE_SITEFAILOVERNOTSUPPORTHOSTORIGINTYPEVOD = "InvalidParameterValue.SiteFailoverNotSupportHostOriginTypeVod" // OPERATIONDENIED_DOMAINNOICP = "OperationDenied.DomainNoICP" // OPERATIONDENIED_RESOURCELOCKEDTEMPORARY = "OperationDenied.ResourceLockedTemporary" // OPERATIONDENIED_VERSIONCONTROLISGRAYING = "OperationDenied.VersionControlIsGraying" @@ -11122,6 +11081,7 @@ func (c *Client) ModifyAccelerationDomain(request *ModifyAccelerationDomainReque // INVALIDPARAMETERVALUE_CONFLICTRECORD = "InvalidParameterValue.ConflictRecord" // INVALIDPARAMETERVALUE_DOMAINNOTMATCHZONE = "InvalidParameterValue.DomainNotMatchZone" // INVALIDPARAMETERVALUE_INVALIDDOMAINSTATUS = "InvalidParameterValue.InvalidDomainStatus" +// INVALIDPARAMETERVALUE_SITEFAILOVERNOTSUPPORTHOSTORIGINTYPEVOD = "InvalidParameterValue.SiteFailoverNotSupportHostOriginTypeVod" // OPERATIONDENIED_DOMAINNOICP = "OperationDenied.DomainNoICP" // OPERATIONDENIED_RESOURCELOCKEDTEMPORARY = "OperationDenied.ResourceLockedTemporary" // OPERATIONDENIED_VERSIONCONTROLISGRAYING = "OperationDenied.VersionControlIsGraying" @@ -12057,6 +12017,70 @@ func (c *Client) ModifyFunctionComponentBindingsWithContext(ctx context.Context, return } +func NewModifyFunctionReplicaRequest() (request *ModifyFunctionReplicaRequest) { + request = &ModifyFunctionReplicaRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("teo", APIVersion, "ModifyFunctionReplica") + + + return +} + +func NewModifyFunctionReplicaResponse() (response *ModifyFunctionReplicaResponse) { + response = &ModifyFunctionReplicaResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyFunctionReplica +// 本接口用于修改指定边缘函数副本的内容和描述。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INVALIDPARAMETER_BINDINGNOTFOUND = "InvalidParameter.BindingNotFound" +// INVALIDPARAMETER_DUPLICATEBINDINGNAME = "InvalidParameter.DuplicateBindingName" +// INVALIDPARAMETER_FUNCTIONBINDVARIABLENAMECONFLICT = "InvalidParameter.FunctionBindVariableNameConflict" +// INVALIDPARAMETER_INVALIDOPERATION = "InvalidParameter.InvalidOperation" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// RESOURCEUNAVAILABLE_FUNCTIONNOTFOUND = "ResourceUnavailable.FunctionNotFound" +// RESOURCEUNAVAILABLE_NAMESPACENOTFOUND = "ResourceUnavailable.NamespaceNotFound" +func (c *Client) ModifyFunctionReplica(request *ModifyFunctionReplicaRequest) (response *ModifyFunctionReplicaResponse, err error) { + return c.ModifyFunctionReplicaWithContext(context.Background(), request) +} + +// ModifyFunctionReplica +// 本接口用于修改指定边缘函数副本的内容和描述。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INVALIDPARAMETER_BINDINGNOTFOUND = "InvalidParameter.BindingNotFound" +// INVALIDPARAMETER_DUPLICATEBINDINGNAME = "InvalidParameter.DuplicateBindingName" +// INVALIDPARAMETER_FUNCTIONBINDVARIABLENAMECONFLICT = "InvalidParameter.FunctionBindVariableNameConflict" +// INVALIDPARAMETER_INVALIDOPERATION = "InvalidParameter.InvalidOperation" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// RESOURCEUNAVAILABLE_FUNCTIONNOTFOUND = "ResourceUnavailable.FunctionNotFound" +// RESOURCEUNAVAILABLE_NAMESPACENOTFOUND = "ResourceUnavailable.NamespaceNotFound" +func (c *Client) ModifyFunctionReplicaWithContext(ctx context.Context, request *ModifyFunctionReplicaRequest) (response *ModifyFunctionReplicaResponse, err error) { + if request == nil { + request = NewModifyFunctionReplicaRequest() + } + c.InitBaseRequest(&request.BaseRequest, "teo", APIVersion, "ModifyFunctionReplica") + + if c.GetCredential() == nil { + return nil, errors.New("ModifyFunctionReplica require credential") + } + + request.SetContext(ctx) + + response = NewModifyFunctionReplicaResponse() + err = c.Send(request, response) + return +} + func NewModifyFunctionRuleRequest() (request *ModifyFunctionRuleRequest) { request = &ModifyFunctionRuleRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -12252,6 +12276,7 @@ func NewModifyHostsCertificateResponse() (response *ModifyHostsCertificateRespon // INVALIDPARAMETERVALUE_OCDIRECTORIGINDOMAINNOTSUPPORTUPSTREAMVERIFY = "InvalidParameterValue.OCDirectOriginDomainNotSupportUpstreamVerify" // INVALIDPARAMETERVALUE_SERVERCERTINFONEEDCONTAINRSAORECC = "InvalidParameterValue.ServerCertInfoNeedContainRSAorECC" // INVALIDPARAMETERVALUE_SERVERCERTINFONEEDCONTAINSM2 = "InvalidParameterValue.ServerCertInfoNeedContainSM2" +// INVALIDPARAMETERVALUE_SITEFAILOVERNOTSUPPORTHOSTUPSTREAMVERIFY = "InvalidParameterValue.SiteFailoverNotSupportHostUpstreamVerify" // INVALIDPARAMETERVALUE_UPSTREAMCLIENTCERTINFOQUOTALIMIT = "InvalidParameterValue.UpstreamClientCertInfoQuotaLimit" // INVALIDPARAMETERVALUE_UPSTREAMVERIFYCUSTOMCACERTINFOQUOTALIMIT = "InvalidParameterValue.UpstreamVerifyCustomCACertInfoQuotaLimit" // LIMITEXCEEDED_RATELIMITEXCEEDED = "LimitExceeded.RateLimitExceeded" @@ -12260,6 +12285,7 @@ func NewModifyHostsCertificateResponse() (response *ModifyHostsCertificateRespon // OPERATIONDENIED_CONFIGLOCKED = "OperationDenied.ConfigLocked" // OPERATIONDENIED_DISABLEZONENOTCOMPLETED = "OperationDenied.DisableZoneNotCompleted" // OPERATIONDENIED_ERRZONEISALREADYPAUSED = "OperationDenied.ErrZoneIsAlreadyPaused" +// OPERATIONDENIED_HOSTSCERTIFICATEINCONSISTENCY = "OperationDenied.HostsCertificateInconsistency" // OPERATIONDENIED_HOSTSCLIENTCERTIFICATEINCONSISTENCY = "OperationDenied.HostsClientCertificateInconsistency" // OPERATIONDENIED_HOSTSKEYLESSSERVERINCONSISTENCY = "OperationDenied.HostsKeylessServerInconsistency" // OPERATIONDENIED_HOSTSUPSTREAMCERTIFICATEINCONSISTENCY = "OperationDenied.HostsUpstreamCertificateInconsistency" @@ -12334,6 +12360,7 @@ func (c *Client) ModifyHostsCertificate(request *ModifyHostsCertificateRequest) // INVALIDPARAMETERVALUE_OCDIRECTORIGINDOMAINNOTSUPPORTUPSTREAMVERIFY = "InvalidParameterValue.OCDirectOriginDomainNotSupportUpstreamVerify" // INVALIDPARAMETERVALUE_SERVERCERTINFONEEDCONTAINRSAORECC = "InvalidParameterValue.ServerCertInfoNeedContainRSAorECC" // INVALIDPARAMETERVALUE_SERVERCERTINFONEEDCONTAINSM2 = "InvalidParameterValue.ServerCertInfoNeedContainSM2" +// INVALIDPARAMETERVALUE_SITEFAILOVERNOTSUPPORTHOSTUPSTREAMVERIFY = "InvalidParameterValue.SiteFailoverNotSupportHostUpstreamVerify" // INVALIDPARAMETERVALUE_UPSTREAMCLIENTCERTINFOQUOTALIMIT = "InvalidParameterValue.UpstreamClientCertInfoQuotaLimit" // INVALIDPARAMETERVALUE_UPSTREAMVERIFYCUSTOMCACERTINFOQUOTALIMIT = "InvalidParameterValue.UpstreamVerifyCustomCACertInfoQuotaLimit" // LIMITEXCEEDED_RATELIMITEXCEEDED = "LimitExceeded.RateLimitExceeded" @@ -12342,6 +12369,7 @@ func (c *Client) ModifyHostsCertificate(request *ModifyHostsCertificateRequest) // OPERATIONDENIED_CONFIGLOCKED = "OperationDenied.ConfigLocked" // OPERATIONDENIED_DISABLEZONENOTCOMPLETED = "OperationDenied.DisableZoneNotCompleted" // OPERATIONDENIED_ERRZONEISALREADYPAUSED = "OperationDenied.ErrZoneIsAlreadyPaused" +// OPERATIONDENIED_HOSTSCERTIFICATEINCONSISTENCY = "OperationDenied.HostsCertificateInconsistency" // OPERATIONDENIED_HOSTSCLIENTCERTIFICATEINCONSISTENCY = "OperationDenied.HostsClientCertificateInconsistency" // OPERATIONDENIED_HOSTSKEYLESSSERVERINCONSISTENCY = "OperationDenied.HostsKeylessServerInconsistency" // OPERATIONDENIED_HOSTSUPSTREAMCERTIFICATEINCONSISTENCY = "OperationDenied.HostsUpstreamCertificateInconsistency" @@ -15011,6 +15039,7 @@ func NewModifyZoneResponse() (response *ModifyZoneResponse) { // OPERATIONDENIED_NODOMAINACCESSZONEONLYSUPPORTMODIFYTYPE = "OperationDenied.NoDomainAccessZoneOnlySupportModifyType" // OPERATIONDENIED_PLANNOTSUPPORTMODIFYZONEAREA = "OperationDenied.PlanNotSupportModifyZoneArea" // OPERATIONDENIED_RESOURCELOCKEDTEMPORARY = "OperationDenied.ResourceLockedTemporary" +// OPERATIONDENIED_ZONEHASHOSTSMODIFYCONFLICT = "OperationDenied.ZoneHasHostsModifyConflict" // RESOURCEINUSE_CNAME = "ResourceInUse.Cname" // RESOURCEINUSE_DNS = "ResourceInUse.Dns" // RESOURCEINUSE_GENERICHOST = "ResourceInUse.GenericHost" @@ -15056,6 +15085,7 @@ func (c *Client) ModifyZone(request *ModifyZoneRequest) (response *ModifyZoneRes // OPERATIONDENIED_NODOMAINACCESSZONEONLYSUPPORTMODIFYTYPE = "OperationDenied.NoDomainAccessZoneOnlySupportModifyType" // OPERATIONDENIED_PLANNOTSUPPORTMODIFYZONEAREA = "OperationDenied.PlanNotSupportModifyZoneArea" // OPERATIONDENIED_RESOURCELOCKEDTEMPORARY = "OperationDenied.ResourceLockedTemporary" +// OPERATIONDENIED_ZONEHASHOSTSMODIFYCONFLICT = "OperationDenied.ZoneHasHostsModifyConflict" // RESOURCEINUSE_CNAME = "ResourceInUse.Cname" // RESOURCEINUSE_DNS = "ResourceInUse.Dns" // RESOURCEINUSE_GENERICHOST = "ResourceInUse.GenericHost" 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 560e0b754b..1501ff61cc 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 @@ -605,7 +605,7 @@ const ( // 无效的回源Host。 INVALIDPARAMETER_INVALIDSERVERNAME = "InvalidParameter.InvalidServerName" - // 设置的匹配条件不支持EdgeOne Shield操作,请删除相关配置项或联系智能客服提交工单处理。 + // 设置的匹配条件不支持 EdgeOne Shield 操作,请删除相关配置项。 INVALIDPARAMETER_INVALIDSHIELDUNSUPPORTED = "InvalidParameter.InvalidShieldUnsupported" // 排序字段不合法。 @@ -977,7 +977,7 @@ const ( // DNS 代理域名源站错误。 INVALIDPARAMETERVALUE_INVALIDPROXYORIGIN = "InvalidParameterValue.InvalidProxyOrigin" - // 存在源站故障转移配置项配置在不支持的匹配条件下,请删除相关配置项或联系智能客服提交工单处理。 + // 存在源站故障转移配置项配置在不支持的匹配条件下,请删除相关配置。 INVALIDPARAMETERVALUE_INVALIDSITEFAILOVERUNSUPPORTED = "InvalidParameterValue.InvalidSiteFailoverUnsupported" // 标签值存在不合法字符。 @@ -1187,6 +1187,9 @@ const ( // 站点处于停用状态,请开启后重试。 OPERATIONDENIED_ERRZONEISALREADYPAUSED = "OperationDenied.ErrZoneIsAlreadyPaused" + // 待变更域名边缘HTTPS证书不一致,请确认变更域名证书一致后重试。 + OPERATIONDENIED_HOSTSCERTIFICATEINCONSISTENCY = "OperationDenied.HostsCertificateInconsistency" + // 待变更域名边缘双向认证证书不一致,请确认变更域名证书一致后重试。 OPERATIONDENIED_HOSTSCLIENTCERTIFICATEINCONSISTENCY = "OperationDenied.HostsClientCertificateInconsistency" @@ -1382,6 +1385,9 @@ const ( // 站点工作模式不属于版本管理模式。 OPERATIONDENIED_WORKMODENOTINVERSIONCONTROL = "OperationDenied.WorkModeNotInVersionControl" + // 修改加速区域时,如果站点下存在域名,则不允许同时修改其他信息。 + OPERATIONDENIED_ZONEHASHOSTSMODIFYCONFLICT = "OperationDenied.ZoneHasHostsModifyConflict" + // 共享CNAME已被其他站点绑定,请先解绑才能删除站点 OPERATIONDENIED_ZONEISBINDINGSHAREDCNAME = "OperationDenied.ZoneIsBindingSharedCNAME" 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 af3b62ac69..cd8357a22c 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 @@ -573,7 +573,7 @@ type ApplicationProxy struct { //
  • 1:开启加速。
  • AccelerateType *int64 `json:"AccelerateType,omitnil,omitempty" name:"AccelerateType"` - // 会话保持时间。 + // 会话保持时间,单位为秒。 SessionPersistTime *uint64 `json:"SessionPersistTime,omitnil,omitempty" name:"SessionPersistTime"` // 状态,取值有: @@ -631,7 +631,7 @@ type ApplicationProxyRule struct { // 源站信息: //
  • 当 OriginType 为 custom 时,表示一个或多个源站,如`["8.8.8.8","9.9.9.9"]` 或 `OriginValue=["test.com"]`;
  • - //
  • 当 OriginType 为 loadbalancer 时,表示一个负载均衡,如`["lb-xdffsfasdfs"]`;
  • + //
  • 当 OriginType 为 loadbalancer 时,表示一个负载均衡,如`["lb-3pbiw4d9iqz0"]`;
  • //
  • 当 OriginType 为 origins 时,要求有且仅有一个元素,表示源站组ID,如`["origin-537f5b41-162a-11ed-abaa-525400c5da15"]`。
  • OriginValue []*string `json:"OriginValue,omitnil,omitempty" name:"OriginValue"` @@ -658,7 +658,7 @@ type ApplicationProxyRule struct { //
  • false:关闭。
  • 默认值:false。 SessionPersist *bool `json:"SessionPersist,omitnil,omitempty" name:"SessionPersist"` - // 会话保持的时间,只有当SessionPersist为true时,该值才会生效。 + // 会话保持的时间,单位为秒,只有当SessionPersist为true时,该值才会生效。 SessionPersistTime *uint64 `json:"SessionPersistTime,omitnil,omitempty" name:"SessionPersistTime"` // 源站端口,支持格式: @@ -2635,7 +2635,7 @@ type CreateApplicationProxyRuleRequestParams struct { //
  • false:关闭。
  • 默认值:false。 SessionPersist *bool `json:"SessionPersist,omitnil,omitempty" name:"SessionPersist"` - // 会话保持的时间,只有当SessionPersist为true时,该值才会生效。 + // 会话保持的时间,单位为秒,只有当SessionPersist为true时,该值才会生效。 SessionPersistTime *uint64 `json:"SessionPersistTime,omitnil,omitempty" name:"SessionPersistTime"` // 源站端口,支持格式: @@ -2690,7 +2690,7 @@ type CreateApplicationProxyRuleRequest struct { //
  • false:关闭。
  • 默认值:false。 SessionPersist *bool `json:"SessionPersist,omitnil,omitempty" name:"SessionPersist"` - // 会话保持的时间,只有当SessionPersist为true时,该值才会生效。 + // 会话保持的时间,单位为秒,只有当SessionPersist为true时,该值才会生效。 SessionPersistTime *uint64 `json:"SessionPersistTime,omitnil,omitempty" name:"SessionPersistTime"` // 源站端口,支持格式: @@ -3233,6 +3233,88 @@ func (r *CreateEdgeKVNamespaceResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type CreateFunctionReplicaRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 边缘函数副本名称。限制可输入 1-50 个字符,允许的字符为a-z、0-9、-,且-不能单独注册或连续使用,不能放在开头或结尾。同一 FunctionId 下副本名称需唯一。 + ReplicaName *string `json:"ReplicaName,omitnil,omitempty" name:"ReplicaName"` + + // 边缘函数副本内容,当前仅支持 JavaScript 代码,最大支持 5MB。 + Content *string `json:"Content,omitnil,omitempty" name:"Content"` + + // 边缘函数副本描述。最大支持 50 个字符。 + Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"` +} + +type CreateFunctionReplicaRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 边缘函数副本名称。限制可输入 1-50 个字符,允许的字符为a-z、0-9、-,且-不能单独注册或连续使用,不能放在开头或结尾。同一 FunctionId 下副本名称需唯一。 + ReplicaName *string `json:"ReplicaName,omitnil,omitempty" name:"ReplicaName"` + + // 边缘函数副本内容,当前仅支持 JavaScript 代码,最大支持 5MB。 + Content *string `json:"Content,omitnil,omitempty" name:"Content"` + + // 边缘函数副本描述。最大支持 50 个字符。 + Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"` +} + +func (r *CreateFunctionReplicaRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateFunctionReplicaRequest) 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, "FunctionId") + delete(f, "ReplicaName") + delete(f, "Content") + delete(f, "Remark") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateFunctionReplicaRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type CreateFunctionReplicaResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type CreateFunctionReplicaResponse struct { + *tchttp.BaseResponse + Response *CreateFunctionReplicaResponseParams `json:"Response"` +} + +func (r *CreateFunctionReplicaResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *CreateFunctionReplicaResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type CreateFunctionRequestParams struct { // 站点 ID。 @@ -4660,41 +4742,22 @@ type CreateRealtimeLogDeliveryTaskRequestParams struct { // 站点 ID。 ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + // 数据投递区域,可选值: + Area *string `json:"Area,omitnil,omitempty" name:"Area"` + + // 数据投递类型,可选值: + LogType *string `json:"LogType,omitnil,omitempty" name:"LogType"` + // 实时日志投递任务的名称,格式为数字、英文、-和_组合,最多 200 个字符。 TaskName *string `json:"TaskName,omitnil,omitempty" name:"TaskName"` - // 实时日志投递任务类型,取值有: - //
  • cls: 推送到腾讯云 CLS;
  • - //
  • custom_endpoint:推送到自定义 HTTP(S) 地址;
  • - //
  • s3:推送到 AWS S3 兼容存储桶地址;
  • - //
  • log_analysis:推送到 EdgeOne 日志分析,该任务类型仅支持“站点加速日志”这一数据投递类型。
  • + // 实时日志投递任务类型,取值有: TaskType *string `json:"TaskType,omitnil,omitempty" name:"TaskType"` - // 实时日志投递任务对应的实体列表。取值示例如下: - //
  • 七层域名:domain.example.com
  • - //
  • 四层代理实例:sid-2s69eb5wcms7
  • - //
  • 边缘函数实例:test-zone-2mxigizoh9l9-1257626257
  • + // 实时日志投递任务对应的实体列表。取值示例如下: EntityList []*string `json:"EntityList,omitnil,omitempty" name:"EntityList"` - // 数据投递类型,取值有: - //
  • domain:站点加速日志;
  • - //
  • application:四层代理日志;
  • - //
  • function:边缘函数运行日志;
  • - //
  • web-rateLiming:速率限制和 CC 攻击防护日志;
  • - //
  • web-attack:托管规则日志;
  • - //
  • web-rule:自定义规则日志;
  • - //
  • web-bot:Bot管理日志。
  • - LogType *string `json:"LogType,omitnil,omitempty" name:"LogType"` - - // 数据投递区域,取值有: - //
  • mainland:中国大陆境内;
  • - //
  • overseas:全球(不含中国大陆)。
  • - Area *string `json:"Area,omitnil,omitempty" name:"Area"` - - // 投递的预设字段列表。取值参考: - //
  • [站点加速日志(七层访问日志)](https://cloud.tencent.com/document/product/1552/105791)
  • - //
  • [四层代理日志](https://cloud.tencent.com/document/product/1552/105792)
  • - //
  • [边缘函数运行日志](https://cloud.tencent.com/document/product/1552/115585)
  • + // 投递的预设字段列表。取值参考: Fields []*string `json:"Fields,omitnil,omitempty" name:"Fields"` // 投递的自定义字段列表,支持在 HTTP 请求头、响应头、Cookie、请求正文中提取指定内容。自定义字段名称不能重复,且最多不能超过 200 个字段。单个实时日志推送任务最多添加 5 个请求正文类型的自定义字段。目前仅站点加速日志(LogType=domain)支持添加自定义字段。 @@ -4706,9 +4769,7 @@ type CreateRealtimeLogDeliveryTaskRequestParams struct { // 采样比例,采用千分制,取值范围为1-1000,例如:填写 605 表示采样比例为 60.5%。不填表示采样比例为 100%。 Sample *uint64 `json:"Sample,omitnil,omitempty" name:"Sample"` - // 日志投递的输出格式。不填表示为默认格式,默认格式逻辑如下: - //
  • 当 TaskType 取值为 custom_endpoint 时,默认格式为多个 JSON 对象组成的数组,每个 JSON 对象为一条日志;
  • - //
  • 当 TaskType 取值为 s3 时,默认格式为 JSON Lines;
  • 特别地,当 TaskType 取值为 cls 或 log_analysis 时,LogFormat.FormatType 的值只能为 json,且 LogFormat 中其他参数将被忽略,建议不传 LogFormat。 + // 日志投递的输出格式。不填表示为默认格式,默认格式逻辑如下:特别地,当 TaskType 取值为 cls 或 log_analysis 时,LogFormat.FormatType 的值只能为 json,且 LogFormat 中其他参数将被忽略,建议不传 LogFormat。 LogFormat *LogFormat `json:"LogFormat,omitnil,omitempty" name:"LogFormat"` // CLS 的配置信息。当 TaskType 取值为 cls 时,该参数必填。 @@ -4727,41 +4788,22 @@ type CreateRealtimeLogDeliveryTaskRequest struct { // 站点 ID。 ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + // 数据投递区域,可选值: + Area *string `json:"Area,omitnil,omitempty" name:"Area"` + + // 数据投递类型,可选值: + LogType *string `json:"LogType,omitnil,omitempty" name:"LogType"` + // 实时日志投递任务的名称,格式为数字、英文、-和_组合,最多 200 个字符。 TaskName *string `json:"TaskName,omitnil,omitempty" name:"TaskName"` - // 实时日志投递任务类型,取值有: - //
  • cls: 推送到腾讯云 CLS;
  • - //
  • custom_endpoint:推送到自定义 HTTP(S) 地址;
  • - //
  • s3:推送到 AWS S3 兼容存储桶地址;
  • - //
  • log_analysis:推送到 EdgeOne 日志分析,该任务类型仅支持“站点加速日志”这一数据投递类型。
  • + // 实时日志投递任务类型,取值有: TaskType *string `json:"TaskType,omitnil,omitempty" name:"TaskType"` - // 实时日志投递任务对应的实体列表。取值示例如下: - //
  • 七层域名:domain.example.com
  • - //
  • 四层代理实例:sid-2s69eb5wcms7
  • - //
  • 边缘函数实例:test-zone-2mxigizoh9l9-1257626257
  • + // 实时日志投递任务对应的实体列表。取值示例如下: EntityList []*string `json:"EntityList,omitnil,omitempty" name:"EntityList"` - // 数据投递类型,取值有: - //
  • domain:站点加速日志;
  • - //
  • application:四层代理日志;
  • - //
  • function:边缘函数运行日志;
  • - //
  • web-rateLiming:速率限制和 CC 攻击防护日志;
  • - //
  • web-attack:托管规则日志;
  • - //
  • web-rule:自定义规则日志;
  • - //
  • web-bot:Bot管理日志。
  • - LogType *string `json:"LogType,omitnil,omitempty" name:"LogType"` - - // 数据投递区域,取值有: - //
  • mainland:中国大陆境内;
  • - //
  • overseas:全球(不含中国大陆)。
  • - Area *string `json:"Area,omitnil,omitempty" name:"Area"` - - // 投递的预设字段列表。取值参考: - //
  • [站点加速日志(七层访问日志)](https://cloud.tencent.com/document/product/1552/105791)
  • - //
  • [四层代理日志](https://cloud.tencent.com/document/product/1552/105792)
  • - //
  • [边缘函数运行日志](https://cloud.tencent.com/document/product/1552/115585)
  • + // 投递的预设字段列表。取值参考: Fields []*string `json:"Fields,omitnil,omitempty" name:"Fields"` // 投递的自定义字段列表,支持在 HTTP 请求头、响应头、Cookie、请求正文中提取指定内容。自定义字段名称不能重复,且最多不能超过 200 个字段。单个实时日志推送任务最多添加 5 个请求正文类型的自定义字段。目前仅站点加速日志(LogType=domain)支持添加自定义字段。 @@ -4773,9 +4815,7 @@ type CreateRealtimeLogDeliveryTaskRequest struct { // 采样比例,采用千分制,取值范围为1-1000,例如:填写 605 表示采样比例为 60.5%。不填表示采样比例为 100%。 Sample *uint64 `json:"Sample,omitnil,omitempty" name:"Sample"` - // 日志投递的输出格式。不填表示为默认格式,默认格式逻辑如下: - //
  • 当 TaskType 取值为 custom_endpoint 时,默认格式为多个 JSON 对象组成的数组,每个 JSON 对象为一条日志;
  • - //
  • 当 TaskType 取值为 s3 时,默认格式为 JSON Lines;
  • 特别地,当 TaskType 取值为 cls 或 log_analysis 时,LogFormat.FormatType 的值只能为 json,且 LogFormat 中其他参数将被忽略,建议不传 LogFormat。 + // 日志投递的输出格式。不填表示为默认格式,默认格式逻辑如下:特别地,当 TaskType 取值为 cls 或 log_analysis 时,LogFormat.FormatType 的值只能为 json,且 LogFormat 中其他参数将被忽略,建议不传 LogFormat。 LogFormat *LogFormat `json:"LogFormat,omitnil,omitempty" name:"LogFormat"` // CLS 的配置信息。当 TaskType 取值为 cls 时,该参数必填。 @@ -4801,11 +4841,11 @@ func (r *CreateRealtimeLogDeliveryTaskRequest) FromJsonString(s string) error { return err } delete(f, "ZoneId") + delete(f, "Area") + delete(f, "LogType") delete(f, "TaskName") delete(f, "TaskType") delete(f, "EntityList") - delete(f, "LogType") - delete(f, "Area") delete(f, "Fields") delete(f, "CustomFields") delete(f, "DeliveryConditions") @@ -6328,6 +6368,74 @@ func (r *DeleteEdgeKVNamespaceResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type DeleteFunctionReplicaRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 需要删除的函数的副本名称。支持以列表的形式传入。 + ReplicaNames []*string `json:"ReplicaNames,omitnil,omitempty" name:"ReplicaNames"` +} + +type DeleteFunctionReplicaRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 需要删除的函数的副本名称。支持以列表的形式传入。 + ReplicaNames []*string `json:"ReplicaNames,omitnil,omitempty" name:"ReplicaNames"` +} + +func (r *DeleteFunctionReplicaRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteFunctionReplicaRequest) 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, "FunctionId") + delete(f, "ReplicaNames") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteFunctionReplicaRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteFunctionReplicaResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeleteFunctionReplicaResponse struct { + *tchttp.BaseResponse + Response *DeleteFunctionReplicaResponseParams `json:"Response"` +} + +func (r *DeleteFunctionReplicaResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteFunctionReplicaResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type DeleteFunctionRequestParams struct { // 站点 ID。 @@ -9540,6 +9648,108 @@ func (r *DescribeFunctionComponentBindingsResponse) FromJsonString(s string) err return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type DescribeFunctionReplicasRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 分页查询偏移量。默认值:0。 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 分页查询限制数目。默认值:20,最大值:200。 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 排序依据,取值有:
  • created-on:创建时间。
  • 默认根据 created-on 属性排序。 + SortBy *string `json:"SortBy,omitnil,omitempty" name:"SortBy"` + + // 列表排序方式,取值有:
  • asc:升序排列;
  • desc:降序排列。
  • 默认值为 asc。 + SortOrder *string `json:"SortOrder,omitnil,omitempty" name:"SortOrder"` + + // 过滤条件,Filters.Values 的上限为 20。该参数不填写时,返回函数 ID 下全部函数副本。详细的过滤条件如下:
  • replica-name:按照函数副本名称进行过滤,支持模糊查询。
  • + Filters []*AdvancedFilter `json:"Filters,omitnil,omitempty" name:"Filters"` +} + +type DescribeFunctionReplicasRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 分页查询偏移量。默认值:0。 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 分页查询限制数目。默认值:20,最大值:200。 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` + + // 排序依据,取值有:
  • created-on:创建时间。
  • 默认根据 created-on 属性排序。 + SortBy *string `json:"SortBy,omitnil,omitempty" name:"SortBy"` + + // 列表排序方式,取值有:
  • asc:升序排列;
  • desc:降序排列。
  • 默认值为 asc。 + SortOrder *string `json:"SortOrder,omitnil,omitempty" name:"SortOrder"` + + // 过滤条件,Filters.Values 的上限为 20。该参数不填写时,返回函数 ID 下全部函数副本。详细的过滤条件如下:
  • replica-name:按照函数副本名称进行过滤,支持模糊查询。
  • + Filters []*AdvancedFilter `json:"Filters,omitnil,omitempty" name:"Filters"` +} + +func (r *DescribeFunctionReplicasRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeFunctionReplicasRequest) 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, "FunctionId") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "SortBy") + delete(f, "SortOrder") + delete(f, "Filters") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeFunctionReplicasRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeFunctionReplicasResponseParams struct { + // 边缘函数副本总数。 + TotalCount *int64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"` + + // 边缘函数副本列表。 + FunctionReplicas []*FunctionReplica `json:"FunctionReplicas,omitnil,omitempty" name:"FunctionReplicas"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeFunctionReplicasResponse struct { + *tchttp.BaseResponse + Response *DescribeFunctionReplicasResponseParams `json:"Response"` +} + +func (r *DescribeFunctionReplicasResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeFunctionReplicasResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type DescribeFunctionRulesRequestParams struct { // 站点 ID。 @@ -14706,10 +14916,10 @@ type EdgeKVPutRequestParams struct { // 键值。不能为空,最大支持 1 MB。支持存储字符串数据。 Value *string `json:"Value,omitnil,omitempty" name:"Value"` - // 过期时间,绝对时间。表示从 1970 年 1 月 1 日(UTC/GMT 的午夜)开始所经过的秒数,不能小于当前时间。若 Expiration 和 ExpirationTTL 都填写,以 ExpirationTTL 为准。若 Expiration 和 ExpirationTTL 都不填写,则该键值对永不过期。 + // 键值对的过期时间,绝对时间,单位为秒,表示从 1970 年 1 月 1 日 00:00:00(UTC)起经过的秒数(即 Unix 时间戳)。取值必须大于等于当前时间 + 60,即过期时间距当前至少 60 秒。当 Expiration 与 ExpirationTTL 同时填写时,以 ExpirationTTL 为准;当两者均不填写时,键值对永不过期。 Expiration *int64 `json:"Expiration,omitnil,omitempty" name:"Expiration"` - // 过期时间,相对时间,单位为秒。表示数据将在指定秒数后过期,必须大于 0。若 Expiration 和 ExpirationTTL 都填写,以 ExpirationTTL 为准。若 Expiration 和 ExpirationTTL 都不填写,则该键值对永不过期。 + // 键值对的存活时长,相对时间,单位为秒,表示数据将在写入后经过指定秒数过期。取值范围:大于等于 60。当 Expiration 与 ExpirationTTL 同时填写时,以 ExpirationTTL 为准;当两者均不填写时,键值对永不过期。 ExpirationTTL *int64 `json:"ExpirationTTL,omitnil,omitempty" name:"ExpirationTTL"` } @@ -14728,10 +14938,10 @@ type EdgeKVPutRequest struct { // 键值。不能为空,最大支持 1 MB。支持存储字符串数据。 Value *string `json:"Value,omitnil,omitempty" name:"Value"` - // 过期时间,绝对时间。表示从 1970 年 1 月 1 日(UTC/GMT 的午夜)开始所经过的秒数,不能小于当前时间。若 Expiration 和 ExpirationTTL 都填写,以 ExpirationTTL 为准。若 Expiration 和 ExpirationTTL 都不填写,则该键值对永不过期。 + // 键值对的过期时间,绝对时间,单位为秒,表示从 1970 年 1 月 1 日 00:00:00(UTC)起经过的秒数(即 Unix 时间戳)。取值必须大于等于当前时间 + 60,即过期时间距当前至少 60 秒。当 Expiration 与 ExpirationTTL 同时填写时,以 ExpirationTTL 为准;当两者均不填写时,键值对永不过期。 Expiration *int64 `json:"Expiration,omitnil,omitempty" name:"Expiration"` - // 过期时间,相对时间,单位为秒。表示数据将在指定秒数后过期,必须大于 0。若 Expiration 和 ExpirationTTL 都填写,以 ExpirationTTL 为准。若 Expiration 和 ExpirationTTL 都不填写,则该键值对永不过期。 + // 键值对的存活时长,相对时间,单位为秒,表示数据将在写入后经过指定秒数过期。取值范围:大于等于 60。当 Expiration 与 ExpirationTTL 同时填写时,以 ExpirationTTL 为准;当两者均不填写时,键值对永不过期。 ExpirationTTL *int64 `json:"ExpirationTTL,omitnil,omitempty" name:"ExpirationTTL"` } @@ -15096,7 +15306,7 @@ type ExportZoneConfigRequestParams struct { // 站点 ID。 ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` - // 导出配置项的类型列表,不填表示导出所有类型的配置,当前支持的取值有:
  • L7AccelerationConfig:表示导出七层加速配置,对应控制台「站点加速-全局加速配置」和「站点加速-规则引擎」。
  • WebSecurity:表示导出 Web 防护配置。
  • 需注意:后续支持导出的类型会随着迭代增加,导出所有类型时需要注意导出文件大小,建议使用时指定需要导出的配置类型,以便控制请求响应包负载大小。 + // 导出配置项的类型列表,不填表示导出所有类型的配置,当前支持的取值有:
  • L7AccelerationConfig:表示导出七层加速配置,对应控制台「站点加速-全局加速配置」和「站点加速-规则引擎」。
  • WebSecurity:表示导出 Web 防护配置。
  • AccelerationDomain:表示导出加速域名配置,对应控制台「域名服务-域名管理」和「域名服务-共享 CNAME 管理」。
  • Origin:表示导出源站配置,对应控制台「源站配置-源站组」和「源站配置-负载均衡」。
  • 需注意:后续支持导出的类型会随着迭代增加,导出所有类型时需要注意导出文件大小,建议使用时指定需要导出的配置类型,以便控制请求响应包负载大小。 Types []*string `json:"Types,omitnil,omitempty" name:"Types"` } @@ -15106,7 +15316,7 @@ type ExportZoneConfigRequest struct { // 站点 ID。 ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` - // 导出配置项的类型列表,不填表示导出所有类型的配置,当前支持的取值有:
  • L7AccelerationConfig:表示导出七层加速配置,对应控制台「站点加速-全局加速配置」和「站点加速-规则引擎」。
  • WebSecurity:表示导出 Web 防护配置。
  • 需注意:后续支持导出的类型会随着迭代增加,导出所有类型时需要注意导出文件大小,建议使用时指定需要导出的配置类型,以便控制请求响应包负载大小。 + // 导出配置项的类型列表,不填表示导出所有类型的配置,当前支持的取值有:
  • L7AccelerationConfig:表示导出七层加速配置,对应控制台「站点加速-全局加速配置」和「站点加速-规则引擎」。
  • WebSecurity:表示导出 Web 防护配置。
  • AccelerationDomain:表示导出加速域名配置,对应控制台「域名服务-域名管理」和「域名服务-共享 CNAME 管理」。
  • Origin:表示导出源站配置,对应控制台「源站配置-源站组」和「源站配置-负载均衡」。
  • 需注意:后续支持导出的类型会随着迭代增加,导出所有类型时需要注意导出文件大小,建议使用时指定需要导出的配置类型,以便控制请求响应包负载大小。 Types []*string `json:"Types,omitnil,omitempty" name:"Types"` } @@ -15352,6 +15562,26 @@ type FunctionRegionSelection struct { Regions []*string `json:"Regions,omitnil,omitempty" name:"Regions"` } +type FunctionReplica struct { + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 边缘函数副本名称。 + ReplicaName *string `json:"ReplicaName,omitnil,omitempty" name:"ReplicaName"` + + // 边缘函数副本内容。格式为 JavaScript 代码。 + Content *string `json:"Content,omitnil,omitempty" name:"Content"` + + // 边缘函数副本描述。 + Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"` + + // 边缘函数副本创建时间。 + CreatedOn *string `json:"CreatedOn,omitnil,omitempty" name:"CreatedOn"` + + // 边缘函数副本更新时间。 + ModifiedOn *string `json:"ModifiedOn,omitnil,omitempty" name:"ModifiedOn"` +} + type FunctionRule struct { // 规则ID。 RuleId *string `json:"RuleId,omitnil,omitempty" name:"RuleId"` @@ -15589,10 +15819,10 @@ type HealthChecker struct { // 检查端口。当 Type=HTTP 或 Type=HTTPS 或 Type=TCP 或 Type=UDP 时为必填。 Port *uint64 `json:"Port,omitnil,omitempty" name:"Port"` - // 检查频率,表示多久发起一次健康检查任务,单位为秒。可取值有:30,60,180,300 或 600。 + // 检查频率,表示多久发起一次健康检查任务,单位为秒。可配置 10-600 秒。 Interval *uint64 `json:"Interval,omitnil,omitempty" name:"Interval"` - // 每一次健康检查的超时时间,若健康检查消耗时间大于此值,则检查结果判定为”不健康“, 单位为秒,默认值为 5s,取值必须小于 Interval。 + // 每一次健康检查的超时时间,若健康检查消耗时间大于此值,则检查结果判定为“不健康”, 单位为秒,默认值为 5s,取值必须小于 Interval。 Timeout *uint64 `json:"Timeout,omitnil,omitempty" name:"Timeout"` // 健康阈值,表示连续几次健康检查结果为"健康",则判断源站为"健康",单位为次,默认 3 次,最小取值 1 次。 @@ -17148,7 +17378,7 @@ type ModifyApplicationProxyRuleRequestParams struct { //
  • false:关闭。
  • 不填为false。 SessionPersist *bool `json:"SessionPersist,omitnil,omitempty" name:"SessionPersist"` - // 会话保持的时间,只有当SessionPersist为true时,该值才会生效。 + // 会话保持的时间,单位为秒,只有当SessionPersist为true时,该值才会生效。 SessionPersistTime *uint64 `json:"SessionPersistTime,omitnil,omitempty" name:"SessionPersistTime"` // 源站端口,支持格式: @@ -17206,7 +17436,7 @@ type ModifyApplicationProxyRuleRequest struct { //
  • false:关闭。
  • 不填为false。 SessionPersist *bool `json:"SessionPersist,omitnil,omitempty" name:"SessionPersist"` - // 会话保持的时间,只有当SessionPersist为true时,该值才会生效。 + // 会话保持的时间,单位为秒,只有当SessionPersist为true时,该值才会生效。 SessionPersistTime *uint64 `json:"SessionPersistTime,omitnil,omitempty" name:"SessionPersistTime"` // 源站端口,支持格式: @@ -17912,6 +18142,88 @@ func (r *ModifyFunctionComponentBindingsResponse) FromJsonString(s string) error return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type ModifyFunctionReplicaRequestParams struct { + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 需要修改的边缘函数副本名称。 + ReplicaName *string `json:"ReplicaName,omitnil,omitempty" name:"ReplicaName"` + + // 边缘函数副本内容,当前仅支持 JavaScript 代码,最大支持 5MB。 + Content *string `json:"Content,omitnil,omitempty" name:"Content"` + + // 边缘函数副本描述。最大支持 50 个字符。 + Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"` +} + +type ModifyFunctionReplicaRequest struct { + *tchttp.BaseRequest + + // 站点 ID。 + ZoneId *string `json:"ZoneId,omitnil,omitempty" name:"ZoneId"` + + // 函数 ID。 + FunctionId *string `json:"FunctionId,omitnil,omitempty" name:"FunctionId"` + + // 需要修改的边缘函数副本名称。 + ReplicaName *string `json:"ReplicaName,omitnil,omitempty" name:"ReplicaName"` + + // 边缘函数副本内容,当前仅支持 JavaScript 代码,最大支持 5MB。 + Content *string `json:"Content,omitnil,omitempty" name:"Content"` + + // 边缘函数副本描述。最大支持 50 个字符。 + Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"` +} + +func (r *ModifyFunctionReplicaRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyFunctionReplicaRequest) 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, "FunctionId") + delete(f, "ReplicaName") + delete(f, "Content") + delete(f, "Remark") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyFunctionReplicaRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyFunctionReplicaResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyFunctionReplicaResponse struct { + *tchttp.BaseResponse + Response *ModifyFunctionReplicaResponseParams `json:"Response"` +} + +func (r *ModifyFunctionReplicaResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyFunctionReplicaResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type ModifyFunctionRequestParams struct { // 站点 ID。 @@ -19364,7 +19676,7 @@ type ModifyOriginParameters struct { // 源站类型。取值有: //
  • IPDomain:IPV4、IPV6 或域名类型源站;
  • //
  • OriginGroup:源站组类型源站;
  • - //
  • LoadBalance:负载均衡,该功能内测中,如需使用,请提工单或联系智能客服;
  • + //
  • LoadBalance:负载均衡,该功能内测中,如需使用,请提工单;
  • //
  • COS:腾讯云 COS 对象存储源站;
  • //
  • AWSS3:支持 AWS S3 协议的所有对象存储源站。
  • OriginType *string `json:"OriginType,omitnil,omitempty" name:"OriginType"` @@ -21895,6 +22207,9 @@ type RateLimitingRule struct { // 精准速率限制的具体内容,需符合表达式语法,详细规范参见[产品文档](https://cloud.tencent.com/document/product/1552/125343)。 Condition *string `json:"Condition,omitnil,omitempty" name:"Condition"` + // 限速方式。在统计时间窗口 CountingPeriod 内,对满足特征 CountBy 的请求,支持配置以下限速方式:
  • Block: 阻断访问源。当统计次数超过阈值 MaxRequestThreshold 时,在 ActionDuration 时长内,对满足特征的所有后续请求执行 Action 处置;
  • Throttle: 仅处置超额请求。当统计次数超过阈值 MaxRequestThreshold 时,仅对超过阈值的请求执行 Action 处置,窗口结束后停止处置。此时,ActionDuration 参数将被忽略。

  • 默认值为 Block。 + Mode *string `json:"Mode,omitnil,omitempty" name:"Mode"` + // 速率阈值请求特征的匹配方式, 当 Enabled 为 on 时,此字段必填。

    当条件有多个时,将组合多个条件共同进行统计计算,条件最多不可超过5条。取值有:
  • http.request.ip:客户端 IP;
  • http.request.xff_header_ip:客户端 IP(优先匹配 XFF 头部);
  • http.request.uri.path:请求的访问路径;
  • http.request.cookies['session']:名称为 session 的 Cookie,其中 session 可替换为自己指定的参数;
  • http.request.headers['user-agent']:名称为 user-agent 的 HTTP 头部,其中 user-agent 可替换为自己指定的参数;
  • http.request.ja3:请求的 JA3 指纹;
  • http.request.ja4:请求的 JA4 指纹;
  • http.request.uri.query['test']:名称为 test 的 URL 查询参数,其中 test 可替换为自己指定的参数。
  • CountBy []*string `json:"CountBy,omitnil,omitempty" name:"CountBy"` @@ -21904,7 +22219,7 @@ type RateLimitingRule struct { // 统计的时间窗口,取值有:
  • 1s:1秒;
  • 5s:5秒;
  • 10s:10秒;
  • 20s:20秒;
  • 30s:30秒;
  • 40s:40秒;
  • 50s:50秒;
  • 1m:1分钟;
  • 2m:2分钟;
  • 5m:5分钟;
  • 10m:10分钟;
  • 1h:1小时。
  • CountingPeriod *string `json:"CountingPeriod,omitnil,omitempty" name:"CountingPeriod"` - // Action 动作的持续时长,单位仅支持:
  • s:秒,取值 1 ~ 120;
  • m:分钟,取值 1 ~ 120;
  • h:小时,取值 1 ~ 48;
  • d:天,取值 1 ~ 30。
  • + // Action 动作的持续时长,单位仅支持:
  • s:秒,取值 1 ~ 120;
  • m:分钟,取值 1 ~ 120;
  • h:小时,取值 1 ~ 48;
  • d:天,取值 1 ~ 30。

  • 当 Mode 为 Throttle 时,此参数将被忽略,不会生效。 ActionDuration *string `json:"ActionDuration,omitnil,omitempty" name:"ActionDuration"` // 精准速率限制的处置方式。取值有:
  • Monitor:观察;
  • Deny:拦截,其中DenyActionParameters.Name支持Deny和ReturnCustomPage;
  • Challenge:挑战,其中ChallengeActionParameters.Name支持JSChallenge和ManagedChallenge;
  • Redirect:重定向至URL;
  • @@ -22404,6 +22719,7 @@ type RuleEngineAction struct { //
  • Shield:源站卸载配置;
  • //
  • TLSConfig:SSL/TLS 安全;
  • //
  • ModifyOrigin:修改源站;
  • + //
  • SiteFailover:源站故障转移;
  • //
  • HTTPUpstreamTimeout:七层回源超时配置;
  • //
  • HttpResponse:HTTP 应答;
  • //
  • ErrorPage:自定义错误页面;
  • @@ -22532,6 +22848,10 @@ type RuleEngineAction struct { // 注意:此字段可能返回 null,表示取不到有效值。 ModifyOriginParameters *ModifyOriginParameters `json:"ModifyOriginParameters,omitnil,omitempty" name:"ModifyOriginParameters"` + // 源站故障转移配置参数,当 Name 取值为 SiteFailover 时,该参数必填。 + // 注意:此字段可能返回 null,表示取不到有效值。 + SiteFailoverParameters *SiteFailoverParameters `json:"SiteFailoverParameters,omitnil,omitempty" name:"SiteFailoverParameters"` + // 七层回源超时配置,当 Name 取值为 HTTPUpstreamTimeout 时,该参数必填。 // 注意:此字段可能返回 null,表示取不到有效值。 HTTPUpstreamTimeoutParameters *HTTPUpstreamTimeoutParameters `json:"HTTPUpstreamTimeoutParameters,omitnil,omitempty" name:"HTTPUpstreamTimeoutParameters"` @@ -22991,6 +23311,73 @@ type ShieldParameters struct { ShieldSpaceId *string `json:"ShieldSpaceId,omitnil,omitempty" name:"ShieldSpaceId"` } +type SiteFailover struct { + // 源站故障转移类型。取值有: + //
  • FailoverToHost:回源到指定 IP/域名;
  • + //
  • FailoverToCOS:回源到腾讯云 COS;
  • + //
  • FailoverToS3CompatibleObjectStorage:回源到 S3 兼容;
  • + //
  • FailoverRedirectToURL :重定向至指定 URL;
  • + //
  • FailoverCustomResponsePage:使用自定义响应页面。
  • + Mode *string `json:"Mode,omitnil,omitempty" name:"Mode"` + + // 源站地址,根据 Mode 的取值分为以下情况: + //
  • 当 Mode = FailoverToHost 时,该参数请填写 IPV4、IPV6 地址或域名;
  • + //
  • 当 Mode = FailoverToCOS 时,该参数请填写 COS 桶的访问域名;
  • + //
  • 当 Mode = FailoverToS3CompatibleObjectStorage,该参数请填写 S3 桶的访问域名。
  • + Origin *string `json:"Origin,omitnil,omitempty" name:"Origin"` + + // 回源协议配置。当 Mode 取值为 FailoverToHost 时该参数必填。取值有: + //
  • http:使用 HTTP 协议;
  • + //
  • https:使用 HTTPS 协议;
  • + //
  • follow:协议跟随。
  • + OriginProtocol *string `json:"OriginProtocol,omitnil,omitempty" name:"OriginProtocol"` + + // HTTP 回源端口,取值范围 1~65535。当回源协议 OriginProtocol 为 http 或者 follow 时该参数必填。 + HTTPOriginPort *int64 `json:"HTTPOriginPort,omitnil,omitempty" name:"HTTPOriginPort"` + + // HTTPS 回源端口,取值范围 1~65535。当回源协议 OriginProtocol 为 https 或者 follow 时该参数必填。 + HTTPSOriginPort *int64 `json:"HTTPSOriginPort,omitnil,omitempty" name:"HTTPSOriginPort"` + + // 回源Host Header 重写配置, + UpstreamHostHeader *HostHeaderParameters `json:"UpstreamHostHeader,omitnil,omitempty" name:"UpstreamHostHeader"` + + // 回源 URL 重写配置。 + UpstreamURLRewrite *UpstreamURLRewriteParameters `json:"UpstreamURLRewrite,omitnil,omitempty" name:"UpstreamURLRewrite"` + + // 回源请求参数配置。 + UpstreamRequestParameters *UpstreamRequestParameters `json:"UpstreamRequestParameters,omitnil,omitempty" name:"UpstreamRequestParameters"` + + // HTTP2 回源配置参数。 + UpstreamHTTP2Parameters *UpstreamHTTP2Parameters `json:"UpstreamHTTP2Parameters,omitnil,omitempty" name:"UpstreamHTTP2Parameters"` + + // 指定是否允许访问私有对象存储源站,当源站类型 Mode = FailoverToCOS 或 FailoverToS3CompatibleObjectStorage 时该参数必填,取值有: + //
  • on:使用私有鉴权;
  • + //
  • off:不使用私有鉴权。
  • + PrivateAccess *string `json:"PrivateAccess,omitnil,omitempty" name:"PrivateAccess"` + + // 私有鉴权使用参数,该参数仅当 Mode = FailoverToS3CompatibleObjectStorage 且 PrivateAccess = on 时会生效。 + PrivateParameters *OriginPrivateParameters `json:"PrivateParameters,omitnil,omitempty" name:"PrivateParameters"` + + // 重定向目标 URL。当 Mode 取值为 FailoverRedirectToURL 时该参数必填。 + RedirectURL *string `json:"RedirectURL,omitnil,omitempty" name:"RedirectURL"` + + // 响应页面 ID。当 Mode 取值为 FailoverCustomResponsePage 时该参数必填。 + ResponsePageId *string `json:"ResponsePageId,omitnil,omitempty" name:"ResponsePageId"` + + // 响应状态码。当 Mode 取值为 FailoverRedirectToURL 或 FailoverCustomResponsePage 时该参数必填。取值有: + //
  • 当 Mode = FailoverRedirectToURL 时,该参数取值为 301、302、303、307、308 之一;
  • + //
  • 当 Mode = FailoverCustomResponsePage 时,该参数取值为 400、403、404、405、414、416、451、500、501、502、503、504 之一。
  • + StatusCode *int64 `json:"StatusCode,omitnil,omitempty" name:"StatusCode"` +} + +type SiteFailoverParameters struct { + // 源站故障转移条件状态码。当源站返回的响应状态码命中本字段返回时,才会按照SiteFailoverParams执行源站转移。该参数取值为 4xx、5xx 之一。 + SiteFailoverStatusCodes []*int64 `json:"SiteFailoverStatusCodes,omitnil,omitempty" name:"SiteFailoverStatusCodes"` + + // 源站故障转移配置参数列表。最小长度为1,最大长度为2。 + SiteFailoverParams []*SiteFailover `json:"SiteFailoverParams,omitnil,omitempty" name:"SiteFailoverParams"` +} + type SkipCondition struct { // 例外跳过类型,取值为: //
  • header_fields:HTTP请求Header;
  • diff --git a/vendor/modules.txt b/vendor/modules.txt index 02a5b7562f..8f13c9fef5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1359,7 +1359,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq/v20200217 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.578 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem/v20210701 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.90 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.3.108 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998 diff --git a/website/docs/r/teo_edge_k_v_namespace.html.markdown b/website/docs/r/teo_edge_k_v_namespace.html.markdown new file mode 100644 index 0000000000..0ddb3392fe --- /dev/null +++ b/website/docs/r/teo_edge_k_v_namespace.html.markdown @@ -0,0 +1,47 @@ +--- +subcategory: "TencentCloud EdgeOne(TEO)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_edge_k_v_namespace" +sidebar_current: "docs-tencentcloud-resource-teo_edge_k_v_namespace" +description: |- + Provides a resource to create a TEO edge KV namespace +--- + +# tencentcloud_teo_edge_k_v_namespace + +Provides a resource to create a TEO edge KV namespace + +## Example Usage + +```hcl +resource "tencentcloud_teo_edge_k_v_namespace" "example" { + zone_id = "zone-2o3h21ed2t68" + namespace = "my-namespace" + remark = "This is an example namespace" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `namespace` - (Required, String, ForceNew) Namespace name. Supports 1-50 characters, allowed characters are a-z, A-Z, 0-9, -. +* `zone_id` - (Required, String, ForceNew) Site ID. +* `remark` - (Optional, String) Namespace description. Maximum 256 characters. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +TEO edge KV namespace can be imported using the composite id (zone_id#namespace), e.g. + +```` +terraform import tencentcloud_teo_edge_k_v_namespace.example zone-2o3h21ed2t68#my-namespace +```` + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index e77304a32b..5a857e648a 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -5951,6 +5951,9 @@
  • tencentcloud_teo_dns_record
  • +
  • + tencentcloud_teo_edge_k_v_namespace +
  • tencentcloud_teo_function