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

software.amazon.awssdk.services.applicationinsights.DefaultApplicationInsightsClient Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.15
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.applicationinsights;

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.applicationinsights.internal.ApplicationInsightsServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.applicationinsights.model.AccessDeniedException;
import software.amazon.awssdk.services.applicationinsights.model.AddWorkloadRequest;
import software.amazon.awssdk.services.applicationinsights.model.AddWorkloadResponse;
import software.amazon.awssdk.services.applicationinsights.model.ApplicationInsightsException;
import software.amazon.awssdk.services.applicationinsights.model.BadRequestException;
import software.amazon.awssdk.services.applicationinsights.model.CreateApplicationRequest;
import software.amazon.awssdk.services.applicationinsights.model.CreateApplicationResponse;
import software.amazon.awssdk.services.applicationinsights.model.CreateComponentRequest;
import software.amazon.awssdk.services.applicationinsights.model.CreateComponentResponse;
import software.amazon.awssdk.services.applicationinsights.model.CreateLogPatternRequest;
import software.amazon.awssdk.services.applicationinsights.model.CreateLogPatternResponse;
import software.amazon.awssdk.services.applicationinsights.model.DeleteApplicationRequest;
import software.amazon.awssdk.services.applicationinsights.model.DeleteApplicationResponse;
import software.amazon.awssdk.services.applicationinsights.model.DeleteComponentRequest;
import software.amazon.awssdk.services.applicationinsights.model.DeleteComponentResponse;
import software.amazon.awssdk.services.applicationinsights.model.DeleteLogPatternRequest;
import software.amazon.awssdk.services.applicationinsights.model.DeleteLogPatternResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeApplicationRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeApplicationResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeComponentConfigurationRecommendationRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeComponentConfigurationRecommendationResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeComponentConfigurationRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeComponentConfigurationResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeComponentRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeComponentResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeLogPatternRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeLogPatternResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeObservationRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeObservationResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeProblemObservationsRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeProblemObservationsResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeProblemRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeProblemResponse;
import software.amazon.awssdk.services.applicationinsights.model.DescribeWorkloadRequest;
import software.amazon.awssdk.services.applicationinsights.model.DescribeWorkloadResponse;
import software.amazon.awssdk.services.applicationinsights.model.InternalServerException;
import software.amazon.awssdk.services.applicationinsights.model.ListApplicationsRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListApplicationsResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListComponentsRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListComponentsResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListConfigurationHistoryRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListConfigurationHistoryResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListLogPatternSetsRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListLogPatternSetsResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListLogPatternsRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListLogPatternsResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListProblemsRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListProblemsResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.applicationinsights.model.ListWorkloadsRequest;
import software.amazon.awssdk.services.applicationinsights.model.ListWorkloadsResponse;
import software.amazon.awssdk.services.applicationinsights.model.RemoveWorkloadRequest;
import software.amazon.awssdk.services.applicationinsights.model.RemoveWorkloadResponse;
import software.amazon.awssdk.services.applicationinsights.model.ResourceInUseException;
import software.amazon.awssdk.services.applicationinsights.model.ResourceNotFoundException;
import software.amazon.awssdk.services.applicationinsights.model.TagResourceRequest;
import software.amazon.awssdk.services.applicationinsights.model.TagResourceResponse;
import software.amazon.awssdk.services.applicationinsights.model.TagsAlreadyExistException;
import software.amazon.awssdk.services.applicationinsights.model.TooManyTagsException;
import software.amazon.awssdk.services.applicationinsights.model.UntagResourceRequest;
import software.amazon.awssdk.services.applicationinsights.model.UntagResourceResponse;
import software.amazon.awssdk.services.applicationinsights.model.UpdateApplicationRequest;
import software.amazon.awssdk.services.applicationinsights.model.UpdateApplicationResponse;
import software.amazon.awssdk.services.applicationinsights.model.UpdateComponentConfigurationRequest;
import software.amazon.awssdk.services.applicationinsights.model.UpdateComponentConfigurationResponse;
import software.amazon.awssdk.services.applicationinsights.model.UpdateComponentRequest;
import software.amazon.awssdk.services.applicationinsights.model.UpdateComponentResponse;
import software.amazon.awssdk.services.applicationinsights.model.UpdateLogPatternRequest;
import software.amazon.awssdk.services.applicationinsights.model.UpdateLogPatternResponse;
import software.amazon.awssdk.services.applicationinsights.model.UpdateProblemRequest;
import software.amazon.awssdk.services.applicationinsights.model.UpdateProblemResponse;
import software.amazon.awssdk.services.applicationinsights.model.UpdateWorkloadRequest;
import software.amazon.awssdk.services.applicationinsights.model.UpdateWorkloadResponse;
import software.amazon.awssdk.services.applicationinsights.model.ValidationException;
import software.amazon.awssdk.services.applicationinsights.transform.AddWorkloadRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.CreateApplicationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.CreateComponentRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.CreateLogPatternRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DeleteApplicationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DeleteComponentRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DeleteLogPatternRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeApplicationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeComponentConfigurationRecommendationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeComponentConfigurationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeComponentRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeLogPatternRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeObservationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeProblemObservationsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeProblemRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.DescribeWorkloadRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListApplicationsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListComponentsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListConfigurationHistoryRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListLogPatternSetsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListLogPatternsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListProblemsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.ListWorkloadsRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.RemoveWorkloadRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UpdateApplicationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UpdateComponentConfigurationRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UpdateComponentRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UpdateLogPatternRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UpdateProblemRequestMarshaller;
import software.amazon.awssdk.services.applicationinsights.transform.UpdateWorkloadRequestMarshaller;
import software.amazon.awssdk.utils.Logger;

