in source/packages/services/bulkcerts/src/certificates/certificatestask.service.ts [104:175]
private async fireSNSevent(taskId:string, chunkId:number, quantity:number, caAlias:string,certInfo:CertificateInfo) : Promise<void> {
logger.debug(`certificatestask.service fireSNSevent: in: taskId:${taskId}, chunkId:${chunkId}, quantity:${quantity}`);
ow(taskId, ow.string.nonEmpty);
ow(chunkId, ow.number.greaterThan(0));
ow(quantity, ow.number.greaterThan(0));
// Populate certInfo from config file if no arguments have been supplied
if (certInfo.commonName === undefined) {
certInfo.commonName = {
generator: CommonNameGenerator.static,
commonNameStatic: this.commonName
};
}
if (certInfo.commonNameList === undefined) {
certInfo.commonNameList = [];
}
if (certInfo.organization === undefined) {
certInfo.organization = this.organization;
}
if (certInfo.organizationalUnit === undefined) {
certInfo.organizationalUnit = this.organizationalUnit;
}
if (certInfo.locality === undefined) {
certInfo.locality = this.locality;
}
if (certInfo.stateName === undefined) {
certInfo.stateName = this.stateName;
}
if (certInfo.country === undefined) {
certInfo.country = this.country;
}
if (certInfo.emailAddress === undefined) {
certInfo.emailAddress = this.emailAddress;
}
if (certInfo.distinguishedNameQualifier === undefined) {
certInfo.distinguishedNameQualifier = this.distinguishedNameQualifier;
}
if (certInfo.includeCA === undefined) {
certInfo.includeCA = false;
}
if (certInfo.daysExpiry === undefined) {
certInfo.daysExpiry = this.defaultDaysExpiry;
}
const msg:CertificateChunkRequest = {
certInfo:{
commonName: certInfo.commonName,
organization: certInfo.organization,
organizationalUnit: certInfo.organizationalUnit,
locality: certInfo.locality,
stateName: certInfo.stateName,
country: certInfo.country,
emailAddress: certInfo.emailAddress,
distinguishedNameQualifier: certInfo.distinguishedNameQualifier,
includeCA: certInfo.includeCA
},
taskId,
chunkId,
quantity,
caAlias
};
const params:SNS.Types.PublishInput = {
Subject: 'CreateChunk',
Message: JSON.stringify(msg),
TopicArn: this.requestTopic
};
logger.silly(`certificatestask.service fireSNSevent: publishing:${JSON.stringify(params)}`);
await this._sns.publish(params).promise();
logger.debug('certificatestask.service fireSNSevent: exit:');
}