UNPKG

@cloud-carbon-footprint/gcp

Version:

The core logic to get cloud usage data and estimate energy and carbon emissions from Google Cloud Platform.

30 lines (29 loc) 1.43 kB
import { ComputeEstimator, ICloudRecommendationsService, StorageEstimator } from '@cloud-carbon-footprint/core'; import { RecommendationResult } from '@cloud-carbon-footprint/common'; import ServiceWrapper from './ServiceWrapper'; export default class Recommendations implements ICloudRecommendationsService { private readonly computeEstimator; private readonly hddStorageEstimator; private readonly ssdStorageEstimator; private readonly googleServiceWrapper; readonly RECOMMENDER_IDS: string[]; private readonly primaryImpactPerformance; private readonly recommendationsLogger; private readonly costAndCo2eTotals; constructor(computeEstimator: ComputeEstimator, hddStorageEstimator: StorageEstimator, ssdStorageEstimator: StorageEstimator, googleServiceWrapper: ServiceWrapper); getRecommendations(): Promise<RecommendationResult[]>; private getRecommendationsForProjects; private getFilteredRecommendations; private getCo2eEstimationsForUnknowns; private accumulateCostAndCo2e; private getEstimatedCO2eSavings; private getCO2EstimatedSavingsForMachineType; private getCO2EstimatesSavingsForDisk; private getCO2EstimatedSavingsForInstance; private getInstanceDetails; private estimateComputeCO2eSavings; private estimateStorageCO2eSavings; private getEstimatedCostSavings; private parseRegionFromZone; private getEmissionsFactors; }