@kumologica/builder
Version:
Kumologica build and deploy module
33 lines (26 loc) • 850 B
JavaScript
class AzureFlowValidator {
constructor(log) {
if (log) {
this.logger = log;
}
}
log(text, calog = true) {
if (this.logger) {
this.logger(text, calog);
} else {
console.log(text);
}
}
validate(flow) {
// validate if aws nodes got explicit credentials only
const awsNodes = flow.filter(i => ['Rekognition', 'S3', 'SQS', 'Cloudwatch', 'Dynamo DB', 'SNS', 'SES', 'SSM'].includes(i.type));
if (awsNodes && awsNodes.length > 0) {
awsNodes.forEach(n => {
if (!n.securitytype || n.securitytype != 'Credentials') {
throw new Error (`AWS Node ${n.name} must have explicit credentials set when deploying to Azure. Open this node and choose Credentials option.`);
}
});
}
}
}
module.exports = AzureFlowValidator;