@cloud-carbon-footprint/aws
Version:
The core logic to get cloud usage data and estimate energy and carbon emissions from Amazon Web Services.
43 lines (42 loc) • 2.2 kB
TypeScript
import { EstimationResult, LookupTableInput, LookupTableOutput, GroupBy } from '@cloud-carbon-footprint/common';
import { ComputeEstimator, EmbodiedEmissionsEstimator, MemoryEstimator, NetworkingEstimator, StorageEstimator, UnknownEstimator } from '@cloud-carbon-footprint/core';
import { ServiceWrapper } from './ServiceWrapper';
export default class CostAndUsageReports {
private readonly computeEstimator;
private readonly ssdStorageEstimator;
private readonly hddStorageEstimator;
private readonly networkingEstimator;
private readonly memoryEstimator;
private readonly unknownEstimator;
private readonly embodiedEmissionsEstimator;
private readonly serviceWrapper?;
private readonly dataBaseName;
private readonly tableName;
private readonly queryResultsLocation;
private readonly costAndUsageReportsLogger;
constructor(computeEstimator: ComputeEstimator, ssdStorageEstimator: StorageEstimator, hddStorageEstimator: StorageEstimator, networkingEstimator: NetworkingEstimator, memoryEstimator: MemoryEstimator, unknownEstimator: UnknownEstimator, embodiedEmissionsEstimator: EmbodiedEmissionsEstimator, serviceWrapper?: ServiceWrapper);
getEstimates(start: Date, end: Date, grouping: GroupBy): Promise<EstimationResult[]>;
getEstimatesFromInputData(inputData: LookupTableInput[]): Promise<LookupTableOutput[]>;
private getFootprintEstimateFromUsageRow;
private getEstimateByUsageUnit;
private getEstimateForUnknownUsage;
private getNetworkingFootprintEstimate;
private getStorageFootprintEstimate;
private getUsageAmountInTerabyteHours;
private usageTypeIsSSD;
private usageTypeIsHDD;
private usageTypeisByteHours;
private usageTypeIsNetworking;
private usageTypeIsUnsupported;
private usageTypeIsUnknown;
private usageUnitIsUnknown;
private getUsage;
private startQuery;
private getQueryResultSetRows;
private getEmbodiedEmissions;
private getDataFromInstanceType;
private convertAthenaRowToCostAndUsageReportsRow;
private checkIfColumnExists;
private buildAccountFilter;
}
export declare const tagNameToAthenaColumn: (tagName: string) => string;