Skip to content

Commit 9814c9a

Browse files
authored
docs: add document for outputs (#44)
* doc: update outputs doc * doc: fix type misrender * doc: modify link from relative to absolute * Update README.md move output.md introduce part
1 parent aa64092 commit 9814c9a

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ serverless deploy
4343

4444
> **说明**:如果鉴权失败,请参考 [权限配置](https://cloud.tencent.com/document/product/1154/43006) 进行授权。
4545
46+
部署完成后,控制台会打印相关的输出信息,您可以通过 `${output:${stage}:${app}:apigw.url}` 的形式在其他 `serverless` 组件中引用该组件的 API 网关访问链接(或通过类似的形式引用该组建其他输出结果),具体的,可以查看完成的输出文档:
47+
48+
- [点击此处查看输出文档](https://github.com/serverless-components/tencent-koa/tree/master/docs/output.md)
49+
4650
### 4. 配置
4751

4852
koa 组件支持 0 配置部署,也就是可以直接通过配置文件中的默认值进行部署。但你依然可以修改更多可选配置来进一步开发该 koa 项目。

docs/output.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# 部署 output 参数介绍
2+
3+
> 组件输出可以在别的组件中通过 `${output:${stage}:${app}:<name>.<variable_name>}` 获取
4+
>
5+
> 例如,如果该组件名称是 `test_name`, ·且只部署于一个地域,则可以通过 `${output:${stage}:${app}:test_name.apigw.url}` 在别的组件中获取该组件的 API 网关的 `url`
6+
7+
| 名称 | 类型 | 描述 |
8+
| :---------- | :-------------: | :----------------------------------------------------- | ---------------- |
9+
| templateUrl | string | 未提供代码时的模板代码 url |
10+
| region | string | 地域信息(只有一个地域时才提供) |
11+
| scf | [`FunctionOutput | Record<string,FunctionOutput>`](#云函数输出-`FunctionOutput`) | 云函数输出信息 |
12+
| apigw | [`ApigwOutput | Record<string:ApigwOutput>`](#API-网关输出-`ApigwOutput`) | API 网关输出信息 |
13+
14+
## 云函数输出 `FunctionOutput`
15+
16+
| 名称 | 类型 | 描述 |
17+
| :------------------- | :------------: | :--------------------- |
18+
| functionName | string | 云函数名称 |
19+
| runtime | string | 云运行环境 |
20+
| namespace | string | 云函数名称空间 |
21+
| lastVersion | string | 云函数版本 |
22+
| traffic | `number (0~1)` | 将多少流量导向该云函数 |
23+
| configTrafficVersion | string | |
24+
25+
## API 网关输出 `ApigwOutput`
26+
27+
| 名称 | 类型 | 描述 |
28+
| :------------ | :------------------------------------------------------------------: | :------------------------- | ------- | -------- |
29+
| serviceId | string | API 网关 ID |
30+
| subDomain | string | API 网关子域名 |
31+
| enviroment | `"release" | "prepub" | "test"` | API 网关 |
32+
| url | string | API 网关对外的完整 URL |
33+
| traffic | number (0~1) | 将多少流量导向该云函数 |
34+
| customDomains | [CustomDomain[]](#API-网关自定义域名输出-`ApigwOutput.CustomDomain`) | API 网关自定义域名输出列表 |
35+
36+
## API 网关自定义域名输出 `ApigwOutput.CustomDomain`
37+
38+
| 名称 | 类型 | 描述 |
39+
| :--------------- | :----------------------------------------------------------------: | :------------------------- | ---------- |
40+
| domain | string | 自定义域名 |
41+
| certificateId | string | 域名证书 ID |
42+
| isDefaultMapping | boolean | 该自定义域名是否为默认域名 |
43+
| pathMappingSet | [PathMapping[]](#-API-网关域名映射规则-`CustomDomain.PathMapping`) | 该域名的路径映射规则列表 |
44+
| protocols | `"http" | "https"` | 启用的协议 |
45+
46+
47+
48+
## API 网关域名映射规则 `CustomDomain.PathMapping`
49+
50+
| 名称 | 类型 | 描述 |
51+
| :--------- | :----: | :--------------- |
52+
| path | string | 路径 |
53+
| enviroment | string | 路径映射到的环境 |
54+

0 commit comments

Comments
 (0)