in source/checksum/lib/validation/index.js [148:187]
async createTags() {
const tagChksum = this.getChecksumTagName();
const tagModified = this.getLastModifiedTagName();
const params = {
Bucket: this.bucket,
Key: this.key,
};
const s3 = new AWS.S3({
apiVersion: '2006-03-01',
signatureVersion: 'v4',
customUserAgent: process.env.ENV_CUSTOM_USER_AGENT,
});
const response = await s3.getObjectTagging(params).promise();
/* remove existing checksum and modified tags */
[
tagChksum,
tagModified,
].forEach((tag) => {
const idx = response.TagSet.findIndex(x => x.Key === tag);
if (idx >= 0) {
response.TagSet.splice(idx, 1);
}
});
/* only update tags if there is still space to do so */
if (response.TagSet.length <= 8) {
params.Tagging = {
TagSet: response.TagSet.concat([
{ Key: tagChksum, Value: this.computed },
{ Key: tagModified, Value: (new Date()).getTime().toString() },
]),
};
await s3.putObjectTagging(params).promise();
this.tagUpdated = true;
}
}