/**
 * Internal implementation of {@link ApplicationInsightsClient}.
 *
 * @see ApplicationInsightsClient#builder()
 */
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultApplicationInsightsClient implements ApplicationInsightsClient {
    private static final Logger log = Logger.loggerFor(DefaultApplicationInsightsClient.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 DefaultApplicationInsightsClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsSyncClientHandler(clientConfiguration);
        this.clientConfiguration = clientConfiguration.toBuilder().option(SdkClientOption.SDK_CLIENT, this).build();
        this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
    }

    /**
     * 

* Adds a workload to a component. Each component can have at most five workloads. *

* * @param addWorkloadRequest * @return Result of the AddWorkload operation returned by the service. * @throws ResourceInUseException * The resource is already created or in use. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.AddWorkload * @see AWS API Documentation */ @Override public AddWorkloadResponse addWorkload(AddWorkloadRequest addWorkloadRequest) throws ResourceInUseException, ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AddWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(addWorkloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, addWorkloadRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AddWorkload"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("AddWorkload").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(addWorkloadRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new AddWorkloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds an application that is created from a resource group. *

* * @param createApplicationRequest * @return Result of the CreateApplication operation returned by the service. * @throws ResourceInUseException * The resource is already created or in use. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws TagsAlreadyExistException * Tags are already registered for the specified application ARN. * @throws AccessDeniedException * User does not have permissions to perform this action. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.CreateApplication * @see AWS API Documentation */ @Override public CreateApplicationResponse createApplication(CreateApplicationRequest createApplicationRequest) throws ResourceInUseException, ResourceNotFoundException, ValidationException, InternalServerException, TagsAlreadyExistException, AccessDeniedException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createApplicationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createApplicationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateApplication"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateApplication").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createApplicationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateApplicationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Creates a custom component by grouping similar standalone instances to monitor. *

* * @param createComponentRequest * @return Result of the CreateComponent operation returned by the service. * @throws ResourceInUseException * The resource is already created or in use. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.CreateComponent * @see AWS API Documentation */ @Override public CreateComponentResponse createComponent(CreateComponentRequest createComponentRequest) throws ResourceInUseException, ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createComponentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createComponentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateComponent"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateComponent").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createComponentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateComponentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds an log pattern to a LogPatternSet. *

* * @param createLogPatternRequest * @return Result of the CreateLogPattern operation returned by the service. * @throws ResourceInUseException * The resource is already created or in use. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.CreateLogPattern * @see AWS API Documentation */ @Override public CreateLogPatternResponse createLogPattern(CreateLogPatternRequest createLogPatternRequest) throws ResourceInUseException, ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, CreateLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLogPatternRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, createLogPatternRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLogPattern"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("CreateLogPattern").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(createLogPatternRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new CreateLogPatternRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes the specified application from monitoring. Does not delete the application. *

