@cloud-carbon-footprint/aws
Version:
The core logic to get cloud usage data and estimate energy and carbon emissions from Amazon Web Services.
32 lines • 1.36 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@cloud-carbon-footprint/core");
const domain_1 = require("../domain");
const common_1 = require("@cloud-carbon-footprint/common");
class AWSStorageEstimatesBuilder extends core_1.FootprintEstimatesDataBuilder {
constructor(rowData, storageEstimator) {
super(rowData);
this.region = rowData.region;
this.powerUsageEffectiveness = domain_1.AWS_CLOUD_CONSTANTS.getPUE(this.region);
this.storageUsage = this.getStorageUsage();
this.storageConstants = this.getStorageConstants();
this.storageFootprint = this.getStorageFootprint(storageEstimator);
this.volumeSize = rowData.volumeSize;
}
getStorageUsage() {
return {
terabyteHours: (0, common_1.convertGigaBytesToTerabyteHours)(this.volumeSize),
};
}
getStorageConstants() {
return {
powerUsageEffectiveness: this.powerUsageEffectiveness,
replicationFactor: 2,
};
}
getStorageFootprint(storageEstimator) {
return storageEstimator.estimate([this.storageUsage], this.region, domain_1.AWS_EMISSIONS_FACTORS_METRIC_TON_PER_KWH, this.storageConstants)[0];
}
}
exports.default = AWSStorageEstimatesBuilder;
//# sourceMappingURL=AWSStorageEstimatesBuilder.js.map