华为HSAM模板

华为云 HSAM 模板

原文链接:https://support.huaweicloud.com/tg-functiongraph/functiongraph_08_0380.html

函数配置文件详解

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
​```yaml   
SAMversion: 'v1'
Resources:
#函数名称
MyFunc1: # Function resource name
#函数类型(HC::Serverless::Function \ HC::Serverless::FunctionStage)
Type: 'HC::Serverless::Function'
#Function类型 属性
Properties:
#名称
FuncName: testFunc1
#描述
Description: "This is my Func1"
#函数执行入口
Handler: index.handler
#运行环境
Runtime: Python2.7
#函数执行内存使用大小
MemorySize: 128
#函数在被终止之前可以运行的最长时间,单位是秒,范围3~900秒,默认为 3 秒。
Timeout: 180
#OBS上传文件方式时必填,本地代码文件位置
CodeUri: ""
#在线编辑时的函数源码
Code: |
# -*- coding:utf-8 -*-
import json
def handler (event, context):
output = 'Hello message: ' + json.dumps(event)
return output
#为函数配置委托(普通账号、云账号)。
Xrole: allService
#环境变量
Environment:
Variables:
key1: value1
key2: value2
#-----事件源类型-----------------------------------
#OBS 触发器
ObsEvt1: # OBS event resource name
Type: OBS
Properties:
#OBS桶的名称。
Bucket: my-photo-bucket
#OBS触发事件列表
EventType:
- ObjectCreated:*
- ObjectRemoved:*
#前缀过滤配置。 用来限制对以此关键字开头的对象的通知。
Prefix: fss
#后缀过滤配置。 用来限制对以此关键字结尾的对象的通知。
Suffix: jpg
#SMN 触发器
SmnEvt: # SMN event resource name
Type: SMN
Properties:
#订阅的SMN主题名称
Topic: topic1
#订阅备注
Remark: APItest
#DMS 触发器
DmsEvt: # DMS event resource name
Type: DMS
Properties:
#ConsumerGroupId
ConsumerGroupId: g-92777f57-a42a-401e-829d-4151417c639f
#DMS队列ID
QueueId: a99e1c82-808a-4d3b-b03a-0e161e514c2c
#拉取周期为DMS触发器轮询消息的间隔时间
PollingInterval: 30
#LTS 触发器
LtsEvt: # LTS event resource name
Type: LTS
Properties:
#LTS日志组ID
GroupId: fd537073-7ffb-11e8-b63a-286ed488ce71
#LTS日志组名称
GroupName: test-log-group-1
#LTS日志主题ID
TopicId: 51acbef6-aa92-11e8-810a-286ed488ce71
#LTS日志主题名称
TopicName: lts-topic-aos
#CTS 触发器
CtsEvt: # CTS event resource name
Type: CTS
Properties:
#名称
Name: ctstest
#支持审计的服务操作
Operations:
AOS:
stack:
- createStack
- deleteStack
quota:
- updateQuota
CCE(1.0):
app:
- createApp
- deleteApp
image:
- deleteImage
#DIS 触发器
DisEvt: # DIS event resource name
Type: DIS
Properties:
#通道名称
Stream: dis-test
#批处理大小,有效范围为1到10000
BatchSize: 100
#在流中开始读取数据的位置,支持TRIM_HORIZON,LATEST
ShardIteratorType: TRIM_HORIZON
#拉取流数据的周期(秒)
PollingInterval: 30
#APIG 触发器()
ApiEvt: # APIG event resource name
Type: APIG
Properties:
#API的名称
ApiName: testApi
#API分组的名称
ApiGroup: my_apigroup
#安全认证类型(IAM、APP和NONE)
Auth: IAM
#请求类型(HTTP、HTTPS)
Protocol: HTTPS
#请求超时时间
Timeout: 5000
#定时触发器
TimerEvt: # TIMER event resource name
Type: TIMER
Properties:
#触发器名称
Name: my_timer
#触发间隔
Schedule: 3m
#触发类型(Rate/Cron)
ScheduleType: Rate
#触发时包含的附加信息
UserEvent: "user data"
#----------FunctionStage 配置。FunctionStage 资源包含一个函数和若干触发器----------
MyFuncStage1: # FunctionStage resource name
Type: 'HC::Serverless::FunctionStage'
Properties:
#关联函数名称
Function: MyFunc1
#关联的触发器
Events:
TimerEvt
LtsEvt
CtsEvt
ApiEvt



打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2018-2020 丁振莹
  • 访问人数: | 浏览次数:

你的每一分支持,是我努力下去的最大的力量 ٩(๑❛ᴗ❛๑)۶

支付宝
微信