* * @param deleteApplicationRequest * @return Result of the DeleteApplication operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws BadRequestException * The request is not understood by the server. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DeleteApplication * @see AWS API Documentation */ @Override public DeleteApplicationResponse deleteApplication(DeleteApplicationRequest deleteApplicationRequest) throws ResourceNotFoundException, ValidationException, BadRequestException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteApplicationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteApplicationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteApplication"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteApplication").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteApplicationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteApplicationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Ungroups a custom component. When you ungroup custom components, all applicable monitors that are set up for the * component are removed and the instances revert to their standalone status. *

* * @param deleteComponentRequest * @return Result of the DeleteComponent operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DeleteComponent * @see AWS API Documentation */ @Override public DeleteComponentResponse deleteComponent(DeleteComponentRequest deleteComponentRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteComponentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteComponentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteComponent"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteComponent").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteComponentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteComponentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Removes the specified log pattern from a LogPatternSet. *

* * @param deleteLogPatternRequest * @return Result of the DeleteLogPattern operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws BadRequestException * The request is not understood by the server. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DeleteLogPattern * @see AWS API Documentation */ @Override public DeleteLogPatternResponse deleteLogPattern(DeleteLogPatternRequest deleteLogPatternRequest) throws ResourceNotFoundException, ValidationException, BadRequestException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DeleteLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLogPatternRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLogPatternRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLogPattern"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DeleteLogPattern").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(deleteLogPatternRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DeleteLogPatternRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the application. *

* * @param describeApplicationRequest * @return Result of the DescribeApplication operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeApplication * @see AWS API Documentation */ @Override public DescribeApplicationResponse describeApplication(DescribeApplicationRequest describeApplicationRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeApplicationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeApplicationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeApplication"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeApplication").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeApplicationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeApplicationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes a component and lists the resources that are grouped together in a component. *

* * @param describeComponentRequest * @return Result of the DescribeComponent operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeComponent * @see AWS API Documentation */ @Override public DescribeComponentResponse describeComponent(DescribeComponentRequest describeComponentRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeComponentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeComponentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeComponent"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeComponent").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeComponentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeComponentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the monitoring configuration of the component. *

* * @param describeComponentConfigurationRequest * @return Result of the DescribeComponentConfiguration operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeComponentConfiguration * @see AWS API Documentation */ @Override public DescribeComponentConfigurationResponse describeComponentConfiguration( DescribeComponentConfigurationRequest describeComponentConfigurationRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeComponentConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeComponentConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeComponentConfigurationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeComponentConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeComponentConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeComponentConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeComponentConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the recommended monitoring configuration of the component. *

* * @param describeComponentConfigurationRecommendationRequest * @return Result of the DescribeComponentConfigurationRecommendation operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeComponentConfigurationRecommendation * @see AWS API Documentation */ @Override public DescribeComponentConfigurationRecommendationResponse describeComponentConfigurationRecommendation( DescribeComponentConfigurationRecommendationRequest describeComponentConfigurationRecommendationRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeComponentConfigurationRecommendationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration( describeComponentConfigurationRecommendationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeComponentConfigurationRecommendationRequest.overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeComponentConfigurationRecommendation"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeComponentConfigurationRecommendation") .withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(describeComponentConfigurationRecommendationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeComponentConfigurationRecommendationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describe a specific log pattern from a LogPatternSet. *

* * @param describeLogPatternRequest * @return Result of the DescribeLogPattern operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeLogPattern * @see AWS API Documentation */ @Override public DescribeLogPatternResponse describeLogPattern(DescribeLogPatternRequest describeLogPatternRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLogPatternRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLogPatternRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLogPattern"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeLogPattern").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeLogPatternRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeLogPatternRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes an anomaly or error with the application. *

* * @param describeObservationRequest * @return Result of the DescribeObservation operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeObservation * @see AWS API Documentation */ @Override public DescribeObservationResponse describeObservation(DescribeObservationRequest describeObservationRequest) throws InternalServerException, ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeObservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeObservationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeObservationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeObservation"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeObservation").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeObservationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeObservationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes an application problem. *

* * @param describeProblemRequest * @return Result of the DescribeProblem operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeProblem * @see AWS API Documentation */ @Override public DescribeProblemResponse describeProblem(DescribeProblemRequest describeProblemRequest) throws InternalServerException, ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeProblemResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeProblemRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeProblemRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeProblem"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeProblem").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeProblemRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeProblemRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes the anomalies or errors associated with the problem. *

* * @param describeProblemObservationsRequest * @return Result of the DescribeProblemObservations operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeProblemObservations * @see AWS API Documentation */ @Override public DescribeProblemObservationsResponse describeProblemObservations( DescribeProblemObservationsRequest describeProblemObservationsRequest) throws InternalServerException, ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeProblemObservationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeProblemObservationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeProblemObservationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeProblemObservations"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeProblemObservations").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeProblemObservationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeProblemObservationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Describes a workload and its configuration. *

* * @param describeWorkloadRequest * @return Result of the DescribeWorkload operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.DescribeWorkload * @see AWS API Documentation */ @Override public DescribeWorkloadResponse describeWorkload(DescribeWorkloadRequest describeWorkloadRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, DescribeWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeWorkloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, describeWorkloadRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeWorkload"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("DescribeWorkload").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(describeWorkloadRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new DescribeWorkloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the IDs of the applications that you are monitoring. *

* * @param listApplicationsRequest * @return Result of the ListApplications operation returned by the service. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListApplications * @see AWS API Documentation */ @Override public ListApplicationsResponse listApplications(ListApplicationsRequest listApplicationsRequest) throws ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListApplicationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listApplicationsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listApplicationsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListApplications"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListApplications").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listApplicationsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListApplicationsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the auto-grouped, standalone, and custom components of the application. *

* * @param listComponentsRequest * @return Result of the ListComponents operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListComponents * @see AWS API Documentation */ @Override public ListComponentsResponse listComponents(ListComponentsRequest listComponentsRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListComponentsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listComponentsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listComponentsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListComponents"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListComponents").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listComponentsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListComponentsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the INFO, WARN, and ERROR events for periodic configuration updates performed by Application Insights. * Examples of events represented are: *

*
    *
  • *

    * INFO: creating a new alarm or updating an alarm threshold. *

    *
  • *
  • *

    * WARN: alarm not created due to insufficient data points used to predict thresholds. *

    *
  • *
  • *

    * ERROR: alarm not created due to permission errors or exceeding quotas. *

    *
  • *
* * @param listConfigurationHistoryRequest * @return Result of the ListConfigurationHistory operation returned by the service. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListConfigurationHistory * @see AWS API Documentation */ @Override public ListConfigurationHistoryResponse listConfigurationHistory( ListConfigurationHistoryRequest listConfigurationHistoryRequest) throws ValidationException, ResourceNotFoundException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListConfigurationHistoryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listConfigurationHistoryRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listConfigurationHistoryRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListConfigurationHistory"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("ListConfigurationHistory").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listConfigurationHistoryRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListConfigurationHistoryRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the log pattern sets in the specific application. *

* * @param listLogPatternSetsRequest * @return Result of the ListLogPatternSets operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListLogPatternSets * @see AWS API Documentation */ @Override public ListLogPatternSetsResponse listLogPatternSets(ListLogPatternSetsRequest listLogPatternSetsRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListLogPatternSetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listLogPatternSetsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listLogPatternSetsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListLogPatternSets"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListLogPatternSets").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listLogPatternSetsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListLogPatternSetsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the log patterns in the specific log LogPatternSet. *

* * @param listLogPatternsRequest * @return Result of the ListLogPatterns operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListLogPatterns * @see AWS API Documentation */ @Override public ListLogPatternsResponse listLogPatterns(ListLogPatternsRequest listLogPatternsRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListLogPatternsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listLogPatternsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listLogPatternsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListLogPatterns"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListLogPatterns").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listLogPatternsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListLogPatternsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the problems with your application. *

* * @param listProblemsRequest * @return Result of the ListProblems operation returned by the service. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListProblems * @see AWS API Documentation */ @Override public ListProblemsResponse listProblems(ListProblemsRequest listProblemsRequest) throws ValidationException, ResourceNotFoundException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListProblemsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listProblemsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listProblemsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListProblems"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListProblems").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listProblemsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListProblemsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Retrieve a list of the tags (keys and values) that are associated with a specified application. A tag is a * label that you optionally define and associate with an application. Each tag consists of a required tag * key and an optional associated tag value. A tag key is a general label that acts as a category for * more specific tag values. A tag value acts as a descriptor within a tag key. *

