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

software.amazon.awssdk.services.applicationinsights.DefaultApplicationInsightsAsyncClient 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.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
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.AsyncClientHandler;
import software.amazon.awssdk.core.client.handler.ClientExecutionParams;
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.CompletableFutureUtils;

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

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

    private final AsyncClientHandler clientHandler;

    private final AwsJsonProtocolFactory protocolFactory;

    private final SdkClientConfiguration clientConfiguration;

    protected DefaultApplicationInsightsAsyncClient(SdkClientConfiguration clientConfiguration) {
        this.clientHandler = new AwsAsyncClientHandler(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 A Java Future containing the result of the AddWorkload operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceInUseException The resource is already created or in use.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.AddWorkload * @see AWS API Documentation */ @Override public CompletableFuture addWorkload(AddWorkloadRequest addWorkloadRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, AddWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("AddWorkload").withProtocolMetadata(protocolMetadata) .withMarshaller(new AddWorkloadRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(addWorkloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param createApplicationRequest * @return A Java Future containing the result of the CreateApplication operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceInUseException The resource is already created or in use.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • TagsAlreadyExistException Tags are already registered for the specified application ARN.
  • *
  • AccessDeniedException User does not have permissions to perform this action.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.CreateApplication * @see AWS API Documentation */ @Override public CompletableFuture createApplication(CreateApplicationRequest createApplicationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateApplication").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateApplicationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createApplicationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param createComponentRequest * @return A Java Future containing the result of the CreateComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceInUseException The resource is already created or in use.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.CreateComponent * @see AWS API Documentation */ @Override public CompletableFuture createComponent(CreateComponentRequest createComponentRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateComponent").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateComponentRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createComponentRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Adds an log pattern to a LogPatternSet. *

* * @param createLogPatternRequest * @return A Java Future containing the result of the CreateLogPattern operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceInUseException The resource is already created or in use.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.CreateLogPattern * @see AWS API Documentation */ @Override public CompletableFuture createLogPattern(CreateLogPatternRequest createLogPatternRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, CreateLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("CreateLogPattern").withProtocolMetadata(protocolMetadata) .withMarshaller(new CreateLogPatternRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(createLogPatternRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param deleteApplicationRequest * @return A Java Future containing the result of the DeleteApplication operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • BadRequestException The request is not understood by the server.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DeleteApplication * @see AWS API Documentation */ @Override public CompletableFuture deleteApplication(DeleteApplicationRequest deleteApplicationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteApplication").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteApplicationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteApplicationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* 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 A Java Future containing the result of the DeleteComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DeleteComponent * @see AWS API Documentation */ @Override public CompletableFuture deleteComponent(DeleteComponentRequest deleteComponentRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteComponent").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteComponentRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteComponentRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Removes the specified log pattern from a LogPatternSet. *

* * @param deleteLogPatternRequest * @return A Java Future containing the result of the DeleteLogPattern operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • BadRequestException The request is not understood by the server.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DeleteLogPattern * @see AWS API Documentation */ @Override public CompletableFuture deleteLogPattern(DeleteLogPatternRequest deleteLogPatternRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DeleteLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DeleteLogPattern").withProtocolMetadata(protocolMetadata) .withMarshaller(new DeleteLogPatternRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(deleteLogPatternRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the application. *

* * @param describeApplicationRequest * @return A Java Future containing the result of the DescribeApplication operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeApplication * @see AWS API Documentation */ @Override public CompletableFuture describeApplication( DescribeApplicationRequest describeApplicationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeApplication").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeApplicationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeApplicationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param describeComponentRequest * @return A Java Future containing the result of the DescribeComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeComponent * @see AWS API Documentation */ @Override public CompletableFuture describeComponent(DescribeComponentRequest describeComponentRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeComponent").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeComponentRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeComponentRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the monitoring configuration of the component. *

* * @param describeComponentConfigurationRequest * @return A Java Future containing the result of the DescribeComponentConfiguration operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeComponentConfiguration * @see AWS API Documentation */ @Override public CompletableFuture describeComponentConfiguration( DescribeComponentConfigurationRequest describeComponentConfigurationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeComponentConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeComponentConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeComponentConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeComponentConfigurationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes the recommended monitoring configuration of the component. *

* * @param describeComponentConfigurationRecommendationRequest * @return A Java Future containing the result of the DescribeComponentConfigurationRecommendation operation * returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeComponentConfigurationRecommendation * @see AWS API Documentation */ @Override public CompletableFuture describeComponentConfigurationRecommendation( DescribeComponentConfigurationRecommendationRequest describeComponentConfigurationRecommendationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory .createResponseHandler(operationMetadata, DescribeComponentConfigurationRecommendationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeComponentConfigurationRecommendation") .withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeComponentConfigurationRecommendationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeComponentConfigurationRecommendationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete(( r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describe a specific log pattern from a LogPatternSet. *

* * @param describeLogPatternRequest * @return A Java Future containing the result of the DescribeLogPattern operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeLogPattern * @see AWS API Documentation */ @Override public CompletableFuture describeLogPattern(DescribeLogPatternRequest describeLogPatternRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeLogPattern").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeLogPatternRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeLogPatternRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes an anomaly or error with the application. *

* * @param describeObservationRequest * @return A Java Future containing the result of the DescribeObservation operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • ValidationException The parameter is not valid.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeObservation * @see AWS API Documentation */ @Override public CompletableFuture describeObservation( DescribeObservationRequest describeObservationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeObservationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeObservation").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeObservationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeObservationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes an application problem. *

* * @param describeProblemRequest * @return A Java Future containing the result of the DescribeProblem operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • ValidationException The parameter is not valid.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeProblem * @see AWS API Documentation */ @Override public CompletableFuture describeProblem(DescribeProblemRequest describeProblemRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeProblemResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeProblem").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeProblemRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeProblemRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param describeProblemObservationsRequest * @return A Java Future containing the result of the DescribeProblemObservations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • ValidationException The parameter is not valid.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeProblemObservations * @see AWS API Documentation */ @Override public CompletableFuture describeProblemObservations( DescribeProblemObservationsRequest describeProblemObservationsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeProblemObservationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeProblemObservations").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeProblemObservationsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeProblemObservationsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Describes a workload and its configuration. *

* * @param describeWorkloadRequest * @return A Java Future containing the result of the DescribeWorkload operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.DescribeWorkload * @see AWS API Documentation */ @Override public CompletableFuture describeWorkload(DescribeWorkloadRequest describeWorkloadRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, DescribeWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("DescribeWorkload").withProtocolMetadata(protocolMetadata) .withMarshaller(new DescribeWorkloadRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(describeWorkloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param listApplicationsRequest * @return A Java Future containing the result of the ListApplications operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListApplications * @see AWS API Documentation */ @Override public CompletableFuture listApplications(ListApplicationsRequest listApplicationsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListApplicationsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListApplications").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListApplicationsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listApplicationsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param listComponentsRequest * @return A Java Future containing the result of the ListComponents operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListComponents * @see AWS API Documentation */ @Override public CompletableFuture listComponents(ListComponentsRequest listComponentsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListComponentsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListComponents").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListComponentsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listComponentsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* 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 A Java Future containing the result of the ListConfigurationHistory operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ValidationException The parameter is not valid.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListConfigurationHistory * @see AWS API Documentation */ @Override public CompletableFuture listConfigurationHistory( ListConfigurationHistoryRequest listConfigurationHistoryRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListConfigurationHistoryResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListConfigurationHistory").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListConfigurationHistoryRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listConfigurationHistoryRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param listLogPatternSetsRequest * @return A Java Future containing the result of the ListLogPatternSets operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListLogPatternSets * @see AWS API Documentation */ @Override public CompletableFuture listLogPatternSets(ListLogPatternSetsRequest listLogPatternSetsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListLogPatternSetsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListLogPatternSets").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListLogPatternSetsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listLogPatternSetsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param listLogPatternsRequest * @return A Java Future containing the result of the ListLogPatterns operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListLogPatterns * @see AWS API Documentation */ @Override public CompletableFuture listLogPatterns(ListLogPatternsRequest listLogPatternsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListLogPatternsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListLogPatterns").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListLogPatternsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listLogPatternsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Lists the problems with your application. *

* * @param listProblemsRequest * @return A Java Future containing the result of the ListProblems operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ValidationException The parameter is not valid.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListProblems * @see AWS API Documentation */ @Override public CompletableFuture listProblems(ListProblemsRequest listProblemsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListProblemsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListProblems").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListProblemsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listProblemsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* 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 A Java Future containing the result of the ListTagsForResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListTagsForResource * @see AWS API Documentation */ @Override public CompletableFuture listTagsForResource( ListTagsForResourceRequest listTagsForResourceRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, ListTagsForResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListTagsForResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListTagsForResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listTagsForResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param listWorkloadsRequest * @return A Java Future containing the result of the ListWorkloads operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.ListWorkloads * @see AWS API Documentation */ @Override public CompletableFuture listWorkloads(ListWorkloadsRequest listWorkloadsRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, ListWorkloadsResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("ListWorkloads").withProtocolMetadata(protocolMetadata) .withMarshaller(new ListWorkloadsRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(listWorkloadsRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Remove workload from a component. *

* * @param removeWorkloadRequest * @return A Java Future containing the result of the RemoveWorkload operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.RemoveWorkload * @see AWS API Documentation */ @Override public CompletableFuture removeWorkload(RemoveWorkloadRequest removeWorkloadRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, RemoveWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("RemoveWorkload").withProtocolMetadata(protocolMetadata) .withMarshaller(new RemoveWorkloadRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(removeWorkloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* 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 A Java Future containing the result of the TagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • 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.
  • *
  • ValidationException The parameter is not valid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.TagResource * @see AWS API Documentation */ @Override public CompletableFuture tagResource(TagResourceRequest tagResourceRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, TagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("TagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new TagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(tagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param untagResourceRequest * @return A Java Future containing the result of the UntagResource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UntagResource * @see AWS API Documentation */ @Override public CompletableFuture untagResource(UntagResourceRequest untagResourceRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UntagResourceResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UntagResource").withProtocolMetadata(protocolMetadata) .withMarshaller(new UntagResourceRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(untagResourceRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Updates the application. *

* * @param updateApplicationRequest * @return A Java Future containing the result of the UpdateApplication operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UpdateApplication * @see AWS API Documentation */ @Override public CompletableFuture updateApplication(UpdateApplicationRequest updateApplicationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateApplicationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateApplication").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateApplicationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateApplicationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param updateComponentRequest * @return A Java Future containing the result of the UpdateComponent operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceInUseException The resource is already created or in use.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UpdateComponent * @see AWS API Documentation */ @Override public CompletableFuture updateComponent(UpdateComponentRequest updateComponentRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateComponentResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateComponent").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateComponentRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateComponentRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* 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 A Java Future containing the result of the UpdateComponentConfiguration operation returned by the * service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • ResourceInUseException The resource is already created or in use.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UpdateComponentConfiguration * @see AWS API Documentation */ @Override public CompletableFuture updateComponentConfiguration( UpdateComponentConfigurationRequest updateComponentConfigurationRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateComponentConfigurationResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateComponentConfiguration").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateComponentConfigurationRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateComponentConfigurationRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

* Adds a log pattern to a LogPatternSet. *

* * @param updateLogPatternRequest * @return A Java Future containing the result of the UpdateLogPattern operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceInUseException The resource is already created or in use.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UpdateLogPattern * @see AWS API Documentation */ @Override public CompletableFuture updateLogPattern(UpdateLogPatternRequest updateLogPatternRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateLogPatternResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateLogPattern").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateLogPatternRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateLogPatternRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param updateProblemRequest * @return A Java Future containing the result of the UpdateProblem operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • ValidationException The parameter is not valid.
  • *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UpdateProblem * @see AWS API Documentation */ @Override public CompletableFuture updateProblem(UpdateProblemRequest updateProblemRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(operationMetadata, UpdateProblemResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateProblem").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateProblemRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateProblemRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } /** *

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

* * @param updateWorkloadRequest * @return A Java Future containing the result of the UpdateWorkload operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following * exceptions. The exception returned is wrapped with CompletionException, so you need to invoke * {@link Throwable#getCause} to retrieve the underlying exception. *
    *
  • ResourceNotFoundException The resource does not exist in the customer account.
  • *
  • ValidationException The parameter is not valid.
  • *
  • InternalServerException The server encountered an internal error and is unable to complete the * request.
  • *
  • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). * Can be used for catch all scenarios.
  • *
  • SdkClientException If any client side error occurs such as an IO related failure, failure to get * credentials, etc.
  • *
  • ApplicationInsightsException Base class for all service exceptions. Unknown exceptions will be thrown * as an instance of this type.
  • *
* @sample ApplicationInsightsAsyncClient.UpdateWorkload * @see AWS API Documentation */ @Override public CompletableFuture updateWorkload(UpdateWorkloadRequest updateWorkloadRequest) { 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"); JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false) .isPayloadJson(true).build(); HttpResponseHandler responseHandler = protocolFactory.createResponseHandler( operationMetadata, UpdateWorkloadResponse::builder); HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata); CompletableFuture executeFuture = clientHandler .execute(new ClientExecutionParams() .withOperationName("UpdateWorkload").withProtocolMetadata(protocolMetadata) .withMarshaller(new UpdateWorkloadRequestMarshaller(protocolFactory)) .withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler) .withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector) .withInput(updateWorkloadRequest)); CompletableFuture whenCompleted = executeFuture.whenComplete((r, e) -> { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); }); executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture); return executeFuture; } catch (Throwable t) { metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect())); return CompletableFutureUtils.failedFuture(t); } } @Override public final ApplicationInsightsServiceClientConfiguration serviceClientConfiguration() { return new ApplicationInsightsServiceClientConfigurationBuilder(this.clientConfiguration.toBuilder()).build(); } @Override public final String serviceName() { return SERVICE_NAME; } 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()); } 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 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 HttpResponseHandler createErrorResponseHandler(BaseAwsJsonProtocolFactory protocolFactory, JsonOperationMetadata operationMetadata) { return protocolFactory.createErrorResponseHandler(operationMetadata); } @Override public void close() { clientHandler.close(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy