Interface CostOptimizationHubClient
-
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface CostOptimizationHubClient extends AwsClient
Service client for accessing Cost Optimization Hub. This can be created using the staticbuilder()method.You can use the Cost Optimization Hub API to programmatically identify, filter, aggregate, and quantify savings for your cost optimization recommendations across multiple Amazon Web Services Regions and Amazon Web Services accounts in your organization.
The Cost Optimization Hub API provides the following endpoint:
-
https://cost-optimization-hub.us-east-1.amazonaws.com
-
-
Field Summary
Fields Modifier and Type Field Description static StringSERVICE_METADATA_IDValue for looking up the service's metadata from theServiceMetadataProvider.static StringSERVICE_NAME
-
Method Summary
-
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
-
Methods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
-
-
-
Field Detail
-
SERVICE_NAME
static final String SERVICE_NAME
- See Also:
- Constant Field Values
-
SERVICE_METADATA_ID
static final String SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPreferences
default GetPreferencesResponse getPreferences(GetPreferencesRequest getPreferencesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns a set of preferences for an account in order to add account-specific preferences into the service. These preferences impact how the savings associated with recommendations are presented—estimated savings after discounts or estimated savings before discounts, for example.
- Parameters:
getPreferencesRequest-- Returns:
- Result of the GetPreferences operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getPreferences
default GetPreferencesResponse getPreferences(Consumer<GetPreferencesRequest.Builder> getPreferencesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns a set of preferences for an account in order to add account-specific preferences into the service. These preferences impact how the savings associated with recommendations are presented—estimated savings after discounts or estimated savings before discounts, for example.
This is a convenience which creates an instance of the
GetPreferencesRequest.Builderavoiding the need to create one manually viaGetPreferencesRequest.builder()- Parameters:
getPreferencesRequest- AConsumerthat will call methods onGetPreferencesRequest.Builderto create a request.- Returns:
- Result of the GetPreferences operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getRecommendation
default GetRecommendationResponse getRecommendation(GetRecommendationRequest getRecommendationRequest) throws ValidationException, InternalServerException, AccessDeniedException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns both the current and recommended resource configuration and the estimated cost impact for a recommendation.
The
recommendationIdis only valid for up to a maximum of 24 hours as recommendations are refreshed daily. To retrieve therecommendationId, use theListRecommendationsAPI.- Parameters:
getRecommendationRequest-- Returns:
- Result of the GetRecommendation operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ResourceNotFoundException- The specified Amazon Resource Name (ARN) in the request doesn't exist.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getRecommendation
default GetRecommendationResponse getRecommendation(Consumer<GetRecommendationRequest.Builder> getRecommendationRequest) throws ValidationException, InternalServerException, AccessDeniedException, ResourceNotFoundException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns both the current and recommended resource configuration and the estimated cost impact for a recommendation.
The
recommendationIdis only valid for up to a maximum of 24 hours as recommendations are refreshed daily. To retrieve therecommendationId, use theListRecommendationsAPI.
This is a convenience which creates an instance of the
GetRecommendationRequest.Builderavoiding the need to create one manually viaGetRecommendationRequest.builder()- Parameters:
getRecommendationRequest- AConsumerthat will call methods onGetRecommendationRequest.Builderto create a request.- Returns:
- Result of the GetRecommendation operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ResourceNotFoundException- The specified Amazon Resource Name (ARN) in the request doesn't exist.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listEnrollmentStatuses
default ListEnrollmentStatusesResponse listEnrollmentStatuses(ListEnrollmentStatusesRequest listEnrollmentStatusesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Retrieves the enrollment status for an account. It can also return the list of accounts that are enrolled under the organization.
- Parameters:
listEnrollmentStatusesRequest-- Returns:
- Result of the ListEnrollmentStatuses operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listEnrollmentStatuses
default ListEnrollmentStatusesResponse listEnrollmentStatuses(Consumer<ListEnrollmentStatusesRequest.Builder> listEnrollmentStatusesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Retrieves the enrollment status for an account. It can also return the list of accounts that are enrolled under the organization.
This is a convenience which creates an instance of the
ListEnrollmentStatusesRequest.Builderavoiding the need to create one manually viaListEnrollmentStatusesRequest.builder()- Parameters:
listEnrollmentStatusesRequest- AConsumerthat will call methods onListEnrollmentStatusesRequest.Builderto create a request.- Returns:
- Result of the ListEnrollmentStatuses operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listEnrollmentStatusesPaginator
default ListEnrollmentStatusesIterable listEnrollmentStatusesPaginator(ListEnrollmentStatusesRequest listEnrollmentStatusesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
This is a variant of
listEnrollmentStatuses(software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesRequest)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.costoptimizationhub.paginators.ListEnrollmentStatusesIterable responses = client.listEnrollmentStatusesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costoptimizationhub.paginators.ListEnrollmentStatusesIterable responses = client .listEnrollmentStatusesPaginator(request); for (software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costoptimizationhub.paginators.ListEnrollmentStatusesIterable responses = client.listEnrollmentStatusesPaginator(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
listEnrollmentStatuses(software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesRequest)operation.- Parameters:
listEnrollmentStatusesRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listEnrollmentStatusesPaginator
default ListEnrollmentStatusesIterable listEnrollmentStatusesPaginator(Consumer<ListEnrollmentStatusesRequest.Builder> listEnrollmentStatusesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
This is a variant of
listEnrollmentStatuses(software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesRequest)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.costoptimizationhub.paginators.ListEnrollmentStatusesIterable responses = client.listEnrollmentStatusesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costoptimizationhub.paginators.ListEnrollmentStatusesIterable responses = client .listEnrollmentStatusesPaginator(request); for (software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costoptimizationhub.paginators.ListEnrollmentStatusesIterable responses = client.listEnrollmentStatusesPaginator(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
listEnrollmentStatuses(software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesRequest)operation.
This is a convenience which creates an instance of the
ListEnrollmentStatusesRequest.Builderavoiding the need to create one manually viaListEnrollmentStatusesRequest.builder()- Parameters:
listEnrollmentStatusesRequest- AConsumerthat will call methods onListEnrollmentStatusesRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendationSummaries
default ListRecommendationSummariesResponse listRecommendationSummaries(ListRecommendationSummariesRequest listRecommendationSummariesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns a concise representation of savings estimates for resources. Also returns de-duped savings across different types of recommendations.
The following filters are not supported for this API:
recommendationIds,resourceArns, andresourceIds.- Parameters:
listRecommendationSummariesRequest-- Returns:
- Result of the ListRecommendationSummaries operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendationSummaries
default ListRecommendationSummariesResponse listRecommendationSummaries(Consumer<ListRecommendationSummariesRequest.Builder> listRecommendationSummariesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns a concise representation of savings estimates for resources. Also returns de-duped savings across different types of recommendations.
The following filters are not supported for this API:
recommendationIds,resourceArns, andresourceIds.
This is a convenience which creates an instance of the
ListRecommendationSummariesRequest.Builderavoiding the need to create one manually viaListRecommendationSummariesRequest.builder()- Parameters:
listRecommendationSummariesRequest- AConsumerthat will call methods onListRecommendationSummariesRequest.Builderto create a request.- Returns:
- Result of the ListRecommendationSummaries operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendationSummariesPaginator
default ListRecommendationSummariesIterable listRecommendationSummariesPaginator(ListRecommendationSummariesRequest listRecommendationSummariesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
This is a variant of
listRecommendationSummaries(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesRequest)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.costoptimizationhub.paginators.ListRecommendationSummariesIterable responses = client.listRecommendationSummariesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationSummariesIterable responses = client .listRecommendationSummariesPaginator(request); for (software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationSummariesIterable responses = client.listRecommendationSummariesPaginator(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
listRecommendationSummaries(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesRequest)operation.- Parameters:
listRecommendationSummariesRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendationSummariesPaginator
default ListRecommendationSummariesIterable listRecommendationSummariesPaginator(Consumer<ListRecommendationSummariesRequest.Builder> listRecommendationSummariesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
This is a variant of
listRecommendationSummaries(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesRequest)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.costoptimizationhub.paginators.ListRecommendationSummariesIterable responses = client.listRecommendationSummariesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationSummariesIterable responses = client .listRecommendationSummariesPaginator(request); for (software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationSummariesIterable responses = client.listRecommendationSummariesPaginator(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
listRecommendationSummaries(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesRequest)operation.
This is a convenience which creates an instance of the
ListRecommendationSummariesRequest.Builderavoiding the need to create one manually viaListRecommendationSummariesRequest.builder()- Parameters:
listRecommendationSummariesRequest- AConsumerthat will call methods onListRecommendationSummariesRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendations
default ListRecommendationsResponse listRecommendations(ListRecommendationsRequest listRecommendationsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns a list of recommendations.
- Parameters:
listRecommendationsRequest-- Returns:
- Result of the ListRecommendations operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendations
default ListRecommendationsResponse listRecommendations(Consumer<ListRecommendationsRequest.Builder> listRecommendationsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Returns a list of recommendations.
This is a convenience which creates an instance of the
ListRecommendationsRequest.Builderavoiding the need to create one manually viaListRecommendationsRequest.builder()- Parameters:
listRecommendationsRequest- AConsumerthat will call methods onListRecommendationsRequest.Builderto create a request.- Returns:
- Result of the ListRecommendations operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendationsPaginator
default ListRecommendationsIterable listRecommendationsPaginator(ListRecommendationsRequest listRecommendationsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
This is a variant of
listRecommendations(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsRequest)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.costoptimizationhub.paginators.ListRecommendationsIterable responses = client.listRecommendationsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationsIterable responses = client .listRecommendationsPaginator(request); for (software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationsIterable responses = client.listRecommendationsPaginator(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
listRecommendations(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsRequest)operation.- Parameters:
listRecommendationsRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listRecommendationsPaginator
default ListRecommendationsIterable listRecommendationsPaginator(Consumer<ListRecommendationsRequest.Builder> listRecommendationsRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
This is a variant of
listRecommendations(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsRequest)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.costoptimizationhub.paginators.ListRecommendationsIterable responses = client.listRecommendationsPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationsIterable responses = client .listRecommendationsPaginator(request); for (software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.costoptimizationhub.paginators.ListRecommendationsIterable responses = client.listRecommendationsPaginator(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
listRecommendations(software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsRequest)operation.
This is a convenience which creates an instance of the
ListRecommendationsRequest.Builderavoiding the need to create one manually viaListRecommendationsRequest.builder()- Parameters:
listRecommendationsRequest- AConsumerthat will call methods onListRecommendationsRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
updateEnrollmentStatus
default UpdateEnrollmentStatusResponse updateEnrollmentStatus(UpdateEnrollmentStatusRequest updateEnrollmentStatusRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.
If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.
You must have the appropriate permissions to opt in to Cost Optimization Hub and to view its recommendations. When you opt in, Cost Optimization Hub automatically creates a service-linked role in your account to access its data.
- Parameters:
updateEnrollmentStatusRequest-- Returns:
- Result of the UpdateEnrollmentStatus operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
updateEnrollmentStatus
default UpdateEnrollmentStatusResponse updateEnrollmentStatus(Consumer<UpdateEnrollmentStatusRequest.Builder> updateEnrollmentStatusRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.
If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.
You must have the appropriate permissions to opt in to Cost Optimization Hub and to view its recommendations. When you opt in, Cost Optimization Hub automatically creates a service-linked role in your account to access its data.
This is a convenience which creates an instance of the
UpdateEnrollmentStatusRequest.Builderavoiding the need to create one manually viaUpdateEnrollmentStatusRequest.builder()- Parameters:
updateEnrollmentStatusRequest- AConsumerthat will call methods onUpdateEnrollmentStatusRequest.Builderto create a request.- Returns:
- Result of the UpdateEnrollmentStatus operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
updatePreferences
default UpdatePreferencesResponse updatePreferences(UpdatePreferencesRequest updatePreferencesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Updates a set of preferences for an account in order to add account-specific preferences into the service. These preferences impact how the savings associated with recommendations are presented.
- Parameters:
updatePreferencesRequest-- Returns:
- Result of the UpdatePreferences operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
updatePreferences
default UpdatePreferencesResponse updatePreferences(Consumer<UpdatePreferencesRequest.Builder> updatePreferencesRequest) throws ValidationException, InternalServerException, AccessDeniedException, ThrottlingException, AwsServiceException, SdkClientException, CostOptimizationHubException
Updates a set of preferences for an account in order to add account-specific preferences into the service. These preferences impact how the savings associated with recommendations are presented.
This is a convenience which creates an instance of the
UpdatePreferencesRequest.Builderavoiding the need to create one manually viaUpdatePreferencesRequest.builder()- Parameters:
updatePreferencesRequest- AConsumerthat will call methods onUpdatePreferencesRequest.Builderto create a request.- Returns:
- Result of the UpdatePreferences operation returned by the service.
- Throws:
ValidationException- The input fails to satisfy the constraints specified by an Amazon Web Services service.InternalServerException- An error on the server occurred during the processing of your request. Try again later.AccessDeniedException- You are not authorized to use this operation with the given parameters.ThrottlingException- The request was denied due to request throttling.SdkException- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.SdkClientException- If any client side error occurs such as an IO related failure, failure to get credentials, etc.CostOptimizationHubException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
create
static CostOptimizationHubClient create()
Create aCostOptimizationHubClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.
-
builder
static CostOptimizationHubClientBuilder builder()
Create a builder that can be used to configure and create aCostOptimizationHubClient.
-
serviceMetadata
static ServiceMetadata serviceMetadata()
-
serviceClientConfiguration
default CostOptimizationHubServiceClientConfiguration serviceClientConfiguration()
- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient
-
-