* * @param listTagsForResourceRequest * @return Result of the ListTagsForResource operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListTagsForResource * @see AWS API Documentation */ @Override public ListTagsForResourceResponse listTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) throws ResourceNotFoundException, ValidationException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listTagsForResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listTagsForResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListTagsForResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listTagsForResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Lists the workloads that are configured on a given component. *

* * @param listWorkloadsRequest * @return Result of the ListWorkloads operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.ListWorkloads * @see AWS API Documentation */ @Override public ListWorkloadsResponse listWorkloads(ListWorkloadsRequest listWorkloadsRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListWorkloadsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(listWorkloadsRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, listWorkloadsRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "ListWorkloads"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("ListWorkloads").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(listWorkloadsRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new ListWorkloadsRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Remove workload from a component. *

* * @param removeWorkloadRequest * @return Result of the RemoveWorkload operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.RemoveWorkload * @see AWS API Documentation */ @Override public RemoveWorkloadResponse removeWorkload(RemoveWorkloadRequest removeWorkloadRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, RemoveWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(removeWorkloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, removeWorkloadRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "RemoveWorkload"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("RemoveWorkload").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(removeWorkloadRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new RemoveWorkloadRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Add one or more tags (keys and values) to a specified application. A tag is a label that you optionally * define and associate with an application. Tags can help you categorize and manage application in different ways, * such as by purpose, owner, environment, or other criteria. *

*

* Each tag consists of a required tag key and an associated tag value, both of which you define. A * tag key is a general label that acts as a category for more specific tag values. A tag value acts as a descriptor * within a tag key. *

* * @param tagResourceRequest * @return Result of the TagResource operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws TooManyTagsException * The number of the provided tags is beyond the limit, or the number of total tags you are trying to attach * to the specified resource exceeds the limit. * @throws ValidationException * The parameter is not valid. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.TagResource * @see AWS API Documentation */ @Override public TagResourceResponse tagResource(TagResourceRequest tagResourceRequest) throws ResourceNotFoundException, TooManyTagsException, ValidationException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(tagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, tagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "TagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata).withResponseHandler(responseHandler) .withErrorResponseHandler(errorResponseHandler).withRequestConfiguration(clientConfiguration) .withInput(tagResourceRequest).withMetricCollector(apiCallMetricCollector) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Remove one or more tags (keys and values) from a specified application. *

* * @param untagResourceRequest * @return Result of the UntagResource operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UntagResource * @see AWS API Documentation */ @Override public UntagResourceResponse untagResource(UntagResourceRequest untagResourceRequest) throws ResourceNotFoundException, ValidationException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(untagResourceRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, untagResourceRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UntagResource"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(untagResourceRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the application. *

* * @param updateApplicationRequest * @return Result of the UpdateApplication operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UpdateApplication * @see AWS API Documentation */ @Override public UpdateApplicationResponse updateApplication(UpdateApplicationRequest updateApplicationRequest) throws InternalServerException, ResourceNotFoundException, ValidationException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateApplicationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateApplicationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateApplication"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateApplication").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateApplicationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateApplicationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the custom component name and/or the list of resources that make up the component. *

* * @param updateComponentRequest * @return Result of the UpdateComponent operation returned by the service. * @throws ResourceInUseException * The resource is already created or in use. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UpdateComponent * @see AWS API Documentation */ @Override public UpdateComponentResponse updateComponent(UpdateComponentRequest updateComponentRequest) throws ResourceInUseException, ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateComponentRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateComponentRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateComponent"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateComponent").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateComponentRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateComponentRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the monitoring configurations for the component. The configuration input parameter is an escaped JSON of * the configuration and should match the schema of what is returned by * DescribeComponentConfigurationRecommendation. *

* * @param updateComponentConfigurationRequest * @return Result of the UpdateComponentConfiguration operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ResourceInUseException * The resource is already created or in use. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UpdateComponentConfiguration * @see AWS API Documentation */ @Override public UpdateComponentConfigurationResponse updateComponentConfiguration( UpdateComponentConfigurationRequest updateComponentConfigurationRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, ResourceInUseException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateComponentConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateComponentConfigurationRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateComponentConfigurationRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateComponentConfiguration"); return clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateComponentConfiguration").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateComponentConfigurationRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateComponentConfigurationRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds a log pattern to a LogPatternSet. *

* * @param updateLogPatternRequest * @return Result of the UpdateLogPattern operation returned by the service. * @throws ResourceInUseException * The resource is already created or in use. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UpdateLogPattern * @see AWS API Documentation */ @Override public UpdateLogPatternResponse updateLogPattern(UpdateLogPatternRequest updateLogPatternRequest) throws ResourceInUseException, ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateLogPatternRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateLogPatternRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateLogPattern"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateLogPattern").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateLogPatternRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateLogPatternRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Updates the visibility of the problem or specifies the problem as RESOLVED. *

* * @param updateProblemRequest * @return Result of the UpdateProblem operation returned by the service. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @throws ValidationException * The parameter is not valid. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UpdateProblem * @see AWS API Documentation */ @Override public UpdateProblemResponse updateProblem(UpdateProblemRequest updateProblemRequest) throws InternalServerException, ValidationException, ResourceNotFoundException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateProblemResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateProblemRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateProblemRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateProblem"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateProblem").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateProblemRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateProblemRequestMarshaller(protocolFactory))); } finally { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); } } /** *

* Adds a workload to a component. Each component can have at most five workloads. *

* * @param updateWorkloadRequest * @return Result of the UpdateWorkload operation returned by the service. * @throws ResourceNotFoundException * The resource does not exist in the customer account. * @throws ValidationException * The parameter is not valid. * @throws InternalServerException * The server encountered an internal error and is unable to complete the request. * @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 ApplicationInsightsException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample ApplicationInsightsClient.UpdateWorkload * @see AWS API Documentation */ @Override public UpdateWorkloadResponse updateWorkload(UpdateWorkloadRequest updateWorkloadRequest) throws ResourceNotFoundException, ValidationException, InternalServerException, AwsServiceException, SdkClientException, ApplicationInsightsException { JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(updateWorkloadRequest, this.clientConfiguration); List metricPublishers = resolveMetricPublishers(clientConfiguration, updateWorkloadRequest .overrideConfiguration().orElse(null)); MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector .create("ApiCall"); try { apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Application Insights"); apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "UpdateWorkload"); return clientHandler.execute(new ClientExecutionParams() .withOperationName("UpdateWorkload").withProtocolMetadata(protocolMetadata) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withInput(updateWorkloadRequest) .withMetricCollector(apiCallMetricCollector) .withMarshaller(new UpdateWorkloadRequestMarshaller(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(); } ApplicationInsightsServiceClientConfigurationBuilder serviceConfigBuilder = new ApplicationInsightsServiceClientConfigurationBuilder( configuration); for (SdkPlugin plugin : plugins) { plugin.configureClient(serviceConfigBuilder); } updateRetryStrategyClientConfiguration(configuration); return configuration.build(); } private > T init(T builder) { return builder .clientConfiguration(clientConfiguration) .defaultServiceExceptionSupplier(ApplicationInsightsException::builder) .protocol(AwsJsonProtocol.AWS_JSON) .protocolVersion("1.1") .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceInUseException") .exceptionBuilderSupplier(ResourceInUseException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("TagsAlreadyExistException") .exceptionBuilderSupplier(TagsAlreadyExistException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("InternalServerException") .exceptionBuilderSupplier(InternalServerException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("AccessDeniedException") .exceptionBuilderSupplier(AccessDeniedException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("TooManyTagsException") .exceptionBuilderSupplier(TooManyTagsException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ResourceNotFoundException") .exceptionBuilderSupplier(ResourceNotFoundException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("ValidationException") .exceptionBuilderSupplier(ValidationException::builder).httpStatusCode(400).build()) .registerModeledException( ExceptionMetadata.builder().errorCode("BadRequestException") .exceptionBuilderSupplier(BadRequestException::builder).httpStatusCode(400).build()); } @Override public final ApplicationInsightsServiceClientConfiguration serviceClientConfiguration() { return new ApplicationInsightsServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy