All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.computeoptimizer.DefaultComputeOptimizerClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Compute Optimizer module holds the client classes that are used for communicating with Compute Optimizer.

There is a newer version: 2.28.3
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.computeoptimizer;

import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.awscore.internal.AwsProtocolMetadata;
import software.amazon.awssdk.awscore.internal.AwsServiceProtocol;
import software.amazon.awssdk.awscore.retry.AwsRetryStrategy;
import software.amazon.awssdk.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
import software.amazon.awssdk.core.client.handler.SyncClientHandler;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.http.HttpResponseHandler;
import software.amazon.awssdk.core.metrics.CoreMetric;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.metrics.MetricCollector;
import software.amazon.awssdk.metrics.MetricPublisher;
import software.amazon.awssdk.metrics.NoOpMetricCollector;
import software.amazon.awssdk.protocols.core.ExceptionMetadata;
import software.amazon.awssdk.protocols.json.AwsJsonProtocol;
import software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory;
import software.amazon.awssdk.protocols.json.JsonOperationMetadata;
import software.amazon.awssdk.retries.api.RetryStrategy;
import software.amazon.awssdk.services.computeoptimizer.internal.ComputeOptimizerServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.computeoptimizer.model.AccessDeniedException;
import software.amazon.awssdk.services.computeoptimizer.model.ComputeOptimizerException;
import software.amazon.awssdk.services.computeoptimizer.model.DeleteRecommendationPreferencesRequest;
import software.amazon.awssdk.services.computeoptimizer.model.DeleteRecommendationPreferencesResponse;
import software.amazon.awssdk.services.computeoptimizer.model.DescribeRecommendationExportJobsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.DescribeRecommendationExportJobsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportAutoScalingGroupRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportAutoScalingGroupRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportEbsVolumeRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportEbsVolumeRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportEc2InstanceRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportEc2InstanceRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportEcsServiceRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportEcsServiceRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportLambdaFunctionRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportLambdaFunctionRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportLicenseRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportLicenseRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ExportRdsDatabaseRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.ExportRdsDatabaseRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetAutoScalingGroupRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetAutoScalingGroupRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEbsVolumeRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEbsVolumeRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEc2InstanceRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEc2InstanceRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEc2RecommendationProjectedMetricsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEc2RecommendationProjectedMetricsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEcsServiceRecommendationProjectedMetricsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEcsServiceRecommendationProjectedMetricsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEcsServiceRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEcsServiceRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEffectiveRecommendationPreferencesRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEffectiveRecommendationPreferencesResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEnrollmentStatusRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEnrollmentStatusResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetEnrollmentStatusesForOrganizationRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetEnrollmentStatusesForOrganizationResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetLambdaFunctionRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetLambdaFunctionRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetLicenseRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetLicenseRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetRdsDatabaseRecommendationProjectedMetricsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetRdsDatabaseRecommendationProjectedMetricsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetRdsDatabaseRecommendationsRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetRdsDatabaseRecommendationsResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetRecommendationPreferencesRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetRecommendationPreferencesResponse;
import software.amazon.awssdk.services.computeoptimizer.model.GetRecommendationSummariesRequest;
import software.amazon.awssdk.services.computeoptimizer.model.GetRecommendationSummariesResponse;
import software.amazon.awssdk.services.computeoptimizer.model.InternalServerException;
import software.amazon.awssdk.services.computeoptimizer.model.InvalidParameterValueException;
import software.amazon.awssdk.services.computeoptimizer.model.LimitExceededException;
import software.amazon.awssdk.services.computeoptimizer.model.MissingAuthenticationTokenException;
import software.amazon.awssdk.services.computeoptimizer.model.OptInRequiredException;
import software.amazon.awssdk.services.computeoptimizer.model.PutRecommendationPreferencesRequest;
import software.amazon.awssdk.services.computeoptimizer.model.PutRecommendationPreferencesResponse;
import software.amazon.awssdk.services.computeoptimizer.model.ResourceNotFoundException;
import software.amazon.awssdk.services.computeoptimizer.model.ServiceUnavailableException;
import software.amazon.awssdk.services.computeoptimizer.model.ThrottlingException;
import software.amazon.awssdk.services.computeoptimizer.model.UpdateEnrollmentStatusRequest;
import software.amazon.awssdk.services.computeoptimizer.model.UpdateEnrollmentStatusResponse;
import software.amazon.awssdk.services.computeoptimizer.transform.DeleteRecommendationPreferencesRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.DescribeRecommendationExportJobsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportAutoScalingGroupRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportEbsVolumeRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportEc2InstanceRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportEcsServiceRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportLambdaFunctionRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportLicenseRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.ExportRdsDatabaseRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetAutoScalingGroupRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEbsVolumeRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEc2InstanceRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEc2RecommendationProjectedMetricsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEcsServiceRecommendationProjectedMetricsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEcsServiceRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEffectiveRecommendationPreferencesRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEnrollmentStatusRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetEnrollmentStatusesForOrganizationRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetLambdaFunctionRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetLicenseRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetRdsDatabaseRecommendationProjectedMetricsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetRdsDatabaseRecommendationsRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetRecommendationPreferencesRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.GetRecommendationSummariesRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.PutRecommendationPreferencesRequestMarshaller;
import software.amazon.awssdk.services.computeoptimizer.transform.UpdateEnrollmentStatusRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link ComputeOptimizerClient}.
 *
 * @see ComputeOptimizerClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultComputeOptimizerClient implements ComputeOptimizerClient {
    private static final Logger log = Logger.loggerFor(DefaultComputeOptimizerClient.class);

    private static final AwsProtocolMetadata protocolMetadata = AwsProtocolMetadata.builder()
            .serviceProtocol(AwsServiceProtocol.AWS_JSON).build();

    private final SyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultComputeOptimizerClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Deletes a recommendation preference, such as enhanced infrastructure metrics. *

*

* For more information, see Activating * enhanced infrastructure metrics in the Compute Optimizer User Guide. *

* * @param deleteRecommendationPreferencesRequest * @return Result of the DeleteRecommendationPreferences operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.DeleteRecommendationPreferences * @see AWS API Documentation */ @Override public DeleteRecommendationPreferencesResponse deleteRecommendationPreferences( DeleteRecommendationPreferencesRequest deleteRecommendationPreferencesRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteRecommendationPreferencesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRecommendationPreferencesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRecommendationPreferencesRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRecommendationPreferences"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteRecommendationPreferences").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteRecommendationPreferencesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteRecommendationPreferencesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes recommendation export jobs created in the last seven days. *

*

* Use the ExportAutoScalingGroupRecommendations or ExportEC2InstanceRecommendations actions to * request an export of your recommendations. Then use the DescribeRecommendationExportJobs action to view * your export jobs. *

* * @param describeRecommendationExportJobsRequest * @return Result of the DescribeRecommendationExportJobs operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.DescribeRecommendationExportJobs * @see AWS API Documentation */ @Override public DescribeRecommendationExportJobsResponse describeRecommendationExportJobs( DescribeRecommendationExportJobsRequest describeRecommendationExportJobsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeRecommendationExportJobsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeRecommendationExportJobsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeRecommendationExportJobsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeRecommendationExportJobs"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeRecommendationExportJobs").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeRecommendationExportJobsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeRecommendationExportJobsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Exports optimization recommendations for Auto Scaling groups. *

*

* Recommendations are exported in a comma-separated values (.csv) file, and its metadata in a JavaScript Object * Notation (JSON) (.json) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. * For more information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can have only one Auto Scaling group export job in progress per Amazon Web Services Region. *

* * @param exportAutoScalingGroupRecommendationsRequest * @return Result of the ExportAutoScalingGroupRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportAutoScalingGroupRecommendations * @see AWS API Documentation */ @Override public ExportAutoScalingGroupRecommendationsResponse exportAutoScalingGroupRecommendations( ExportAutoScalingGroupRecommendationsRequest exportAutoScalingGroupRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, ExportAutoScalingGroupRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportAutoScalingGroupRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportAutoScalingGroupRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportAutoScalingGroupRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportAutoScalingGroupRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration) .withInput(exportAutoScalingGroupRecommendationsRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportAutoScalingGroupRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Exports optimization recommendations for Amazon EBS volumes. *

*

* Recommendations are exported in a comma-separated values (.csv) file, and its metadata in a JavaScript Object * Notation (JSON) (.json) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. * For more information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can have only one Amazon EBS volume export job in progress per Amazon Web Services Region. *

* * @param exportEbsVolumeRecommendationsRequest * @return Result of the ExportEBSVolumeRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportEBSVolumeRecommendations * @see AWS API Documentation */ @Override public ExportEbsVolumeRecommendationsResponse exportEBSVolumeRecommendations( ExportEbsVolumeRecommendationsRequest exportEbsVolumeRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportEbsVolumeRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportEbsVolumeRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportEbsVolumeRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportEBSVolumeRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportEBSVolumeRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(exportEbsVolumeRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportEbsVolumeRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Exports optimization recommendations for Amazon EC2 instances. *

*

* Recommendations are exported in a comma-separated values (.csv) file, and its metadata in a JavaScript Object * Notation (JSON) (.json) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. * For more information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can have only one Amazon EC2 instance export job in progress per Amazon Web Services Region. *

* * @param exportEc2InstanceRecommendationsRequest * @return Result of the ExportEC2InstanceRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportEC2InstanceRecommendations * @see AWS API Documentation */ @Override public ExportEc2InstanceRecommendationsResponse exportEC2InstanceRecommendations( ExportEc2InstanceRecommendationsRequest exportEc2InstanceRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportEc2InstanceRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportEc2InstanceRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportEc2InstanceRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportEC2InstanceRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportEC2InstanceRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(exportEc2InstanceRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportEc2InstanceRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Exports optimization recommendations for Amazon ECS services on Fargate. *

*

* Recommendations are exported in a CSV file, and its metadata in a JSON file, to an existing Amazon Simple Storage * Service (Amazon S3) bucket that you specify. For more information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can only have one Amazon ECS service export job in progress per Amazon Web Services Region. *

* * @param exportEcsServiceRecommendationsRequest * @return Result of the ExportECSServiceRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportECSServiceRecommendations * @see AWS API Documentation */ @Override public ExportEcsServiceRecommendationsResponse exportECSServiceRecommendations( ExportEcsServiceRecommendationsRequest exportEcsServiceRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportEcsServiceRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportEcsServiceRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportEcsServiceRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportECSServiceRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportECSServiceRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(exportEcsServiceRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportEcsServiceRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Exports optimization recommendations for Lambda functions. *

*

* Recommendations are exported in a comma-separated values (.csv) file, and its metadata in a JavaScript Object * Notation (JSON) (.json) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. * For more information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can have only one Lambda function export job in progress per Amazon Web Services Region. *

* * @param exportLambdaFunctionRecommendationsRequest * @return Result of the ExportLambdaFunctionRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportLambdaFunctionRecommendations * @see AWS API Documentation */ @Override public ExportLambdaFunctionRecommendationsResponse exportLambdaFunctionRecommendations( ExportLambdaFunctionRecommendationsRequest exportLambdaFunctionRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportLambdaFunctionRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportLambdaFunctionRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportLambdaFunctionRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportLambdaFunctionRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportLambdaFunctionRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(exportLambdaFunctionRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportLambdaFunctionRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Export optimization recommendations for your licenses. *

*

* Recommendations are exported in a comma-separated values (CSV) file, and its metadata in a JavaScript Object * Notation (JSON) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. For more * information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can have only one license export job in progress per Amazon Web Services Region. *

* * @param exportLicenseRecommendationsRequest * @return Result of the ExportLicenseRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportLicenseRecommendations * @see AWS API Documentation */ @Override public ExportLicenseRecommendationsResponse exportLicenseRecommendations( ExportLicenseRecommendationsRequest exportLicenseRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportLicenseRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportLicenseRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportLicenseRecommendationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportLicenseRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportLicenseRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(exportLicenseRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportLicenseRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Export optimization recommendations for your Amazon Relational Database Service (Amazon RDS). *

*

* Recommendations are exported in a comma-separated values (CSV) file, and its metadata in a JavaScript Object * Notation (JSON) file, to an existing Amazon Simple Storage Service (Amazon S3) bucket that you specify. For more * information, see Exporting * Recommendations in the Compute Optimizer User Guide. *

*

* You can have only one Amazon RDS export job in progress per Amazon Web Services Region. *

* * @param exportRdsDatabaseRecommendationsRequest * @return Result of the ExportRDSDatabaseRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.ExportRDSDatabaseRecommendations * @see AWS API Documentation */ @Override public ExportRdsDatabaseRecommendationsResponse exportRDSDatabaseRecommendations( ExportRdsDatabaseRecommendationsRequest exportRdsDatabaseRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ExportRdsDatabaseRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(exportRdsDatabaseRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, exportRdsDatabaseRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ExportRDSDatabaseRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ExportRDSDatabaseRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(exportRdsDatabaseRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ExportRdsDatabaseRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns Auto Scaling group recommendations. *

*

* Compute Optimizer generates recommendations for Amazon EC2 Auto Scaling groups that meet a specific set of * requirements. For more information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getAutoScalingGroupRecommendationsRequest * @return Result of the GetAutoScalingGroupRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetAutoScalingGroupRecommendations * @see AWS API Documentation */ @Override public GetAutoScalingGroupRecommendationsResponse getAutoScalingGroupRecommendations( GetAutoScalingGroupRecommendationsRequest getAutoScalingGroupRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetAutoScalingGroupRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getAutoScalingGroupRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getAutoScalingGroupRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetAutoScalingGroupRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetAutoScalingGroupRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getAutoScalingGroupRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetAutoScalingGroupRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns Amazon Elastic Block Store (Amazon EBS) volume recommendations. *

*

* Compute Optimizer generates recommendations for Amazon EBS volumes that meet a specific set of requirements. For * more information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getEbsVolumeRecommendationsRequest * @return Result of the GetEBSVolumeRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetEBSVolumeRecommendations * @see AWS API Documentation */ @Override public GetEbsVolumeRecommendationsResponse getEBSVolumeRecommendations( GetEbsVolumeRecommendationsRequest getEbsVolumeRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetEbsVolumeRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEbsVolumeRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEbsVolumeRecommendationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEBSVolumeRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetEBSVolumeRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEbsVolumeRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEbsVolumeRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns Amazon EC2 instance recommendations. *

*

* Compute Optimizer generates recommendations for Amazon Elastic Compute Cloud (Amazon EC2) instances that meet a * specific set of requirements. For more information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getEc2InstanceRecommendationsRequest * @return Result of the GetEC2InstanceRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetEC2InstanceRecommendations * @see AWS API Documentation */ @Override public GetEc2InstanceRecommendationsResponse getEC2InstanceRecommendations( GetEc2InstanceRecommendationsRequest getEc2InstanceRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetEc2InstanceRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEc2InstanceRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEc2InstanceRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEC2InstanceRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetEC2InstanceRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEc2InstanceRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEc2InstanceRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the projected utilization metrics of Amazon EC2 instance recommendations. *

* *

* The Cpu and Memory metrics are the only projected utilization metrics returned when you * run this action. Additionally, the Memory metric is returned only for resources that have the * unified CloudWatch agent installed on them. For more information, see Enabling Memory Utilization * with the CloudWatch Agent. *

*
* * @param getEc2RecommendationProjectedMetricsRequest * @return Result of the GetEC2RecommendationProjectedMetrics operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetEC2RecommendationProjectedMetrics * @see AWS API Documentation */ @Override public GetEc2RecommendationProjectedMetricsResponse getEC2RecommendationProjectedMetrics( GetEc2RecommendationProjectedMetricsRequest getEc2RecommendationProjectedMetricsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetEc2RecommendationProjectedMetricsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEc2RecommendationProjectedMetricsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEc2RecommendationProjectedMetricsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEC2RecommendationProjectedMetrics"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetEC2RecommendationProjectedMetrics").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEc2RecommendationProjectedMetricsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEc2RecommendationProjectedMetricsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the projected metrics of Amazon ECS service recommendations. *

* * @param getEcsServiceRecommendationProjectedMetricsRequest * @return Result of the GetECSServiceRecommendationProjectedMetrics operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetECSServiceRecommendationProjectedMetrics * @see AWS API Documentation */ @Override public GetEcsServiceRecommendationProjectedMetricsResponse getECSServiceRecommendationProjectedMetrics( GetEcsServiceRecommendationProjectedMetricsRequest getEcsServiceRecommendationProjectedMetricsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetEcsServiceRecommendationProjectedMetricsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( getEcsServiceRecommendationProjectedMetricsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEcsServiceRecommendationProjectedMetricsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetECSServiceRecommendationProjectedMetrics"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetECSServiceRecommendationProjectedMetrics") .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getEcsServiceRecommendationProjectedMetricsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEcsServiceRecommendationProjectedMetricsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns Amazon ECS service recommendations. *

*

* Compute Optimizer generates recommendations for Amazon ECS services on Fargate that meet a specific set of * requirements. For more information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getEcsServiceRecommendationsRequest * @return Result of the GetECSServiceRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetECSServiceRecommendations * @see AWS API Documentation */ @Override public GetEcsServiceRecommendationsResponse getECSServiceRecommendations( GetEcsServiceRecommendationsRequest getEcsServiceRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetEcsServiceRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEcsServiceRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEcsServiceRecommendationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetECSServiceRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetECSServiceRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEcsServiceRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEcsServiceRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the recommendation preferences that are in effect for a given resource, such as enhanced infrastructure * metrics. Considers all applicable preferences that you might have set at the resource, account, and organization * level. *

*

* When you create a recommendation preference, you can set its status to Active or * Inactive. Use this action to view the recommendation preferences that are in effect, or * Active. *

* * @param getEffectiveRecommendationPreferencesRequest * @return Result of the GetEffectiveRecommendationPreferences operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetEffectiveRecommendationPreferences * @see AWS API Documentation */ @Override public GetEffectiveRecommendationPreferencesResponse getEffectiveRecommendationPreferences( GetEffectiveRecommendationPreferencesRequest getEffectiveRecommendationPreferencesRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetEffectiveRecommendationPreferencesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEffectiveRecommendationPreferencesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEffectiveRecommendationPreferencesRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEffectiveRecommendationPreferences"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetEffectiveRecommendationPreferences").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration) .withInput(getEffectiveRecommendationPreferencesRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEffectiveRecommendationPreferencesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the enrollment (opt in) status of an account to the Compute Optimizer service. *

*

* If the account is the management account of an organization, this action also confirms the enrollment status of * member accounts of the organization. Use the GetEnrollmentStatusesForOrganization action to get detailed * information about the enrollment status of member accounts of an organization. *

* * @param getEnrollmentStatusRequest * @return Result of the GetEnrollmentStatus operation returned by the service. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetEnrollmentStatus * @see AWS API Documentation */ @Override public GetEnrollmentStatusResponse getEnrollmentStatus(GetEnrollmentStatusRequest getEnrollmentStatusRequest) throws InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetEnrollmentStatusResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEnrollmentStatusRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEnrollmentStatusRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEnrollmentStatus"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("GetEnrollmentStatus").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEnrollmentStatusRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEnrollmentStatusRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the Compute Optimizer enrollment (opt-in) status of organization member accounts, if your account is an * organization management account. *

*

* To get the enrollment status of standalone accounts, use the GetEnrollmentStatus action. *

* * @param getEnrollmentStatusesForOrganizationRequest * @return Result of the GetEnrollmentStatusesForOrganization operation returned by the service. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetEnrollmentStatusesForOrganization * @see AWS API Documentation */ @Override public GetEnrollmentStatusesForOrganizationResponse getEnrollmentStatusesForOrganization( GetEnrollmentStatusesForOrganizationRequest getEnrollmentStatusesForOrganizationRequest) throws InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetEnrollmentStatusesForOrganizationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getEnrollmentStatusesForOrganizationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getEnrollmentStatusesForOrganizationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetEnrollmentStatusesForOrganization"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetEnrollmentStatusesForOrganization").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getEnrollmentStatusesForOrganizationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetEnrollmentStatusesForOrganizationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns Lambda function recommendations. *

*

* Compute Optimizer generates recommendations for functions that meet a specific set of requirements. For more * information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getLambdaFunctionRecommendationsRequest * @return Result of the GetLambdaFunctionRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws LimitExceededException * The request exceeds a limit of the service. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetLambdaFunctionRecommendations * @see AWS API Documentation */ @Override public GetLambdaFunctionRecommendationsResponse getLambdaFunctionRecommendations( GetLambdaFunctionRecommendationsRequest getLambdaFunctionRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, LimitExceededException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetLambdaFunctionRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getLambdaFunctionRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getLambdaFunctionRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetLambdaFunctionRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetLambdaFunctionRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getLambdaFunctionRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetLambdaFunctionRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns license recommendations for Amazon EC2 instances that run on a specific license. *

*

* Compute Optimizer generates recommendations for licenses that meet a specific set of requirements. For more * information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getLicenseRecommendationsRequest * @return Result of the GetLicenseRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetLicenseRecommendations * @see AWS API Documentation */ @Override public GetLicenseRecommendationsResponse getLicenseRecommendations( GetLicenseRecommendationsRequest getLicenseRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetLicenseRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getLicenseRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getLicenseRecommendationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetLicenseRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetLicenseRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getLicenseRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetLicenseRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the projected metrics of Amazon RDS recommendations. *

* * @param getRdsDatabaseRecommendationProjectedMetricsRequest * @return Result of the GetRDSDatabaseRecommendationProjectedMetrics operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetRDSDatabaseRecommendationProjectedMetrics * @see AWS API Documentation */ @Override public GetRdsDatabaseRecommendationProjectedMetricsResponse getRDSDatabaseRecommendationProjectedMetrics( GetRdsDatabaseRecommendationProjectedMetricsRequest getRdsDatabaseRecommendationProjectedMetricsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, GetRdsDatabaseRecommendationProjectedMetricsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( getRdsDatabaseRecommendationProjectedMetricsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRdsDatabaseRecommendationProjectedMetricsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRDSDatabaseRecommendationProjectedMetrics"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetRDSDatabaseRecommendationProjectedMetrics") .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(getRdsDatabaseRecommendationProjectedMetricsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRdsDatabaseRecommendationProjectedMetricsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns Amazon RDS recommendations. *

*

* Compute Optimizer generates recommendations for Amazon RDS that meet a specific set of requirements. For more * information, see the Supported resources and * requirements in the Compute Optimizer User Guide. *

* * @param getRdsDatabaseRecommendationsRequest * @return Result of the GetRDSDatabaseRecommendations operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetRDSDatabaseRecommendations * @see AWS API Documentation */ @Override public GetRdsDatabaseRecommendationsResponse getRDSDatabaseRecommendations( GetRdsDatabaseRecommendationsRequest getRdsDatabaseRecommendationsRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetRdsDatabaseRecommendationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRdsDatabaseRecommendationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRdsDatabaseRecommendationsRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRDSDatabaseRecommendations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetRDSDatabaseRecommendations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getRdsDatabaseRecommendationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRdsDatabaseRecommendationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns existing recommendation preferences, such as enhanced infrastructure metrics. *

*

* Use the scope parameter to specify which preferences to return. You can specify to return * preferences for an organization, a specific account ID, or a specific EC2 instance or Auto Scaling group Amazon * Resource Name (ARN). *

*

* For more information, see Activating * enhanced infrastructure metrics in the Compute Optimizer User Guide. *

* * @param getRecommendationPreferencesRequest * @return Result of the GetRecommendationPreferences operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetRecommendationPreferences * @see AWS API Documentation */ @Override public GetRecommendationPreferencesResponse getRecommendationPreferences( GetRecommendationPreferencesRequest getRecommendationPreferencesRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetRecommendationPreferencesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRecommendationPreferencesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRecommendationPreferencesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRecommendationPreferences"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetRecommendationPreferences").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getRecommendationPreferencesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRecommendationPreferencesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Returns the optimization findings for an account. *

*

* It returns the number of: *

*
    *
  • *

    * Amazon EC2 instances in an account that are Underprovisioned, Overprovisioned, or * Optimized. *

    *
  • *
  • *

    * Auto Scaling groups in an account that are NotOptimized, or Optimized. *

    *
  • *
  • *

    * Amazon EBS volumes in an account that are NotOptimized, or Optimized. *

    *
  • *
  • *

    * Lambda functions in an account that are NotOptimized, or Optimized. *

    *
  • *
  • *

    * Amazon ECS services in an account that are Underprovisioned, Overprovisioned, or * Optimized. *

    *
  • *
* * @param getRecommendationSummariesRequest * @return Result of the GetRecommendationSummaries operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.GetRecommendationSummaries * @see AWS API Documentation */ @Override public GetRecommendationSummariesResponse getRecommendationSummaries( GetRecommendationSummariesRequest getRecommendationSummariesRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, GetRecommendationSummariesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(getRecommendationSummariesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, getRecommendationSummariesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "GetRecommendationSummaries"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("GetRecommendationSummaries").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(getRecommendationSummariesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new GetRecommendationSummariesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a new recommendation preference or updates an existing recommendation preference, such as enhanced * infrastructure metrics. *

*

* For more information, see Activating * enhanced infrastructure metrics in the Compute Optimizer User Guide. *

* * @param putRecommendationPreferencesRequest * @return Result of the PutRecommendationPreferences operation returned by the service. * @throws OptInRequiredException * The account is not opted in to Compute Optimizer. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws ResourceNotFoundException * A resource that is required for the action doesn't exist. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.PutRecommendationPreferences * @see AWS API Documentation */ @Override public PutRecommendationPreferencesResponse putRecommendationPreferences( PutRecommendationPreferencesRequest putRecommendationPreferencesRequest) throws OptInRequiredException, InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, ResourceNotFoundException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, PutRecommendationPreferencesResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(putRecommendationPreferencesRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, putRecommendationPreferencesRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "PutRecommendationPreferences"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("PutRecommendationPreferences").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(putRecommendationPreferencesRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new PutRecommendationPreferencesRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the enrollment (opt in and opt out) status of an account to the Compute Optimizer 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 Compute Optimizer, to view its recommendations, and to opt * out. For more information, see Controlling access with Amazon * Web Services Identity and Access Management in the Compute Optimizer User Guide. *

*

* When you opt in, Compute Optimizer automatically creates a service-linked role in your account to access its * data. For more information, see Using * Service-Linked Roles for Compute Optimizer in the Compute Optimizer User Guide. *

* * @param updateEnrollmentStatusRequest * @return Result of the UpdateEnrollmentStatus operation returned by the service. * @throws InternalServerException * An internal error has occurred. Try your call again. * @throws ServiceUnavailableException * The request has failed due to a temporary failure of the server. * @throws AccessDeniedException * You do not have sufficient access to perform this action. * @throws InvalidParameterValueException * The value supplied for the input parameter is out of range or not valid. * @throws MissingAuthenticationTokenException * The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 * certificate. * @throws ThrottlingException * The request was denied due to request throttling. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws ComputeOptimizerException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ComputeOptimizerClient.UpdateEnrollmentStatus * @see AWS API Documentation */ @Override public UpdateEnrollmentStatusResponse updateEnrollmentStatus(UpdateEnrollmentStatusRequest updateEnrollmentStatusRequest) throws InternalServerException, ServiceUnavailableException, AccessDeniedException, InvalidParameterValueException, MissingAuthenticationTokenException, ThrottlingException, AwsServiceException, SdkClientException, ComputeOptimizerException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateEnrollmentStatusResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateEnrollmentStatusRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateEnrollmentStatusRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Compute Optimizer"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateEnrollmentStatus"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateEnrollmentStatus").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateEnrollmentStatusRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateEnrollmentStatusRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } @Override public final String serviceName() { return SERVICE_NAME; } private static List resolveMetricPublishers(SdkClientConfiguration clientConfiguration, RequestOverrideConfiguration requestOverrideConfiguration) { List publishers = null; if (requestOverrideConfiguration != null) { publishers = requestOverrideConfiguration.metricPublishers(); } if (publishers == null || publishers.isEmpty()) { publishers = clientConfiguration.option(SdkClientOption.METRIC_PUBLISHERS); } if (publishers == null) { publishers = Collections.emptyList(); } return publishers; } private HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } private void updateRetryStrategyClientConfiguration(SdkClientConfiguration.Builder configuration) { ClientOverrideConfiguration.Builder builder = configuration.asOverrideConfigurationBuilder(); RetryMode retryMode = builder.retryMode(); if (retryMode != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, AwsRetryStrategy.forRetryMode(retryMode)); } else { Consumer> configurator = builder.retryStrategyConfigurator(); if (configurator != null) { RetryStrategy.Builder defaultBuilder = AwsRetryStrategy.defaultRetryStrategy().toBuilder(); configurator.accept(defaultBuilder); configuration.option(SdkClientOption.RETRY_STRATEGY, defaultBuilder.build()); } else { RetryStrategy retryStrategy = builder.retryStrategy(); if (retryStrategy != null) { configuration.option(SdkClientOption.RETRY_STRATEGY, retryStrategy); } } } configuration.option(SdkClientOption.CONFIGURED_RETRY_MODE, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_STRATEGY, null); configuration.option(SdkClientOption.CONFIGURED_RETRY_CONFIGURATOR, null); } private SdkClientConfiguration updateSdkClientConfiguration(SdkRequest request, SdkClientConfiguration clientConfiguration) { List plugins = request.overrideConfiguration().map(c -> c.plugins()).orElse(Collections.emptyList()); SdkClientConfiguration.Builder configuration = clientConfiguration.toBuilder(); if (plugins.isEmpty()) { return configuration.build(); } ComputeOptimizerServiceClientConfigurationBuilder serviceConfigBuilder = new ComputeOptimizerServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(ComputeOptimizerException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.0") .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(500).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("LimitExceededException") .exceptionBuilderSupplier(LimitExceededException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("MissingAuthenticationToken") .exceptionBuilderSupplier(MissingAuthenticationTokenException::builder).httpStatusCode(400) .build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InvalidParameterValueException") .exceptionBuilderSupplier(InvalidParameterValueException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ThrottlingException") .exceptionBuilderSupplier(ThrottlingException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("OptInRequiredException") .exceptionBuilderSupplier(OptInRequiredException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ServiceUnavailableException") .exceptionBuilderSupplier(ServiceUnavailableException::builder).httpStatusCode(500).build()); } @Override public final ComputeOptimizerServiceClientConfiguration serviceClientConfiguration() { return new ComputeOptimizerServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy