一、描述
云应用 API 处理器。约定如下:
二、示例
resource "cloudapp_api_handler" "APIServer" { vpc_id = var.app_target.vpc.id host = cloudapp_tke_service.backend.host handler_protocol = "http" handler_path = "/api/:api_name"}
三、参数说明
| 类型 | 名称 | 数据类型 | 说明 |
| 必填 | region | string | 地域,如:ap-guangzhou,默认使用 provider 中定义的 region 也可以在 resource 中指定地域,覆盖默认设置 |
| 必填 | handler_protocol | enum | 这里是内网协议枚举值:httphttpshttp&https |
| 必填 | vpc_id | string | API 服务所在的 VPC |
| 必填 | handler_path | string | 前端 API 路径支持模板字符串,如以下定义,最终的路径为:/api/GetLoadBalanceOverviewresource "cloudapp_api_handler" "APIServer" { vpc_id = var.app_target.vpc.id host = cloudapp_tke_service.backend.host handler_protocol = "http" handler_path = "/api/:api_name"}resource "cloudapp_api" "GetClbOverview" { handler_id = cloudapp_api_handler.APIServer.id api_name = "GetLoadBalanceOverview" api_desc = "获取负载均衡情况"} |
| 必填 | host | string | 后端服务的 host |
| 可选 | availability_zone | string | 可用区 |
| 可选 | count | int | 资源数量,默认为 1 如果为 0 则不创建资源 |
| 可选 | activity_id | int | 计费活动 ID,保留字段 |
| 生成 | id | string | 资源实例 ID |
| 生成 | create_time | string | 资源创建时间 |
| 生成 | apiapp_name | string | API 网关的应用名称 |
| 生成 | apiapp_id | string | API 网关的应用 ID |
| 生成 | name | string | API 网关服务名称 |
| 生成 | outer_sub_domain | string | 外网访问子域名 |
| 生成 | net_type | enum | 网络类型,目前仅支持 OUTER枚举值:INNER:内网访问OUTER:外网访问 |
| 生成 | ip_version | enum | IP 版本枚举值:IPv4:IP 版本为 ipv4IPv6:IP 版本为 ipv6 |
| 生成 | service_url | string | 接口的服务主域名地址,由协议和服务的 host(一般是服务 IP),如:http://100.1.1.1:8080通过 ${service_url}${handler_path} 可以拼接出完整的地址 |