-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconstant.ts
175 lines (162 loc) · 3.97 KB
/
constant.ts
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// cloudbase cli 配置的字段名
export class ConfigItems {
static credential = 'credential'
static ssh = 'ssh'
}
// Node.js 默认部署配置
export const DefaultFunctionDeployConfig = {
timeout: 3,
handler: 'index.main',
runtime: 'Nodejs10.15',
installDependency: true,
ignore: ['node_modules', 'node_modules/**/*', '.git']
}
// cloudbase 配置文件默认配置
export const DefaultCloudBaseConfig = {
functionRoot: './functions',
functions: []
}
// 请求超时时间
export const REQUEST_TIMEOUT = 15000
export const enum ENV_STATUS {
// 创建中
UNAVAILABLE = 'UNAVAILABLE',
// 正常
NORMAL = 'NORMAL',
// 销毁隔离
ISOLATE = 'ISOLATE',
// 异常
ABNORMAL = 'ABNORMAL',
ERROR = 'ERROR'
}
export const STATUS_TEXT = {
UNAVAILABLE: '创建中',
NORMAL: '正常',
ISOLATE: '隔离中',
ABNORMAL: '异常',
ERROR: '异常'
}
export const ALL_COMMANDS = [
'login',
'logout',
'init',
'open',
'env list',
'env rename',
'env domain list',
'env domain create',
'env domain delete',
'env login list',
'env login create',
'env login update',
'fn list',
'fn download',
'fn deploy',
'fn delete',
'fn detail',
'fn code update',
'fn config update',
'fn copy',
'fn log',
'fn trigger create',
'fn trigger delete',
'fn invoke',
'fn publish-version',
'fn list-function-versions',
'fn put-provisioned-concurrency',
'fn get-provisioned-concurrency',
'fn delete-provisioned-concurrency',
'fn config-route',
'functions run',
'storage upload',
'storage download',
'storage delete',
'storage list',
'storage url',
'storage detail',
'storage get-acl',
'storage set-acl',
'hosting detail',
'hosting deploy',
'hosting delete',
'hosting list',
'access create',
'access delete',
'access list',
'access domain bind',
'access domain unbind',
'access domain list',
'run standalonegateway create',
'run standalonegateway list',
'run standalonegateway destroy',
'run standalonegateway package list',
'run standalonegateway turn on',
'run standalonegateway turn off',
'run:deprecated list',
'run:deprecated delete',
'run:deprecated version list',
'run:deprecated version create',
'run:deprecated version modify',
'run:deprecated version delete',
'run:deprecated version update',
'run:deprecated image list',
'run:deprecated image upload',
'run:deprecated image download',
'run:deprecated image delete',
'run service:list',
'run service:deploy',
'run deploy',
'run service:config'
]
export const StatusMap = {
Active: '部署完成',
Creating: '创建中',
CreateFailed: '创建失败',
Updating: '更新中',
UpdateFailed: '更新失败',
Publishing: '函数版本发布中',
PublishFailed: '函数版本发布失败',
Deleting: '函数删除中',
DeleteFailed: '函数删除失败'
}
export const ConcurrencyTaskStatus = {
Done: '已完成',
InProgress: '进行中',
Failed: '失败'
}
export const enum EnumEnvCheck {
EnvFit = 0,
EnvNewCmdOld,
EnvOldCmdNew,
}
export const enum EnumDeployStatus {
Deploying = 'deploying',
DeploySuccess = 'running',
DeployFailed = 'deploy_failed'
}
// tcbr 服务配置 cpu 和 mem 的约束
export const CPU_MEM_OPTS: { cpu: number; mems: number[] }[] = [
{ cpu: 0.25, mems: [0.5] },
{ cpu: 0.5, mems: [1] },
{ cpu: 1, mems: [2] },
{ cpu: 2, mems: [4] },
{ cpu: 4, mems: [8] },
{ cpu: 8, mems: [16] },
{ cpu: 16, mems: [32] },
]
export const DEFAULT_CPU_MEM_SET: { PolicyType: 'mem' | 'cpu', PolicyThreshold: number }[] = [
{
PolicyType: 'mem',
PolicyThreshold: 60
},
{
PolicyType: 'cpu',
PolicyThreshold: 60
},
]
export enum EnvType {
BAAS = 'baas',
RUN = 'run',
HOTING = 'hoting',
WEDA = 'weda'
}