@kumologica/sdk 3.2.0-beta8 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands/deploy-commands/kumohub.js +4 -2
- package/cli/commands/deploy.js +3 -2
- package/cli/commands/export-commands/cloudformation.js +3 -2
- package/cli/commands/export-commands/github-commands/aws.js +374 -0
- package/cli/commands/export-commands/github.js +6 -0
- package/cli/commands/export-commands/utils/validator.js +51 -1
- package/fixtures/.DS_Store +0 -0
- package/fixtures/hello/.kumologica/test-config.json +23 -0
- package/fixtures/hello/config.json +9 -0
- package/fixtures/hello/hello-flow.json +442 -0
- package/fixtures/hello/package.json +23 -0
- package/fixtures/welcome.txt +8 -0
- package/package.json +8 -9
- package/scripts/welcome.js +7 -0
- package/src/app/lib/aws/ca-apigw-api.js +1 -1
- package/src/app/lib/aws/ca-sqs-api.js +5 -1
- package/src/app/lib/aws/index.js +267 -507
- package/src/app/lib/github/index.js +242 -0
- package/src/app/lib/stores/aws-cloud-config-store.js +1 -1
- package/src/app/preload.js +11 -1
- package/src/app/ui/editor-client/public/red/red.js +143 -74
- package/src/app/ui/editor-client/public/red/red.min.js +2 -2
- package/src/app/ui/editor-client/src/js/ui/editor.js +3 -3
- package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +140 -71
- package/src/app/lib/aws/ca-alexa-api.js +0 -29
- package/src/app/lib/aws/cf.js +0 -449
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const AWS = require('aws-sdk');
|
|
4
|
+
const { exp } = require('@kumologica/builder');
|
|
5
|
+
const AWSProfile = require('../aws/aws-profile');
|
|
6
|
+
const { openFileOnEditor } = require('../utils/editor');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* sample events:
|
|
10
|
+
* https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html
|
|
11
|
+
*/
|
|
12
|
+
class GithubDeployer {
|
|
13
|
+
constructor(terminal) {
|
|
14
|
+
this.term = terminal;
|
|
15
|
+
this.awsProfile = new AWSProfile();
|
|
16
|
+
|
|
17
|
+
AWS.config.apiVersions = {
|
|
18
|
+
cloudformation: '2010-05-15',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async initAWS(profile) {
|
|
23
|
+
AWS.config.credentials = new AWS.SharedIniFileCredentials({profile: profile});
|
|
24
|
+
|
|
25
|
+
const r = await this.awsProfile.getRegion(profile);
|
|
26
|
+
let s3 = new AWS.S3();
|
|
27
|
+
let bucketName = "CHANGE_IT_TO_REAL_BUCKET_NAME";
|
|
28
|
+
|
|
29
|
+
// find bucket
|
|
30
|
+
const buckets = await s3.listBuckets({}).promise();
|
|
31
|
+
|
|
32
|
+
if (buckets && buckets.Buckets) {
|
|
33
|
+
const bucket = buckets.Buckets.find(b => b.Name.startsWith('kumologica-designer-deploy'));
|
|
34
|
+
if (bucket) {
|
|
35
|
+
bucketName = bucket.Name;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {region: r, bucket: bucketName};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
chalk(c, t) {
|
|
43
|
+
if (c == 'whiteBright') {
|
|
44
|
+
c = '#FFFFFF';
|
|
45
|
+
} else if (c == 'redBright') {
|
|
46
|
+
c = '#FF0000';
|
|
47
|
+
} else if (c == 'yellowBright') {
|
|
48
|
+
c = '#FFFF00';
|
|
49
|
+
} else if (c == 'greenBright') {
|
|
50
|
+
c = '#00FF00';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return `<span style="color: ${c}">${t}</span>`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
log(text, calog = true) {
|
|
57
|
+
var t = text;
|
|
58
|
+
|
|
59
|
+
if (calog && this.chalk) {
|
|
60
|
+
t = `Kumologica: ${this.chalk('#F5DEB3', text)}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (this.term) {
|
|
64
|
+
this.term.emit('terminal-output', t);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
logCloud(text) {
|
|
69
|
+
if (this.term) {
|
|
70
|
+
this.term.emit('terminal-cloud', `${text}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
prepare(projectDir, flowFileName, originaLambdaName) {
|
|
75
|
+
const deployDir = projectDir + '/deploy';
|
|
76
|
+
|
|
77
|
+
const flowName = flowFileName.replace('.json', '');
|
|
78
|
+
|
|
79
|
+
// setup deployment directory
|
|
80
|
+
fs.ensureDirSync(deployDir);
|
|
81
|
+
fs.emptyDirSync(deployDir);
|
|
82
|
+
fs.ensureDirSync(deployDir + '/node_modules');
|
|
83
|
+
|
|
84
|
+
this.processPackageJson(projectDir, deployDir);
|
|
85
|
+
|
|
86
|
+
const zipFileName = `${flowName}/lambda${Date.now()}.zip`;
|
|
87
|
+
const lambdaName = this.sanitizeLambdaName(originaLambdaName);
|
|
88
|
+
|
|
89
|
+
const functionName = `kumologica-${lambdaName}-lambda`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async generateScript(projectInfo, params, profile) {
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
|
|
96
|
+
projectInfo: {"projectName":"sockets",
|
|
97
|
+
"projectDir":"/Users/wojtek/Development/projects/sockets",
|
|
98
|
+
"projectFlowName":"sockets-flow.json"}
|
|
99
|
+
profile: kl
|
|
100
|
+
*/
|
|
101
|
+
try {
|
|
102
|
+
this.log('Generating github action workflow');
|
|
103
|
+
|
|
104
|
+
//console.log(`projectInfo: ${JSON.stringify(projectInfo)}`);
|
|
105
|
+
//console.log(`profile: ${profile}`);
|
|
106
|
+
|
|
107
|
+
const awsSettings = await this.initAWS(profile);
|
|
108
|
+
|
|
109
|
+
const args = this.mapParams(params);
|
|
110
|
+
args.region = awsSettings.region;
|
|
111
|
+
args["bucket-name"] = awsSettings.bucket;
|
|
112
|
+
|
|
113
|
+
let wf = exp("github", "aws", args, console.log);
|
|
114
|
+
|
|
115
|
+
const wfDir = path.join(projectInfo.projectDir, '.github', 'workspaces');
|
|
116
|
+
|
|
117
|
+
this.createFile (
|
|
118
|
+
wfDir, 'workflow.yaml',
|
|
119
|
+
wf
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
this.log(`Github action workflow created: ${path.join(wfDir, 'workflow.yaml')}`);
|
|
123
|
+
|
|
124
|
+
openFileOnEditor(path.join(wfDir, 'workflow.yaml'));
|
|
125
|
+
|
|
126
|
+
return;
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
this.log(` ${this.chalk('#F5DEB3', 'AWS region:')} ${this.chalk('whiteBright', AWS.config.region)}`, false);
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
} catch (Error) {
|
|
133
|
+
this.log(`${this.chalk('redBright', 'Github action workflow creation failed.')}`);
|
|
134
|
+
this.log(` ${this.chalk('redBright', Error)}`);
|
|
135
|
+
throw Error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
mapParams(params) {
|
|
140
|
+
let vpcConf;
|
|
141
|
+
if (params.vpcConfig && params.vpcConfig.sn && params.vpcConfig.sn.length > 0
|
|
142
|
+
&& params.vpcConfig.sg && params.vpcConfig.sg.length > 0) {
|
|
143
|
+
let sn = params.vpcConfig.sn.split(",").map(s => s.trim());
|
|
144
|
+
let sg = params.vpcConfig.sg.split(",").map(s => s.trim());
|
|
145
|
+
|
|
146
|
+
vpcConf = JSON.stringify({
|
|
147
|
+
SubnetIds: sn,
|
|
148
|
+
SecurityGroupIds: sg
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let tags;
|
|
153
|
+
if ( params.tags && params.tags.length > 0) {
|
|
154
|
+
tags = {};
|
|
155
|
+
params.tags.forEach(t => tags[t.key] = t.value)
|
|
156
|
+
tags = JSON.stringify(tags);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let env;
|
|
160
|
+
if ( params.environment && params.environment.length > 0) {
|
|
161
|
+
env = {
|
|
162
|
+
Variables: {}
|
|
163
|
+
};
|
|
164
|
+
params.environment.forEach(e => env.Variables[e.key] = e.value)
|
|
165
|
+
env = JSON.stringify(env);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let tracing;
|
|
169
|
+
if (params.xRay) {
|
|
170
|
+
tracing = '{"Mode":"Active"}';
|
|
171
|
+
}
|
|
172
|
+
// KL_TRIGGERS: '[{"api": {"apiId": "CHANGE_IT_TO_API_GATEWAY_ID", "parentId": "CHANGE_IT_TO_PARENT_ID", "stage": "test", "resource": "accounts"}}, {"event": {"expression": "cron(0 1 * * ? *)", "reference": "1am", "name": "CliBuildDemoEvent1am"}}, {"event": {"expression": "rate(1 minute)", "reference": "5min", "name": "CliBuildDemoEvent5min"}}]'
|
|
173
|
+
|
|
174
|
+
// "events":[{"source":"api","api":"qyhtzl0n39","stage":"test","parentId":"xfdg32","resource":"sample","authorizerId":"fdr3"}]
|
|
175
|
+
// "events":[{"source":"api","api":"qyhtzl0n39","stage":"test","parentId":"xfdg32","resource":"sample","authorizerId":"fdr3"},
|
|
176
|
+
//{"source":"dynamodb","stream":"arn:aws:dynamodb:ap-southeast-2:174842903734:table/contact_us/stream/2021-04-25T15:02:15.028","batchSize":"23","batchWindow":"3","startingPosition":"LATEST"},
|
|
177
|
+
//{"source":"sqs","stream":"https://sqs.ap-southeast-2.amazonaws.com/174842903734/devq2","batchSize":"32"},
|
|
178
|
+
//{"source":"kinesis","stream":"arn:aws:dynamodb:ap-southeast-2:174842903734:table/contact_us/stream/2021-04-25T15:02:15.028","batchSize":"34","batchWindow":"33","startingPosition":"LATEST"},
|
|
179
|
+
// {"source":"cwevents","rule":"arn:aws:events:ap-southeast-2:174842903734:rule/Test"},
|
|
180
|
+
//{"source":"sns","topic":"arn:aws:sns:ap-southeast-2:174842903734:t1"},
|
|
181
|
+
//{"source":"s3","bucket":"kumoexcelstore","eventType":"s3:ObjectCreated:*","prefix":"cc","suffix":"fd"}],"vpcConfig":{"sg":"","sn":""}}
|
|
182
|
+
///Users/wojtek/Development/kumologica/sdk/kumologica/packages/sdk/src/app/lib/github/index.js:114
|
|
183
|
+
let triggers;
|
|
184
|
+
if (params.events) {
|
|
185
|
+
triggers = [];
|
|
186
|
+
params.events.forEach(e => {
|
|
187
|
+
switch(e.source) {
|
|
188
|
+
case "api": triggers.push({"api": {"apiId": e.api, "stage": e.stage, "parentId": e.parentId, "resource": e.resource, "authorizerId": e.authorizerId}});
|
|
189
|
+
break;
|
|
190
|
+
case "sns": triggers.push({"sns": {"topicArn": e.topic}});
|
|
191
|
+
break;
|
|
192
|
+
case "sqs": triggers.push({"sqs": {"queueArn": e.queueArn, "batchSize": e.batchSize}});
|
|
193
|
+
break;
|
|
194
|
+
case "dynamodb": triggers.push({"dynamodb": {"streamArn": e.stream, "startingPosition": e.startingPosition, "batchSize": e.batchSize, "batchWindow": e.batchWindow}});
|
|
195
|
+
break;
|
|
196
|
+
case "kinesis": triggers.push({"kinesis": {"streamArn": e.stream, "startingPosition": e.startingPosition, "batchSize": e.batchSize, "batchWindow": e.batchWindow}});
|
|
197
|
+
break;
|
|
198
|
+
case "s3": triggers.push({"s3": {"bucket": e.bucket, "eventType": e.eventType, "prefix": e.prefix, "suffix": e.suffix}});
|
|
199
|
+
break;
|
|
200
|
+
case "cwevents": triggers.push({"event": {"expression": e.expression, "reference": e.reference, "name": e.name}});
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
triggers = JSON.stringify(triggers);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
let args = {
|
|
208
|
+
"zip-file-name": params.zipFileName,
|
|
209
|
+
"bucket-name": params.bucketName,
|
|
210
|
+
"lambda-name": params.functionName,
|
|
211
|
+
"memory-size": params.memory,
|
|
212
|
+
"description": params.description,
|
|
213
|
+
"environment": env,
|
|
214
|
+
"tags": tags,
|
|
215
|
+
"timeout": params.timeout,
|
|
216
|
+
"triggers": triggers,
|
|
217
|
+
"vpc-config": vpcConf,
|
|
218
|
+
"role-arn": params.role,
|
|
219
|
+
"tracing-config": tracing,
|
|
220
|
+
"reserved-concurrency": params.reservedConcurrency
|
|
221
|
+
// not present
|
|
222
|
+
// "role-name": params.roleName,
|
|
223
|
+
// "layers": params.layers,
|
|
224
|
+
// "policy": params.policy,
|
|
225
|
+
// "strict-mode": params.strictMode,
|
|
226
|
+
// "log-retention-days": params.logRetentionDays,
|
|
227
|
+
// "file-system-configs": params.fileSystemConfigs,
|
|
228
|
+
// "dead-letter-config": params.deadLetterConfig,
|
|
229
|
+
// "runtime": params.runtime,
|
|
230
|
+
// "architectures": params.architectures,
|
|
231
|
+
// "kms-key-arn": params.kmsKeyArn,
|
|
232
|
+
}
|
|
233
|
+
return args;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
createFile(baseDir, fileName, content) {
|
|
237
|
+
fs.outputFileSync(path.join(baseDir, fileName), content, 'utf-8');
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
module.exports = GithubDeployer;
|
package/src/app/preload.js
CHANGED
|
@@ -37,6 +37,7 @@ const { NetworkConfigStore } = require('./lib/stores/settings-network-store');
|
|
|
37
37
|
const AWSProfile = require('./lib/aws/aws-profile');
|
|
38
38
|
const AWSDeployer = require('./lib/aws');
|
|
39
39
|
const ServerlessDeployer = require('./lib/serverless');
|
|
40
|
+
const GithubDeployer = require('./lib/github');
|
|
40
41
|
|
|
41
42
|
const Kumohub = require('./lib/kumohub');
|
|
42
43
|
const deployCli = require('@kumologica/builder');
|
|
@@ -48,6 +49,7 @@ const terminalEmitter = new events.EventEmitter();
|
|
|
48
49
|
const awsDeployer = new AWSDeployer(terminalEmitter);
|
|
49
50
|
const awsProfile = new AWSProfile();
|
|
50
51
|
const serverlessDeployer = new ServerlessDeployer(terminalEmitter);
|
|
52
|
+
const githubDeployer = new GithubDeployer(terminalEmitter);
|
|
51
53
|
|
|
52
54
|
const kumohub = new Kumohub(terminalEmitter);
|
|
53
55
|
|
|
@@ -133,12 +135,18 @@ async function generateScript(provider, projectInfo, params) {
|
|
|
133
135
|
params,
|
|
134
136
|
alias.profile
|
|
135
137
|
);
|
|
136
|
-
} else if (provider ==window.__kumologica.cloud.provider.serverless) {
|
|
138
|
+
} else if (provider == window.__kumologica.cloud.provider.serverless) {
|
|
137
139
|
await serverlessDeployer.generateScript(
|
|
138
140
|
projectInfo,
|
|
139
141
|
params,
|
|
140
142
|
alias.profile
|
|
141
143
|
);
|
|
144
|
+
} else if (provider == window.__kumologica.cloud.provider.github) {
|
|
145
|
+
await githubDeployer.generateScript(
|
|
146
|
+
projectInfo,
|
|
147
|
+
params,
|
|
148
|
+
alias.profile
|
|
149
|
+
);
|
|
142
150
|
}
|
|
143
151
|
}
|
|
144
152
|
|
|
@@ -586,6 +594,8 @@ window.__kumologica.runtime.port = port;
|
|
|
586
594
|
window.__kumologica.cloud = {provider: {}};
|
|
587
595
|
window.__kumologica.cloud.provider.aws = "AWS";
|
|
588
596
|
window.__kumologica.cloud.provider.serverless = "SERVERLESS";
|
|
597
|
+
window.__kumologica.cloud.provider.github = "GITHUB";
|
|
598
|
+
|
|
589
599
|
window.__kumologica.cloud.profile = undefined;
|
|
590
600
|
window.__kumologica.cloud.deploy = deploy;
|
|
591
601
|
window.__kumologica.cloud.generateScript = generateScript;
|
|
@@ -22006,6 +22006,7 @@ RED.view.tools = (function() {
|
|
|
22006
22006
|
<span class="option-disabled">Generate script...</span>
|
|
22007
22007
|
<span id="exportCloudFormationBtn" class="option">AWS CloudFormation</span>
|
|
22008
22008
|
<span id="exportServerlessBtn" class="option">Serverless</span>
|
|
22009
|
+
<span id="exportGithubActionBtn" class="option">Github Action Workflow</span>
|
|
22009
22010
|
</div>
|
|
22010
22011
|
</div>
|
|
22011
22012
|
</div>
|
|
@@ -22069,6 +22070,12 @@ RED.view.tools = (function() {
|
|
|
22069
22070
|
});
|
|
22070
22071
|
//tagsSection.expand();
|
|
22071
22072
|
|
|
22073
|
+
// vpc section
|
|
22074
|
+
vpcSection = sections.add({
|
|
22075
|
+
title: 'vpc',
|
|
22076
|
+
collapsible: true,
|
|
22077
|
+
});
|
|
22078
|
+
|
|
22072
22079
|
// event section
|
|
22073
22080
|
eventSection = sections.add({
|
|
22074
22081
|
title: 'Triggers',
|
|
@@ -22091,7 +22098,7 @@ RED.view.tools = (function() {
|
|
|
22091
22098
|
|
|
22092
22099
|
// Function content init
|
|
22093
22100
|
let functionSectionHtml = `
|
|
22094
|
-
<table class="node-info">
|
|
22101
|
+
<table class="node-info">
|
|
22095
22102
|
<tr class="node-info-node-row">
|
|
22096
22103
|
<td>Name</td>
|
|
22097
22104
|
<td colspan="2" style="background: white"><input style="width:100%" id="cloud-fn-name" class="palette-textinput" pattern="[a-zA-Z0-9-_]{1,64}" type="text"></td>
|
|
@@ -22126,7 +22133,10 @@ RED.view.tools = (function() {
|
|
|
22126
22133
|
</tr>
|
|
22127
22134
|
<tr class="node-info-node-row">
|
|
22128
22135
|
<td>Custom Role</td>
|
|
22129
|
-
<td colspan="2" style="background: white; overflow-x:hidden"
|
|
22136
|
+
<td colspan="2" style="background: white; overflow-x:hidden">
|
|
22137
|
+
<input id="cloud-fn-role" list="iamroles-cloud-fn-role-dataList" style="width:100%" class="palette-textinput" placeHolder="optional" type="string">
|
|
22138
|
+
<datalist id="iamroles-cloud-fn-role-dataList"></datalist>
|
|
22139
|
+
</td>
|
|
22130
22140
|
</tr>
|
|
22131
22141
|
</table>
|
|
22132
22142
|
`;
|
|
@@ -22171,6 +22181,28 @@ RED.view.tools = (function() {
|
|
|
22171
22181
|
$(tagsSectionHtml).appendTo(tagsSection.content);
|
|
22172
22182
|
tagsSection.container.show();
|
|
22173
22183
|
|
|
22184
|
+
// VPC section init
|
|
22185
|
+
let vpcSectionHtml = `
|
|
22186
|
+
<table class="node-info">
|
|
22187
|
+
<tbody>
|
|
22188
|
+
<tr class="node-info-node-row">
|
|
22189
|
+
<td>Security Group Ids</td>
|
|
22190
|
+
<td colspan="2" style="background: white; overflow-x:hidden">
|
|
22191
|
+
<input id="cloud-fn-vpc-security-group" style="width:100%" class="palette-textinput" placeHolder="sg-11111, sg-22222" type="string">
|
|
22192
|
+
</td>
|
|
22193
|
+
</tr>
|
|
22194
|
+
<tr class="node-info-node-row">
|
|
22195
|
+
<td>Subnet Ids</td>
|
|
22196
|
+
<td colspan="2" style="background: white; overflow-x:hidden">
|
|
22197
|
+
<input id="cloud-fn-vpc-subnet" style="width:100%" class="palette-textinput" placeHolder="subnet-111, subnet-222" type="string">
|
|
22198
|
+
</td>
|
|
22199
|
+
</tr>
|
|
22200
|
+
</tbody>
|
|
22201
|
+
</table>
|
|
22202
|
+
`;
|
|
22203
|
+
$(vpcSectionHtml).appendTo(vpcSection.content);
|
|
22204
|
+
vpcSection.container.show();
|
|
22205
|
+
|
|
22174
22206
|
// Event section init
|
|
22175
22207
|
$(`
|
|
22176
22208
|
<div style="display:flex; flex-direction: column; justify-content: flex-start;">
|
|
@@ -22180,11 +22212,12 @@ RED.view.tools = (function() {
|
|
|
22180
22212
|
<option value="kinesis">Amazon Kinesis</option>
|
|
22181
22213
|
<option value="sqs">Amazon SQS</option>
|
|
22182
22214
|
<option disabled>────────────────────</option>
|
|
22183
|
-
|
|
22215
|
+
<!--option value="alb">Application Load Balancer</option-->
|
|
22184
22216
|
<!--option value="cognito">Amazon Cognito Sync Trigger</option-->
|
|
22185
22217
|
<!--option value="lex">Amazon Lex</option-->
|
|
22186
|
-
|
|
22218
|
+
<!--option value="alexa">Amazon Alexa</option-->
|
|
22187
22219
|
<option selected value="api">Amazon API Gateway</option>
|
|
22220
|
+
<option selected value="websocket">Amazon WebSocket API</option>
|
|
22188
22221
|
<!--option value="cf">Amazon CloudFront (Lambda@Edge)</option-->
|
|
22189
22222
|
<!--option value="firehose">Amazon Kinesis Data Firehose</option-->
|
|
22190
22223
|
<option disabled>────────────────────</option>
|
|
@@ -22196,7 +22229,7 @@ RED.view.tools = (function() {
|
|
|
22196
22229
|
<option value="cwevents">Amazon CloudWatch Events</option>
|
|
22197
22230
|
<!--option value="codecommit">Amazon CodeCommit</option-->
|
|
22198
22231
|
<!--option value="config">Amazon Config</option-->
|
|
22199
|
-
|
|
22232
|
+
<!--option value="iot">Amazon IoT Events</option-->
|
|
22200
22233
|
</select>
|
|
22201
22234
|
|
|
22202
22235
|
<a id="add-event" href="#" style="float: right; margin: 0px 0px 0px 5px !important; height: 21px !important;" class="editor-button editor-button-small">
|
|
@@ -22285,6 +22318,12 @@ RED.view.tools = (function() {
|
|
|
22285
22318
|
if (params.timeout) {
|
|
22286
22319
|
$('#cloud-fn-timeout').val(params.timeout);
|
|
22287
22320
|
}
|
|
22321
|
+
if (params.vpcConfig && params.vpcConfig.sg) {
|
|
22322
|
+
$('#cloud-fn-vpc-security-group').val(params.vpcConfig.sg);
|
|
22323
|
+
}
|
|
22324
|
+
if (params.vpcConfig && params.vpcConfig.sn) {
|
|
22325
|
+
$('#cloud-fn-vpc-subnet').val(params.vpcConfig.sn);
|
|
22326
|
+
}
|
|
22288
22327
|
if (params.reservedConcurrency) {
|
|
22289
22328
|
$('#cloud-fn-reservedConcurrency').val(params.reservedConcurrency);
|
|
22290
22329
|
}
|
|
@@ -22342,7 +22381,11 @@ RED.view.tools = (function() {
|
|
|
22342
22381
|
let fnXray = $('#cloud-fn-x-ray').prop('checked');
|
|
22343
22382
|
let fnProfile = getProfile();
|
|
22344
22383
|
let fnRole = $('#cloud-fn-role').val();
|
|
22345
|
-
|
|
22384
|
+
let fnVpcConfig = {
|
|
22385
|
+
sg: $('#cloud-fn-vpc-security-group').val(),
|
|
22386
|
+
sn: $('#cloud-fn-vpc-subnet').val()
|
|
22387
|
+
};
|
|
22388
|
+
|
|
22346
22389
|
// Environment variables
|
|
22347
22390
|
let environment = [];
|
|
22348
22391
|
let envvarRows = $('#cloud-fn-env-table tr');
|
|
@@ -22394,7 +22437,7 @@ RED.view.tools = (function() {
|
|
|
22394
22437
|
events.push(event);
|
|
22395
22438
|
});
|
|
22396
22439
|
|
|
22397
|
-
|
|
22440
|
+
const res = {
|
|
22398
22441
|
functionName: fnName,
|
|
22399
22442
|
description: fnDescription,
|
|
22400
22443
|
memory: fnMemory,
|
|
@@ -22406,7 +22449,10 @@ RED.view.tools = (function() {
|
|
|
22406
22449
|
environment: environment,
|
|
22407
22450
|
tags: tags,
|
|
22408
22451
|
events: events,
|
|
22452
|
+
vpcConfig: fnVpcConfig
|
|
22409
22453
|
};
|
|
22454
|
+
|
|
22455
|
+
return res;
|
|
22410
22456
|
}
|
|
22411
22457
|
|
|
22412
22458
|
async function attachDataList(serviceType, itemId, dataListId) {
|
|
@@ -22422,7 +22468,7 @@ RED.view.tools = (function() {
|
|
|
22422
22468
|
|
|
22423
22469
|
if (serviceType == 'api') {
|
|
22424
22470
|
$(`#${dataListId}`).append(
|
|
22425
|
-
$('<option>').attr('value', '
|
|
22471
|
+
$('<option>').attr('value', 'create new').text('create new')
|
|
22426
22472
|
);
|
|
22427
22473
|
}
|
|
22428
22474
|
|
|
@@ -22453,7 +22499,7 @@ RED.view.tools = (function() {
|
|
|
22453
22499
|
|
|
22454
22500
|
if (serviceType == 'api') {
|
|
22455
22501
|
$(`#${dataListId}`).append(
|
|
22456
|
-
$('<option>').attr('value', '
|
|
22502
|
+
$('<option>').attr('value', 'create new').text('create new')
|
|
22457
22503
|
);
|
|
22458
22504
|
}
|
|
22459
22505
|
|
|
@@ -22678,8 +22724,7 @@ RED.view.tools = (function() {
|
|
|
22678
22724
|
$('#cloud-fn-memory').val('512');
|
|
22679
22725
|
$('#cloud-fn-timeout').val('20');
|
|
22680
22726
|
|
|
22681
|
-
$('#cloud-fn-timeout, #cloud-fn-memory, #cloud-fn-description, #cloud-fn-name, #cloud-fn-reservedConcurrency, #cloud-fn-x-ray, #cloud-fn-role'
|
|
22682
|
-
).change(function () {
|
|
22727
|
+
$('#cloud-fn-timeout, #cloud-fn-memory, #cloud-fn-description, #cloud-fn-name, #cloud-fn-reservedConcurrency, #cloud-fn-x-ray, #cloud-fn-role, #cloud-fn-vpc-subnet, #cloud-fn-security-group').change(function () {
|
|
22683
22728
|
saveSettings();
|
|
22684
22729
|
});
|
|
22685
22730
|
|
|
@@ -22848,6 +22893,14 @@ RED.view.tools = (function() {
|
|
|
22848
22893
|
exportScript(window.__kumologica.cloud.provider.serverless);
|
|
22849
22894
|
});
|
|
22850
22895
|
|
|
22896
|
+
// Export serverless script
|
|
22897
|
+
$('#exportGithubActionBtn').click((e) => {
|
|
22898
|
+
e.preventDefault();
|
|
22899
|
+
hideMenu();
|
|
22900
|
+
exportScript(window.__kumologica.cloud.provider.github);
|
|
22901
|
+
});
|
|
22902
|
+
|
|
22903
|
+
|
|
22851
22904
|
$('#cloud-options-dropdown').click((e) => {
|
|
22852
22905
|
e.stopPropagation();
|
|
22853
22906
|
|
|
@@ -22909,7 +22962,6 @@ RED.view.tools = (function() {
|
|
|
22909
22962
|
RED.notify(`<strong>Error</strong>: ${err.stderr? err.stderr: err}`, 'error');
|
|
22910
22963
|
return;
|
|
22911
22964
|
}
|
|
22912
|
-
|
|
22913
22965
|
|
|
22914
22966
|
refreshDataLists();
|
|
22915
22967
|
connectedState = CONNECTED;
|
|
@@ -23061,7 +23113,7 @@ RED.view.tools = (function() {
|
|
|
23061
23113
|
deployState = DEPLOYING;
|
|
23062
23114
|
|
|
23063
23115
|
let item = $('#cloud-fn-event-table :input').filter(function () {
|
|
23064
|
-
return this.value == '
|
|
23116
|
+
return this.value == 'create new';
|
|
23065
23117
|
});
|
|
23066
23118
|
|
|
23067
23119
|
$('#workspace-terminal').show();
|
|
@@ -23195,23 +23247,36 @@ RED.view.tools = (function() {
|
|
|
23195
23247
|
function: 'attachDataList',
|
|
23196
23248
|
},
|
|
23197
23249
|
];
|
|
23198
|
-
parameterSets['cognito'] = [
|
|
23199
|
-
|
|
23200
|
-
];
|
|
23201
|
-
parameterSets['iot'] = [
|
|
23250
|
+
//parameterSets['cognito'] = [
|
|
23251
|
+
// { label: 'Identity Pool ARN', key: 'identityPool', value: '' },
|
|
23252
|
+
//];
|
|
23253
|
+
//parameterSets['iot'] = [
|
|
23254
|
+
// {
|
|
23255
|
+
// label: 'Rule Name',
|
|
23256
|
+
// key: 'rule',
|
|
23257
|
+
// value: '',
|
|
23258
|
+
// required: true,
|
|
23259
|
+
// function: 'attachDataList',
|
|
23260
|
+
// },
|
|
23261
|
+
// { label: 'Query', key: 'query', value: '', required: true },
|
|
23262
|
+
//];
|
|
23263
|
+
parameterSets['api'] = [
|
|
23202
23264
|
{
|
|
23203
|
-
label: '
|
|
23204
|
-
key: '
|
|
23265
|
+
label: 'API',
|
|
23266
|
+
key: 'api',
|
|
23205
23267
|
value: '',
|
|
23206
23268
|
required: true,
|
|
23207
23269
|
function: 'attachDataList',
|
|
23208
23270
|
},
|
|
23209
|
-
{ label: '
|
|
23271
|
+
{ label: 'Deployment Stage', key: 'stage', value: '', required: true },
|
|
23272
|
+
{ label: 'Parent Id', key: 'parentId', value: '', required: false },
|
|
23273
|
+
{ label: 'Resource', key: 'resource', value: '', required: false },
|
|
23274
|
+
{ label: 'Authorizer Id', key: 'authorizerId', value: '', required: false }
|
|
23210
23275
|
];
|
|
23211
|
-
parameterSets['
|
|
23276
|
+
parameterSets['websocket'] = [
|
|
23212
23277
|
{
|
|
23213
|
-
label: '
|
|
23214
|
-
key: '
|
|
23278
|
+
label: 'ApiId',
|
|
23279
|
+
key: 'apiId',
|
|
23215
23280
|
value: '',
|
|
23216
23281
|
required: true,
|
|
23217
23282
|
function: 'attachDataList',
|
|
@@ -23232,23 +23297,23 @@ RED.view.tools = (function() {
|
|
|
23232
23297
|
];
|
|
23233
23298
|
parameterSets['sqs'] = [
|
|
23234
23299
|
{
|
|
23235
|
-
label: 'Queue
|
|
23236
|
-
key: '
|
|
23300
|
+
label: 'Queue Arn',
|
|
23301
|
+
key: 'queueArn',
|
|
23237
23302
|
value: '',
|
|
23238
23303
|
required: true,
|
|
23239
23304
|
function: 'attachDataList',
|
|
23240
23305
|
},
|
|
23241
23306
|
{ label: 'Batch Size', key: 'batchSize', value: '', min: 1, max: 10 },
|
|
23242
23307
|
];
|
|
23243
|
-
parameterSets['alexa'] = [
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
|
|
23248
|
-
|
|
23249
|
-
|
|
23250
|
-
|
|
23251
|
-
];
|
|
23308
|
+
//parameterSets['alexa'] = [
|
|
23309
|
+
// {
|
|
23310
|
+
// label: 'Skill ID',
|
|
23311
|
+
// key: 'skillID',
|
|
23312
|
+
// value: '',
|
|
23313
|
+
// required: true,
|
|
23314
|
+
// function: 'attachDataList',
|
|
23315
|
+
// },
|
|
23316
|
+
//];
|
|
23252
23317
|
parameterSets['kinesis'] = [
|
|
23253
23318
|
{ label: 'Stream ARN', key: 'stream', value: '', required: true },
|
|
23254
23319
|
{ label: 'Batch Size', key: 'batchSize', value: '', min: 1, max: 10000 },
|
|
@@ -23265,48 +23330,52 @@ RED.view.tools = (function() {
|
|
|
23265
23330
|
},
|
|
23266
23331
|
];
|
|
23267
23332
|
parameterSets['cwevents'] = [
|
|
23268
|
-
{
|
|
23269
|
-
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
function: 'attachDataList',
|
|
23274
|
-
},
|
|
23275
|
-
];
|
|
23276
|
-
parameterSets['cwlogs'] = [
|
|
23277
|
-
{
|
|
23278
|
-
label: 'Log Group',
|
|
23279
|
-
key: 'logGroup',
|
|
23280
|
-
value: '',
|
|
23281
|
-
required: true,
|
|
23282
|
-
function: 'attachDataList',
|
|
23283
|
-
},
|
|
23284
|
-
{ label: 'Filter Name', key: 'filterName', value: '' },
|
|
23285
|
-
{ label: 'Filter Pattern', key: 'filterPattern', value: '' },
|
|
23286
|
-
];
|
|
23287
|
-
parameterSets['codecommit'] = [
|
|
23288
|
-
{
|
|
23289
|
-
label: 'Repository Name',
|
|
23290
|
-
key: 'repository',
|
|
23291
|
-
value: '',
|
|
23292
|
-
required: true,
|
|
23293
|
-
function: 'attachDataList',
|
|
23294
|
-
},
|
|
23295
|
-
{ label: 'Trigger Name', key: 'trigger', value: '', required: true },
|
|
23296
|
-
{
|
|
23297
|
-
label: 'Events',
|
|
23298
|
-
key: 'events',
|
|
23333
|
+
{ label: 'Expression', key: 'expression', value: 'cron()', required: true },
|
|
23334
|
+
{ label: 'Reference', key: 'reference', value: '' },
|
|
23335
|
+
{ label: 'Name', key: 'name', value: ''},
|
|
23336
|
+
{ label: 'State',
|
|
23337
|
+
key: 'state',
|
|
23299
23338
|
value: '',
|
|
23300
23339
|
list: [
|
|
23301
|
-
{ k: '
|
|
23302
|
-
{ k: '
|
|
23303
|
-
{ k: 'createReference', v: 'createReference' },
|
|
23304
|
-
{ k: 'deleteReference', v: 'deleteReference' },
|
|
23340
|
+
{ k: 'ENABLED', v: 'ENABLED' },
|
|
23341
|
+
{ k: 'DISABLED', v: 'DISABLED' }
|
|
23305
23342
|
],
|
|
23306
23343
|
},
|
|
23307
|
-
{ label: 'Branch Names', key: 'branchNames', value: '' },
|
|
23308
|
-
{ label: 'Custom Data', key: 'customData', value: '' },
|
|
23309
23344
|
];
|
|
23345
|
+
//parameterSets['cwlogs'] = [
|
|
23346
|
+
// {
|
|
23347
|
+
// label: 'Log Group',
|
|
23348
|
+
// key: 'logGroup',
|
|
23349
|
+
// value: '',
|
|
23350
|
+
// required: true,
|
|
23351
|
+
// function: 'attachDataList',
|
|
23352
|
+
// },
|
|
23353
|
+
// { label: 'Filter Name', key: 'filterName', value: '' },
|
|
23354
|
+
// { label: 'Filter Pattern', key: 'filterPattern', value: '' },
|
|
23355
|
+
//];
|
|
23356
|
+
//parameterSets['codecommit'] = [
|
|
23357
|
+
// {
|
|
23358
|
+
// label: 'Repository Name',
|
|
23359
|
+
// key: 'repository',
|
|
23360
|
+
// value: '',
|
|
23361
|
+
// required: true,
|
|
23362
|
+
// function: 'attachDataList',
|
|
23363
|
+
// },
|
|
23364
|
+
// { label: 'Trigger Name', key: 'trigger', value: '', required: true },
|
|
23365
|
+
// {
|
|
23366
|
+
// label: 'Events',
|
|
23367
|
+
// key: 'events',
|
|
23368
|
+
// value: '',
|
|
23369
|
+
// list: [
|
|
23370
|
+
// { k: 'all', v: 'all' },
|
|
23371
|
+
// { k: 'updateReference', v: 'updateReference' },
|
|
23372
|
+
// { k: 'createReference', v: 'createReference' },
|
|
23373
|
+
// { k: 'deleteReference', v: 'deleteReference' },
|
|
23374
|
+
// ],
|
|
23375
|
+
// },
|
|
23376
|
+
// { label: 'Branch Names', key: 'branchNames', value: '' },
|
|
23377
|
+
// { label: 'Custom Data', key: 'customData', value: '' },
|
|
23378
|
+
//];
|
|
23310
23379
|
|
|
23311
23380
|
return {
|
|
23312
23381
|
init: init,
|
|
@@ -31013,9 +31082,9 @@ RED.editor = (function () {
|
|
|
31013
31082
|
resize: function (dimensions) {
|
|
31014
31083
|
editTrayWidthCache[type] = dimensions.width;
|
|
31015
31084
|
$('.editor-tray-content').height(dimensions.height - 50);
|
|
31016
|
-
var form = $('.editor-tray-content form').height(
|
|
31017
|
-
|
|
31018
|
-
);
|
|
31085
|
+
// var form = $('.editor-tray-content form').height(
|
|
31086
|
+
// dimensions.height - 50 - 40
|
|
31087
|
+
// );
|
|
31019
31088
|
if (editing_node && editing_node._def.oneditresize) {
|
|
31020
31089
|
try {
|
|
31021
31090
|
editing_node._def.oneditresize.call(editing_node, {
|