in lib/configuration.js [91:170]
function readTarget(record, serviceDefinitions) {
var target = DDB.parseDynamoDBObject(record, defaultTarget);
if(((typeof target.id) != "string") || (target.id.length === 0)) {
console.error("Invalid target configuration, 'id' property must be a non-empty string. Ignoring target");
return null;
}
if(((typeof target.type) != "string") || (! serviceDefinitions.hasOwnProperty(target.type))) {
console.error("Invalid configuration for target '" + target.id + "', 'type' property must be a valid string in ('" + Object.keys(serviceDefinitions).join("', '") + "'), found '" + target.type + "'. Ignoring target");
return null;
}
if(((typeof target.collapse) != "string") || (! collapseRegex.test(target.collapse))) {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'collapse' property must be a valid collapse type (JSON, concat, concat-b64, none). Ignoring target");
return null;
}
// Force collapse, check role, check region
switch(target.type) {
case "es":
case "firehose":
case "kinesis": {
target.collapse = "API";
break;
}
case "memcached":
case "redis": {
target.collapse = "multiple";
if(target.role) {
console.error("Ignoring parameter 'role' for target '" + target.id + "' of type '" + target.type + "'");
target.role = null;
}
if(target.region) {
console.error("Ignoring parameter 'region' for target type '" + target.type + "'");
target.region = null;
}
}
case "sqs":
case "sns":
case "iot": {
// Nothing to do for the collapse
}
default: {
target.collapse = null;
}
}
if(((typeof target.sourceArn) != "string") || (! sourceRegex.test(target.sourceArn))) {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'sourceArn' property must be a valid ARN of an Amazon Kinesis Stream or Amazon DynamoDB Stream. Ignoring target");
return null;
}
if(((typeof target.destination) != "string") || (! serviceDefinitions[target.type].destinationRegex.test(target.destination))) {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'destination' property must be valid for the specified target type, check documentation. Ignoring target");
return null;
}
if((typeof target.active) != "boolean") {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'active' property must be a boolean. Ignoring target");
return null;
}
if((typeof target.parallel) != "boolean") {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'parallel' property must be a boolean. Ignoring target");
return null;
}
if((target.role !== null) && (! roleRegex.test(target.role))) {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'role' property must be a valid string. Ignoring target");
return null;
}
if((target.externalId !== null) && ((typeof target.externalId) != "string")) {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'externalId' property must be a valid string. Ignoring target");
return null;
}
if((target.region !== null) && (! regionRegex.test(target.region))) {
console.error("Invalid configuration for target '" + target.id + "' of type '" + target.type + "', 'region' property must be a valid string. Ignoring target");
return null;
}
return target;
}