Interface SustainabilityClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder() method.
The AWS Sustainability service provides programmatic access to estimated carbon emissions data for your Amazon Web Services usage. Use the AWS Sustainability service to retrieve, analyze, and track the carbon footprint of your cloud infrastructure over time.
With the AWS Sustainability service, you can:
-
Retrieve estimated carbon emissions for your Amazon Web Services usage across different time periods
-
Group emissions data by dimensions such as account, region, and service
-
Filter emissions data to focus on specific accounts, regions, or services
-
Access multiple emissions calculation methodologies including Location-based Method (LBM) and Market-based Method (MBM)
-
Aggregate emissions data at various time granularities including monthly, quarterly, and yearly periods
The API supports pagination for efficient data retrieval and provides dimension values to help you understand the available grouping and filtering options for your account.
All emissions values are calculated using methodologies aligned with the Greenhouse Gas (GHG) Protocol and are provided in metric tons of carbon dioxide-equivalent (MTCO2e).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic SustainabilityClientBuilderbuilder()Create a builder that can be used to configure and create aSustainabilityClient.static SustainabilityClientcreate()Create aSustainabilityClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.getEstimatedCarbonEmissions(Consumer<GetEstimatedCarbonEmissionsRequest.Builder> getEstimatedCarbonEmissionsRequest) Returns estimated carbon emission values based on customer grouping and filtering parameters.getEstimatedCarbonEmissions(GetEstimatedCarbonEmissionsRequest getEstimatedCarbonEmissionsRequest) Returns estimated carbon emission values based on customer grouping and filtering parameters.getEstimatedCarbonEmissionsDimensionValues(Consumer<GetEstimatedCarbonEmissionsDimensionValuesRequest.Builder> getEstimatedCarbonEmissionsDimensionValuesRequest) Returns the possible dimension values available for a customer's account.getEstimatedCarbonEmissionsDimensionValues(GetEstimatedCarbonEmissionsDimensionValuesRequest getEstimatedCarbonEmissionsDimensionValuesRequest) Returns the possible dimension values available for a customer's account.getEstimatedCarbonEmissionsDimensionValuesPaginator(Consumer<GetEstimatedCarbonEmissionsDimensionValuesRequest.Builder> getEstimatedCarbonEmissionsDimensionValuesRequest) getEstimatedCarbonEmissionsDimensionValuesPaginator(GetEstimatedCarbonEmissionsDimensionValuesRequest getEstimatedCarbonEmissionsDimensionValuesRequest) getEstimatedCarbonEmissionsPaginator(Consumer<GetEstimatedCarbonEmissionsRequest.Builder> getEstimatedCarbonEmissionsRequest) This is a variant ofgetEstimatedCarbonEmissions(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsRequest)operation.getEstimatedCarbonEmissionsPaginator(GetEstimatedCarbonEmissionsRequest getEstimatedCarbonEmissionsRequest) This is a variant ofgetEstimatedCarbonEmissions(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsRequest)operation.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadataMethods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
getEstimatedCarbonEmissions
default GetEstimatedCarbonEmissionsResponse getEstimatedCarbonEmissions(GetEstimatedCarbonEmissionsRequest getEstimatedCarbonEmissionsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException 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.
- Parameters:
getEstimatedCarbonEmissionsRequest-- Returns:
- Result of the GetEstimatedCarbonEmissions operation returned by the service.
- See Also:
-
getEstimatedCarbonEmissions
default GetEstimatedCarbonEmissionsResponse getEstimatedCarbonEmissions(Consumer<GetEstimatedCarbonEmissionsRequest.Builder> getEstimatedCarbonEmissionsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException 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.
This is a convenience which creates an instance of the
GetEstimatedCarbonEmissionsRequest.Builderavoiding the need to create one manually viaGetEstimatedCarbonEmissionsRequest.builder()- Parameters:
getEstimatedCarbonEmissionsRequest- AConsumerthat will call methods onGetEstimatedCarbonEmissionsRequest.Builderto create a request.- Returns:
- Result of the GetEstimatedCarbonEmissions operation returned by the service.
- See Also:
-
getEstimatedCarbonEmissionsPaginator
default GetEstimatedCarbonEmissionsIterable getEstimatedCarbonEmissionsPaginator(GetEstimatedCarbonEmissionsRequest getEstimatedCarbonEmissionsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException This is a variant of
getEstimatedCarbonEmissions(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsIterable responses = client.getEstimatedCarbonEmissionsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsIterable responses = client .getEstimatedCarbonEmissionsPaginator(request); for (software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsIterable responses = client.getEstimatedCarbonEmissionsPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
getEstimatedCarbonEmissions(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsRequest)operation.- Parameters:
getEstimatedCarbonEmissionsRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
getEstimatedCarbonEmissionsPaginator
default GetEstimatedCarbonEmissionsIterable getEstimatedCarbonEmissionsPaginator(Consumer<GetEstimatedCarbonEmissionsRequest.Builder> getEstimatedCarbonEmissionsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException This is a variant of
getEstimatedCarbonEmissions(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsIterable responses = client.getEstimatedCarbonEmissionsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsIterable responses = client .getEstimatedCarbonEmissionsPaginator(request); for (software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsIterable responses = client.getEstimatedCarbonEmissionsPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
getEstimatedCarbonEmissions(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsRequest)operation.
This is a convenience which creates an instance of the
GetEstimatedCarbonEmissionsRequest.Builderavoiding the need to create one manually viaGetEstimatedCarbonEmissionsRequest.builder()- Parameters:
getEstimatedCarbonEmissionsRequest- AConsumerthat will call methods onGetEstimatedCarbonEmissionsRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
getEstimatedCarbonEmissionsDimensionValues
default GetEstimatedCarbonEmissionsDimensionValuesResponse getEstimatedCarbonEmissionsDimensionValues(GetEstimatedCarbonEmissionsDimensionValuesRequest getEstimatedCarbonEmissionsDimensionValuesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException Returns the possible dimension values available for a customer's account. We recommend using pagination to ensure that the operation returns quickly and successfully.
- Parameters:
getEstimatedCarbonEmissionsDimensionValuesRequest-- Returns:
- Result of the GetEstimatedCarbonEmissionsDimensionValues operation returned by the service.
- See Also:
-
getEstimatedCarbonEmissionsDimensionValues
default GetEstimatedCarbonEmissionsDimensionValuesResponse getEstimatedCarbonEmissionsDimensionValues(Consumer<GetEstimatedCarbonEmissionsDimensionValuesRequest.Builder> getEstimatedCarbonEmissionsDimensionValuesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException Returns the possible dimension values available for a customer's account. We recommend using pagination to ensure that the operation returns quickly and successfully.
This is a convenience which creates an instance of the
GetEstimatedCarbonEmissionsDimensionValuesRequest.Builderavoiding the need to create one manually viaGetEstimatedCarbonEmissionsDimensionValuesRequest.builder()- Parameters:
getEstimatedCarbonEmissionsDimensionValuesRequest- AConsumerthat will call methods onGetEstimatedCarbonEmissionsDimensionValuesRequest.Builderto create a request.- Returns:
- Result of the GetEstimatedCarbonEmissionsDimensionValues operation returned by the service.
- See Also:
-
getEstimatedCarbonEmissionsDimensionValuesPaginator
default GetEstimatedCarbonEmissionsDimensionValuesIterable getEstimatedCarbonEmissionsDimensionValuesPaginator(GetEstimatedCarbonEmissionsDimensionValuesRequest getEstimatedCarbonEmissionsDimensionValuesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException This is a variant of
getEstimatedCarbonEmissionsDimensionValues(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsDimensionValuesRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsDimensionValuesIterable responses = client.getEstimatedCarbonEmissionsDimensionValuesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsDimensionValuesIterable responses = client .getEstimatedCarbonEmissionsDimensionValuesPaginator(request); for (software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsDimensionValuesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsDimensionValuesIterable responses = client.getEstimatedCarbonEmissionsDimensionValuesPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
getEstimatedCarbonEmissionsDimensionValues(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsDimensionValuesRequest)operation.- Parameters:
getEstimatedCarbonEmissionsDimensionValuesRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
getEstimatedCarbonEmissionsDimensionValuesPaginator
default GetEstimatedCarbonEmissionsDimensionValuesIterable getEstimatedCarbonEmissionsDimensionValuesPaginator(Consumer<GetEstimatedCarbonEmissionsDimensionValuesRequest.Builder> getEstimatedCarbonEmissionsDimensionValuesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, SustainabilityException This is a variant of
getEstimatedCarbonEmissionsDimensionValues(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsDimensionValuesRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsDimensionValuesIterable responses = client.getEstimatedCarbonEmissionsDimensionValuesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsDimensionValuesIterable responses = client .getEstimatedCarbonEmissionsDimensionValuesPaginator(request); for (software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsDimensionValuesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.sustainability.paginators.GetEstimatedCarbonEmissionsDimensionValuesIterable responses = client.getEstimatedCarbonEmissionsDimensionValuesPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of MaxResults won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
getEstimatedCarbonEmissionsDimensionValues(software.amazon.awssdk.services.sustainability.model.GetEstimatedCarbonEmissionsDimensionValuesRequest)operation.
This is a convenience which creates an instance of the
GetEstimatedCarbonEmissionsDimensionValuesRequest.Builderavoiding the need to create one manually viaGetEstimatedCarbonEmissionsDimensionValuesRequest.builder()- Parameters:
getEstimatedCarbonEmissionsDimensionValuesRequest- AConsumerthat will call methods onGetEstimatedCarbonEmissionsDimensionValuesRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- See Also:
-
create
Create aSustainabilityClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aSustainabilityClient. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-