getEstimatedCarbonEmissions method
Returns estimated carbon emission values based on customer grouping and filtering parameters. We recommend using pagination to ensure that the operation returns quickly and successfully.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter timePeriod :
The date range for fetching estimated carbon emissions.
Parameter emissionsTypes :
The emission types to include in the results. If absent, returns
TOTAL_LBM_CARBON_EMISSIONS and
TOTAL_MBM_CARBON_EMISSIONS emissions types.
Parameter filterBy :
The criteria for filtering estimated carbon emissions.
Parameter granularity :
The time granularity for the results. If absent, uses MONTHLY
time granularity.
Parameter granularityConfiguration :
Configuration for fiscal year calculations when using
YEARLY_FISCAL or QUARTERLY_FISCAL granularity.
Parameter groupBy :
The dimensions available for grouping estimated carbon emissions.
Parameter maxResults :
The maximum number of results to return in a single call. Default is 40.
Parameter nextToken :
The pagination token specifying which page of results to return in the
response. If no token is provided, the default page is the first page.
Implementation
Future<GetEstimatedCarbonEmissionsResponse> getEstimatedCarbonEmissions({
required TimePeriod timePeriod,
List<EmissionsType>? emissionsTypes,
FilterExpression? filterBy,
TimeGranularity? granularity,
GranularityConfiguration? granularityConfiguration,
List<Dimension>? groupBy,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
5000,
);
final $payload = <String, dynamic>{
'TimePeriod': timePeriod,
if (emissionsTypes != null)
'EmissionsTypes': emissionsTypes.map((e) => e.value).toList(),
if (filterBy != null) 'FilterBy': filterBy,
if (granularity != null) 'Granularity': granularity.value,
if (granularityConfiguration != null)
'GranularityConfiguration': granularityConfiguration,
if (groupBy != null) 'GroupBy': groupBy.map((e) => e.value).toList(),
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/estimated-carbon-emissions',
exceptionFnMap: _exceptionFns,
);
return GetEstimatedCarbonEmissionsResponse.fromJson(response);
}