-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31a01f0
commit 116f19f
Showing
5 changed files
with
192 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# Yaml规范说明 | ||
|
||
本文介绍了Yaml配置的相关字段含义 | ||
|
||
## Yaml完整配置 | ||
|
||
`s.yaml`完整文档如下 | ||
|
||
```yaml | ||
edition: 1.0.0 # 命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范 | ||
name: component-test # 项目名称 | ||
alias: default | ||
services: | ||
component-test: # 服务名称 | ||
component: ../../lib # 这里引入的是相对路径,正式配置替换成你自己的component名称即可 | ||
props: | ||
code: | ||
codeUri: ./ # 代码相对路径 | ||
publish: false # 是否发布 | ||
dryRun: true | ||
functionName: test # 函数名 | ||
description: 测试函数 # 函数描述 | ||
handler: index.handler # 函数句柄 | ||
endpoint: cfc.bj.baidubce.com # 选择区域 见:https://cloud.baidu.com/doc/CFC/s/rjwvz4chn | ||
protocol: https # 协议类型 | ||
runtime: nodejs12 # 函数运行环境 | ||
timeout: 3 # 超时时间 | ||
memorySize: 128 # 内存大小 | ||
logType: bos # 日志类型 | ||
logBosDir: bucket-name/path # 日志存储的 Bucket 路径。 | ||
vpcConifg: # 函数绑定的vpc配置 | ||
vpcId: xxxx # 绑定的vpcId | ||
subnetIds: # 绑定的子网列表 | ||
- xxx | ||
- xxx | ||
securityGroupIds: # 安全组列表 | ||
- xxx | ||
- xxx | ||
trigger: # 触发器配置 | ||
source: cfc-http-trigger/v1/CFCAPI # 触发源(当前是http触发源) | ||
data: # 触发器参数 | ||
Enable: Enabled # 是否弃用 | ||
ResourcePath: /test # 资源路径 | ||
Method: GET # 支持方法 | ||
AuthType: anonymous # 验证方法 | ||
environment: # 环境变量 | ||
additionalProp1: 环境变量1 | ||
additionalProp2: 环境变量2 | ||
additionalProp3: 环境变量3 | ||
``` | ||
## 触发器 | ||
### 1. dueros触发器 | ||
```yaml | ||
trigger: | ||
source: dueros | ||
``` | ||
|
||
### 2. bos触发器 | ||
|
||
```yaml | ||
trigger: | ||
source: bos | ||
bucket: xxx # 必填,bucket名称 | ||
data: | ||
Resource: xxx # 必填,订阅的资源 | ||
Status: enabled/disabled # 必填,是否弃用 | ||
Name: xxx # 必填,触发器名称 | ||
EventType: # 必填,事件类型列表 | ||
``` | ||
|
||
| EventType可选值 | 描述 | | ||
| ----------------------- | --------------------------- | | ||
| PutObject | 创建/覆盖文件:简单上传 | | ||
| PostObject | 创建/覆盖文件:表单上传 | | ||
| AppendObject | 创建/覆盖文件:追加上传 | | ||
| CopyObject | 创建/覆盖文件:拷贝上传 | | ||
| CompleteMultipartObject | 创建/覆盖文件:完成分片上传 | | ||
|
||
### 3. HTTP触发器 | ||
|
||
```yaml | ||
trigger: | ||
source: cfc-http-trigger/v1/CFCAPI | ||
data: | ||
Resource: | ||
Method: | ||
AuthType: | ||
``` | ||
|
||
| 参数名称 | 类型 | 是否必须 | 描述 | | ||
| ------------ | ------ | -------- | ---------------------------------------- | | ||
| ResourcePath | string | 是 | URL路径 | | ||
| Method | string | 是 | HTTP方法,如"GET,HEAD" | | ||
| AuthType | string | 是 | 身份验证类型,可选值为"anonymous"或"iam" | | ||
|
||
### 4. CDN触发器 | ||
|
||
```yaml | ||
trigger: | ||
source: cdn | ||
data: | ||
EventType: | ||
Domains: | ||
- xxx | ||
- xxx | ||
Remark: | ||
Status: | ||
``` | ||
|
||
| 参数名称 | 类型 | 是否必须 | 描述 | | ||
| --------- | -------------- | -------- | --------------------------------------------- | | ||
| EventType | string | 是 | CDN事件类型 | | ||
| Domains | list of string | 否 | 域名列表,事件类型为域名粒度时可添加此参数 | | ||
| Remark | string | 否 | 备注信息 | | ||
| Status | string | 是 | 是否启用触发器,可选值为”enabled”或”disabled” | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
# 百度云函数计算(CFC)组件 | ||
|
||
[百度云函数组件](https://github.com/xinwuyun/cfc)是一个用于支持百度云函数应用生性周期的工具,基于[Serverless Devs](https://www.serverless-devs.com/)进行开发,通过配置资源配置文件`s.yaml`,可以快速帮助用户便捷地开发、构建、测试以及部署应用到[百度云函数计算平台](https://console.bce.baidu.com/cfc/#/cfc/overview)。 | ||
## 组件说明 | ||
|
||
本组件使用YAML规范(`s.yaml`)定义Serverless资源,定义了函数、触发器等资源的配置。 | ||
[百度云函数组件](https://github.com/xinwuyun/cfc)是一个用于支持百度云函数应用生性周期的工具,基于[Serverless Devs](https://www.serverless-devs.com/)进行开发,通过配置资源配置文件`s.yaml`,您可以简单快速地部署应用到[百度云函数计算平台](https://console.bce.baidu.com/cfc/#/cfc/overview)。 | ||
|
||
[^_^]: | ||
yaml规范参考:xxxxx | ||
本组件使用[YAML规范](./docs/Others/yaml.md)(`s.yaml`)定义Serverless资源,定义了您的应用的函数、触发器等资源的配置。 | ||
|
||
## 快速开始 | ||
|
||
```shell | ||
$ git clone https://github.com/xinwuyun/cfc | ||
$ cd cfc/example | ||
$ s deploy | ||
``` | ||
|
||
为了让您更好地体验阿里云函数计算组件,您可以参考[快速入门文档](./docs/Getting-started/Hello-world-application.md) | ||
|
||
## 文档目录 | ||
|
||
+ [入门相关](./docs/Getting-started/getting-started.md) | ||
+ [开发工具安装](./docs/Getting-started/install.md) | ||
+ [账号配置](./docs/Getting-started/config.md) | ||
+ [快速体验](./docs/Getting-started/Hello-world-application.md) | ||
+ 指令使用方法 | ||
+ [部署操作:Deploy](./docs/Usage/deploy.md) | ||
+ [移除操作:Remove](./docs/Usage/remove.md) | ||
|
||
## 更多案例 | ||
|
||
[start-cfc](https://github.com/xinwuyun/start-cfc) | ||
|
||
## 问题反馈 | ||
|
||
如您在使用中遇到问题,可以在[这里反馈](https://github.com/xinwuyun/cfc/issues) | ||
|