software.amazon.awssdk.services.cloudwatchlogs.DefaultCloudWatchLogsAsyncClient Maven / Gradle / Ivy
Show all versions of cloudwatchlogs Show documentation
/*
* 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.cloudwatchlogs;
import static software.amazon.awssdk.utils.FunctionalUtils.runAndLogError;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
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.eventstream.EventStreamAsyncResponseTransformer;
import software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier;
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.core.RequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkPlugin;
import software.amazon.awssdk.core.SdkPojoBuilder;
import software.amazon.awssdk.core.SdkRequest;
import software.amazon.awssdk.core.SdkResponse;
import software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption;
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.AttachHttpMetadataResponseHandler;
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.protocol.VoidSdkResponse;
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.services.cloudwatchlogs.internal.CloudWatchLogsServiceClientConfigurationBuilder;
import software.amazon.awssdk.services.cloudwatchlogs.model.AccessDeniedException;
import software.amazon.awssdk.services.cloudwatchlogs.model.AssociateKmsKeyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.AssociateKmsKeyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.CancelExportTaskRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.CancelExportTaskResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.CloudWatchLogsException;
import software.amazon.awssdk.services.cloudwatchlogs.model.ConflictException;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateDeliveryRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateDeliveryResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateExportTaskRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateExportTaskResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateLogAnomalyDetectorRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateLogAnomalyDetectorResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateLogGroupRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateLogGroupResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateLogStreamRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.CreateLogStreamResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DataAlreadyAcceptedException;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteAccountPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteAccountPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDataProtectionPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDataProtectionPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliveryDestinationPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliveryDestinationPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliveryDestinationRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliveryDestinationResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliveryRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliveryResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliverySourceRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDeliverySourceResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDestinationRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteDestinationResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteLogAnomalyDetectorRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteLogAnomalyDetectorResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteLogGroupRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteLogGroupResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteLogStreamRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteLogStreamResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteMetricFilterRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteMetricFilterResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteQueryDefinitionRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteQueryDefinitionResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteResourcePolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteResourcePolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteRetentionPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteRetentionPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteSubscriptionFilterRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DeleteSubscriptionFilterResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeAccountPoliciesRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeAccountPoliciesResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDeliveriesRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDeliveriesResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDeliveryDestinationsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDeliveryDestinationsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDeliverySourcesRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDeliverySourcesResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDestinationsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeDestinationsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeExportTasksRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeExportTasksResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeLogGroupsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeLogGroupsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeLogStreamsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeLogStreamsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeMetricFiltersRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeMetricFiltersResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeQueriesRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeQueriesResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeQueryDefinitionsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeQueryDefinitionsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeResourcePoliciesRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeResourcePoliciesResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeSubscriptionFiltersRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DescribeSubscriptionFiltersResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.DisassociateKmsKeyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.DisassociateKmsKeyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.FilterLogEventsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.FilterLogEventsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDataProtectionPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDataProtectionPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliveryDestinationPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliveryDestinationPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliveryDestinationRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliveryDestinationResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliveryRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliveryResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliverySourceRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetDeliverySourceResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogAnomalyDetectorRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogAnomalyDetectorResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogEventsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogEventsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogGroupFieldsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogGroupFieldsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogRecordRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetLogRecordResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetQueryResultsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.GetQueryResultsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.InvalidOperationException;
import software.amazon.awssdk.services.cloudwatchlogs.model.InvalidParameterException;
import software.amazon.awssdk.services.cloudwatchlogs.model.InvalidSequenceTokenException;
import software.amazon.awssdk.services.cloudwatchlogs.model.LimitExceededException;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListAnomaliesRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListAnomaliesResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListLogAnomalyDetectorsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListLogAnomalyDetectorsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListTagsForResourceResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListTagsLogGroupRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.ListTagsLogGroupResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.MalformedQueryException;
import software.amazon.awssdk.services.cloudwatchlogs.model.OperationAbortedException;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutAccountPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutAccountPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDataProtectionPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDataProtectionPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDeliveryDestinationPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDeliveryDestinationPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDeliveryDestinationRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDeliveryDestinationResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDeliverySourceRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDeliverySourceResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDestinationPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDestinationPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDestinationRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutDestinationResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutLogEventsRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutLogEventsResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutMetricFilterRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutMetricFilterResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutQueryDefinitionRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutQueryDefinitionResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutResourcePolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutResourcePolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutRetentionPolicyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutRetentionPolicyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutSubscriptionFilterRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.PutSubscriptionFilterResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.ResourceAlreadyExistsException;
import software.amazon.awssdk.services.cloudwatchlogs.model.ResourceNotFoundException;
import software.amazon.awssdk.services.cloudwatchlogs.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.cloudwatchlogs.model.ServiceUnavailableException;
import software.amazon.awssdk.services.cloudwatchlogs.model.SessionStreamingException;
import software.amazon.awssdk.services.cloudwatchlogs.model.SessionTimeoutException;
import software.amazon.awssdk.services.cloudwatchlogs.model.StartLiveTailRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.StartLiveTailResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.StartLiveTailResponseHandler;
import software.amazon.awssdk.services.cloudwatchlogs.model.StartLiveTailResponseStream;
import software.amazon.awssdk.services.cloudwatchlogs.model.StartQueryRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.StartQueryResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.StopQueryRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.StopQueryResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.TagLogGroupRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.TagLogGroupResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.TagResourceRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.TagResourceResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.TestMetricFilterRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.TestMetricFilterResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.ThrottlingException;
import software.amazon.awssdk.services.cloudwatchlogs.model.TooManyTagsException;
import software.amazon.awssdk.services.cloudwatchlogs.model.UnrecognizedClientException;
import software.amazon.awssdk.services.cloudwatchlogs.model.UntagLogGroupRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.UntagLogGroupResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.UntagResourceRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.UntagResourceResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.UpdateAnomalyRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.UpdateAnomalyResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.UpdateLogAnomalyDetectorRequest;
import software.amazon.awssdk.services.cloudwatchlogs.model.UpdateLogAnomalyDetectorResponse;
import software.amazon.awssdk.services.cloudwatchlogs.model.ValidationException;
import software.amazon.awssdk.services.cloudwatchlogs.transform.AssociateKmsKeyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.CancelExportTaskRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.CreateDeliveryRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.CreateExportTaskRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.CreateLogAnomalyDetectorRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.CreateLogGroupRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.CreateLogStreamRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteAccountPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteDataProtectionPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteDeliveryDestinationPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteDeliveryDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteDeliveryRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteDeliverySourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteLogAnomalyDetectorRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteLogGroupRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteLogStreamRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteMetricFilterRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteQueryDefinitionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteResourcePolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteRetentionPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DeleteSubscriptionFilterRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeAccountPoliciesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeDeliveriesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeDeliveryDestinationsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeDeliverySourcesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeDestinationsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeExportTasksRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeLogGroupsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeLogStreamsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeMetricFiltersRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeQueriesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeQueryDefinitionsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeResourcePoliciesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DescribeSubscriptionFiltersRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.DisassociateKmsKeyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.FilterLogEventsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetDataProtectionPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetDeliveryDestinationPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetDeliveryDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetDeliveryRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetDeliverySourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetLogAnomalyDetectorRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetLogEventsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetLogGroupFieldsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetLogRecordRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.GetQueryResultsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.ListAnomaliesRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.ListLogAnomalyDetectorsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.ListTagsForResourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.ListTagsLogGroupRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutAccountPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutDataProtectionPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutDeliveryDestinationPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutDeliveryDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutDeliverySourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutDestinationPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutDestinationRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutLogEventsRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutMetricFilterRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutQueryDefinitionRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutResourcePolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutRetentionPolicyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.PutSubscriptionFilterRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.StartLiveTailRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.StartQueryRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.StopQueryRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.TagLogGroupRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.TagResourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.TestMetricFilterRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.UntagLogGroupRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.UntagResourceRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.UpdateAnomalyRequestMarshaller;
import software.amazon.awssdk.services.cloudwatchlogs.transform.UpdateLogAnomalyDetectorRequestMarshaller;
import software.amazon.awssdk.utils.CompletableFutureUtils;
/**
* Internal implementation of {@link CloudWatchLogsAsyncClient}.
*
* @see CloudWatchLogsAsyncClient#builder()
*/
@Generated("software.amazon.awssdk:codegen")
@SdkInternalApi
final class DefaultCloudWatchLogsAsyncClient implements CloudWatchLogsAsyncClient {
private static final Logger log = LoggerFactory.getLogger(DefaultCloudWatchLogsAsyncClient.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;
private final Executor executor;
protected DefaultCloudWatchLogsAsyncClient(SdkClientConfiguration clientConfiguration) {
this.clientHandler = new AwsAsyncClientHandler(clientConfiguration);
this.clientConfiguration = clientConfiguration;
this.protocolFactory = init(AwsJsonProtocolFactory.builder()).build();
this.executor = clientConfiguration.option(SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR);
}
/**
*
* Associates the specified KMS key with either one log group in the account, or with all stored CloudWatch Logs
* query insights results in the account.
*
*
* When you use AssociateKmsKey
, you specify either the logGroupName
parameter or the
* resourceIdentifier
parameter. You can't specify both of those parameters in the same operation.
*
*
* -
*
* Specify the logGroupName
parameter to cause all log events stored in the log group to be encrypted
* with that key. Only the log events ingested after the key is associated are encrypted with that key.
*
*
* Associating a KMS key with a log group overrides any existing associations between the log group and a KMS key.
* After a KMS key is associated with a log group, all newly ingested data for the log group is encrypted using the
* KMS key. This association is stored as long as the data encrypted with the KMS key is still within CloudWatch
* Logs. This enables CloudWatch Logs to decrypt this data whenever it is requested.
*
*
* Associating a key with a log group does not cause the results of queries of that log group to be encrypted with
* that key. To have query results encrypted with a KMS key, you must use an AssociateKmsKey
operation
* with the resourceIdentifier
parameter that specifies a query-result
resource.
*
*
* -
*
* Specify the resourceIdentifier
parameter with a query-result
resource, to use that key
* to encrypt the stored results of all future StartQuery
* operations in the account. The response from a GetQueryResults operation will still return the query results in plain text.
*
*
* Even if you have not associated a key with your query results, the query results are encrypted when stored, using
* the default CloudWatch Logs method.
*
*
* If you run a query from a monitoring account that queries logs in a source account, the query results key from
* the monitoring account, if any, is used.
*
*
*
*
*
* If you delete the key that is used to encrypt log events or log group query results, then all the associated
* stored log events or query results that were encrypted with that key will be unencryptable and unusable.
*
*
*
* CloudWatch Logs supports only symmetric KMS keys. Do not use an associate an asymmetric KMS key with your log
* group or query results. For more information, see Using Symmetric and
* Asymmetric Keys.
*
*
*
* It can take up to 5 minutes for this operation to take effect.
*
*
* If you attempt to associate a KMS key with a log group but the KMS key does not exist or the KMS key is disabled,
* you receive an InvalidParameterException
error.
*
*
* @param associateKmsKeyRequest
* @return A Java Future containing the result of the AssociateKmsKey operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.AssociateKmsKey
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture associateKmsKey(AssociateKmsKeyRequest associateKmsKeyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(associateKmsKeyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, associateKmsKeyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "AssociateKmsKey");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, AssociateKmsKeyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("AssociateKmsKey").withProtocolMetadata(protocolMetadata)
.withMarshaller(new AssociateKmsKeyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(associateKmsKeyRequest));
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);
}
}
/**
*
* Cancels the specified export task.
*
*
* The task must be in the PENDING
or RUNNING
state.
*
*
* @param cancelExportTaskRequest
* @return A Java Future containing the result of the CancelExportTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - InvalidOperationException The operation is not valid on the specified resource.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.CancelExportTask
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture cancelExportTask(CancelExportTaskRequest cancelExportTaskRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(cancelExportTaskRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, cancelExportTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CancelExportTask");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CancelExportTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CancelExportTask").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CancelExportTaskRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(cancelExportTaskRequest));
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 delivery. A delivery is a connection between a logical delivery source and a logical
* delivery destination that you have already created.
*
*
* Only some Amazon Web Services services support being configured as a delivery source using this operation. These
* services are listed as Supported [V2 Permissions] in the table at Enabling
* logging from Amazon Web Services services.
*
*
* A delivery destination can represent a log group in CloudWatch Logs, an Amazon S3 bucket, or a delivery stream in
* Kinesis Data Firehose.
*
*
* To configure logs delivery between a supported Amazon Web Services service and a destination, you must do the
* following:
*
*
* -
*
* Create a delivery source, which is a logical object that represents the resource that is actually sending the
* logs. For more information, see PutDeliverySource.
*
*
* -
*
* Create a delivery destination, which is a logical object that represents the actual delivery destination.
* For more information, see PutDeliveryDestination.
*
*
* -
*
* If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy in the destination account to assign an IAM policy to the destination. This
* policy allows delivery to that destination.
*
*
* -
*
* Use CreateDelivery
to create a delivery by pairing exactly one delivery source and one
* delivery destination.
*
*
*
*
* You can configure a single delivery source to send logs to multiple destinations by creating multiple deliveries.
* You can also create multiple deliveries to configure multiple delivery sources to send logs to the same delivery
* destination.
*
*
* You can't update an existing delivery. You can only create and delete deliveries.
*
*
* @param createDeliveryRequest
* @return A Java Future containing the result of the CreateDelivery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceUnavailableException The service cannot complete the request.
* - ConflictException This operation attempted to create a resource that already exists.
* - ResourceNotFoundException The specified resource does not exist.
* - ValidationException One of the parameters for the request is not valid.
* - AccessDeniedException You don't have sufficient permissions to perform this action.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.CreateDelivery
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createDelivery(CreateDeliveryRequest createDeliveryRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createDeliveryRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createDeliveryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateDelivery");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateDeliveryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateDelivery").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateDeliveryRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createDeliveryRequest));
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 an export task so that you can efficiently export data from a log group to an Amazon S3 bucket. When you
* perform a CreateExportTask
operation, you must use credentials that have permission to write to the
* S3 bucket that you specify as the destination.
*
*
* Exporting log data to S3 buckets that are encrypted by KMS is supported. Exporting log data to Amazon S3 buckets
* that have S3 Object Lock enabled with a retention period is also supported.
*
*
* Exporting to S3 buckets that are encrypted with AES-256 is supported.
*
*
* This is an asynchronous call. If all the required information is provided, this operation initiates an export
* task and responds with the ID of the task. After the task has started, you can use DescribeExportTasks to get the status of the export task. Each account can only have one active (
* RUNNING
or PENDING
) export task at a time. To cancel an export task, use CancelExportTask.
*
*
* You can export logs from multiple log groups or multiple time ranges to the same S3 bucket. To separate log data
* for each export task, specify a prefix to be used as the Amazon S3 key prefix for all exported objects.
*
*
*
* Time-based sorting on chunks of log data inside an exported file is not guaranteed. You can sort the exported log
* field data by using Linux utilities.
*
*
*
* @param createExportTaskRequest
* @return A Java Future containing the result of the CreateExportTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - LimitExceededException You have reached the maximum number of resources that can be created.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot complete the request.
* - ResourceNotFoundException The specified resource does not exist.
* - ResourceAlreadyExistsException The specified resource already exists.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.CreateExportTask
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createExportTask(CreateExportTaskRequest createExportTaskRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createExportTaskRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createExportTaskRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateExportTask");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateExportTaskResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateExportTask").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateExportTaskRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createExportTaskRequest));
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 an anomaly detector that regularly scans one or more log groups and look for patterns and
* anomalies in the logs.
*
*
* An anomaly detector can help surface issues by automatically discovering anomalies in your log event traffic. An
* anomaly detector uses machine learning algorithms to scan log events and find patterns. A pattern is a
* shared text structure that recurs among your log fields. Patterns provide a useful tool for analyzing large sets
* of logs because a large number of log events can often be compressed into a few patterns.
*
*
* The anomaly detector uses pattern recognition to find anomalies
, which are unusual log events. It
* uses the evaluationFrequency
to compare current log events and patterns with trained baselines.
*
*
* Fields within a pattern are called tokens. Fields that vary within a pattern, such as a request ID or
* timestamp, are referred to as dynamic tokens and represented by <*>
.
*
*
* The following is an example of a pattern:
*
*
* [INFO] Request time: <*> ms
*
*
* This pattern represents log events like [INFO] Request time: 327 ms
and other similar log events
* that differ only by the number, in this csse 327. When the pattern is displayed, the different numbers are
* replaced by <*>
*
*
*
* Any parts of log events that are masked as sensitive data are not scanned for anomalies. For more information
* about masking sensitive data, see Help protect
* sensitive log data with masking.
*
*
*
* @param createLogAnomalyDetectorRequest
* @return A Java Future containing the result of the CreateLogAnomalyDetector operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot complete the request.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - LimitExceededException You have reached the maximum number of resources that can be created.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.CreateLogAnomalyDetector
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture createLogAnomalyDetector(
CreateLogAnomalyDetectorRequest createLogAnomalyDetectorRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLogAnomalyDetectorRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createLogAnomalyDetectorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLogAnomalyDetector");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateLogAnomalyDetectorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateLogAnomalyDetector").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateLogAnomalyDetectorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createLogAnomalyDetectorRequest));
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 log group with the specified name. You can create up to 1,000,000 log groups per Region per account.
*
*
* You must use the following guidelines when naming a log group:
*
*
* -
*
* Log group names must be unique within a Region for an Amazon Web Services account.
*
*
* -
*
* Log group names can be between 1 and 512 characters long.
*
*
* -
*
* Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward
* slash), '.' (period), and '#' (number sign)
*
*
*
*
* When you create a log group, by default the log events in the log group do not expire. To set a retention policy
* so that events expire and are deleted after a specified time, use PutRetentionPolicy.
*
*
* If you associate an KMS key with the log group, ingested data is encrypted using the KMS key. This association is
* stored as long as the data encrypted with the KMS key is still within CloudWatch Logs. This enables CloudWatch
* Logs to decrypt this data whenever it is requested.
*
*
* If you attempt to associate a KMS key with the log group but the KMS key does not exist or the KMS key is
* disabled, you receive an InvalidParameterException
error.
*
*
*
* CloudWatch Logs supports only symmetric KMS keys. Do not associate an asymmetric KMS key with your log group. For
* more information, see Using Symmetric and
* Asymmetric Keys.
*
*
*
* @param createLogGroupRequest
* @return A Java Future containing the result of the CreateLogGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceAlreadyExistsException The specified resource already exists.
* - LimitExceededException You have reached the maximum number of resources that can be created.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.CreateLogGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createLogGroup(CreateLogGroupRequest createLogGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLogGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createLogGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLogGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateLogGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateLogGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateLogGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createLogGroupRequest));
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 log stream for the specified log group. A log stream is a sequence of log events that originate from a
* single source, such as an application instance or a resource that is being monitored.
*
*
* There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on
* CreateLogStream
operations, after which transactions are throttled.
*
*
* You must use the following guidelines when naming a log stream:
*
*
* -
*
* Log stream names must be unique within the log group.
*
*
* -
*
* Log stream names can be between 1 and 512 characters long.
*
*
* -
*
* Don't use ':' (colon) or '*' (asterisk) characters.
*
*
*
*
* @param createLogStreamRequest
* @return A Java Future containing the result of the CreateLogStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceAlreadyExistsException The specified resource already exists.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.CreateLogStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture createLogStream(CreateLogStreamRequest createLogStreamRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(createLogStreamRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, createLogStreamRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "CreateLogStream");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, CreateLogStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("CreateLogStream").withProtocolMetadata(protocolMetadata)
.withMarshaller(new CreateLogStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(createLogStreamRequest));
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);
}
}
/**
*
* Deletes a CloudWatch Logs account policy.
*
*
* To use this operation, you must be signed on with the logs:DeleteDataProtectionPolicy
and
* logs:DeleteAccountPolicy
permissions.
*
*
* @param deleteAccountPolicyRequest
* @return A Java Future containing the result of the DeleteAccountPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot complete the request.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteAccountPolicy
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteAccountPolicy(
DeleteAccountPolicyRequest deleteAccountPolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteAccountPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteAccountPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteAccountPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteAccountPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteAccountPolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteAccountPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteAccountPolicyRequest));
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);
}
}
/**
*
* Deletes the data protection policy from the specified log group.
*
*
* For more information about data protection policies, see PutDataProtectionPolicy.
*
*
* @param deleteDataProtectionPolicyRequest
* @return A Java Future containing the result of the DeleteDataProtectionPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteDataProtectionPolicy
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteDataProtectionPolicy(
DeleteDataProtectionPolicyRequest deleteDataProtectionPolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDataProtectionPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDataProtectionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDataProtectionPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDataProtectionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDataProtectionPolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDataProtectionPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDataProtectionPolicyRequest));
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);
}
}
/**
*
* Deletes s delivery. A delivery is a connection between a logical delivery source and a logical
* delivery destination. Deleting a delivery only deletes the connection between the delivery source and
* delivery destination. It does not delete the delivery destination or the delivery source.
*
*
* @param deleteDeliveryRequest
* @return A Java Future containing the result of the DeleteDelivery operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot complete the request.
* - ConflictException This operation attempted to create a resource that already exists.
* - ValidationException One of the parameters for the request is not valid.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteDelivery
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteDelivery(DeleteDeliveryRequest deleteDeliveryRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDeliveryRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDeliveryRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDelivery");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDeliveryResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDelivery").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDeliveryRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDeliveryRequest));
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);
}
}
/**
*
* Deletes a delivery destination. A delivery is a connection between a logical delivery source and a
* logical delivery destination.
*
*
* You can't delete a delivery destination if any current deliveries are associated with it. To find whether any
* deliveries are associated with this delivery destination, use the DescribeDeliveries operation and check the deliveryDestinationArn
field in the results.
*
*
* @param deleteDeliveryDestinationRequest
* @return A Java Future containing the result of the DeleteDeliveryDestination operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot complete the request.
* - ConflictException This operation attempted to create a resource that already exists.
* - ValidationException One of the parameters for the request is not valid.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteDeliveryDestination
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteDeliveryDestination(
DeleteDeliveryDestinationRequest deleteDeliveryDestinationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDeliveryDestinationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDeliveryDestinationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDeliveryDestination");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDeliveryDestinationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDeliveryDestination").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDeliveryDestinationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDeliveryDestinationRequest));
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);
}
}
/**
*
* Deletes a delivery destination policy. For more information about these policies, see PutDeliveryDestinationPolicy.
*
*
* @param deleteDeliveryDestinationPolicyRequest
* @return A Java Future containing the result of the DeleteDeliveryDestinationPolicy operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceUnavailableException The service cannot complete the request.
* - ValidationException One of the parameters for the request is not valid.
* - ResourceNotFoundException The specified resource does not exist.
* - ConflictException This operation attempted to create a resource that already exists.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteDeliveryDestinationPolicy
* @see AWS API Documentation
*/
@Override
public CompletableFuture deleteDeliveryDestinationPolicy(
DeleteDeliveryDestinationPolicyRequest deleteDeliveryDestinationPolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDeliveryDestinationPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration,
deleteDeliveryDestinationPolicyRequest.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDeliveryDestinationPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDeliveryDestinationPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDeliveryDestinationPolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDeliveryDestinationPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDeliveryDestinationPolicyRequest));
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);
}
}
/**
*
* Deletes a delivery source. A delivery is a connection between a logical delivery source and a
* logical delivery destination.
*
*
* You can't delete a delivery source if any current deliveries are associated with it. To find whether any
* deliveries are associated with this delivery source, use the DescribeDeliveries operation and check the deliverySourceName
field in the results.
*
*
* @param deleteDeliverySourceRequest
* @return A Java Future containing the result of the DeleteDeliverySource operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot complete the request.
* - ConflictException This operation attempted to create a resource that already exists.
* - ValidationException One of the parameters for the request is not valid.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteDeliverySource
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteDeliverySource(
DeleteDeliverySourceRequest deleteDeliverySourceRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDeliverySourceRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDeliverySourceRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDeliverySource");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDeliverySourceResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDeliverySource").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDeliverySourceRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDeliverySourceRequest));
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);
}
}
/**
*
* Deletes the specified destination, and eventually disables all the subscription filters that publish to it. This
* operation does not delete the physical resource encapsulated by the destination.
*
*
* @param deleteDestinationRequest
* @return A Java Future containing the result of the DeleteDestination operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteDestination
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteDestination(DeleteDestinationRequest deleteDestinationRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteDestinationRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteDestinationRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteDestination");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteDestinationResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteDestination").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteDestinationRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteDestinationRequest));
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);
}
}
/**
*
* Deletes the specified CloudWatch Logs anomaly detector.
*
*
* @param deleteLogAnomalyDetectorRequest
* @return A Java Future containing the result of the DeleteLogAnomalyDetector operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot complete the request.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteLogAnomalyDetector
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteLogAnomalyDetector(
DeleteLogAnomalyDetectorRequest deleteLogAnomalyDetectorRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLogAnomalyDetectorRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLogAnomalyDetectorRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLogAnomalyDetector");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteLogAnomalyDetectorResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteLogAnomalyDetector").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteLogAnomalyDetectorRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteLogAnomalyDetectorRequest));
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);
}
}
/**
*
* Deletes the specified log group and permanently deletes all the archived log events associated with the log
* group.
*
*
* @param deleteLogGroupRequest
* @return A Java Future containing the result of the DeleteLogGroup operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteLogGroup
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteLogGroup(DeleteLogGroupRequest deleteLogGroupRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLogGroupRequest, this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLogGroupRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLogGroup");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteLogGroupResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteLogGroup").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteLogGroupRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteLogGroupRequest));
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);
}
}
/**
*
* Deletes the specified log stream and permanently deletes all the archived log events associated with the log
* stream.
*
*
* @param deleteLogStreamRequest
* @return A Java Future containing the result of the DeleteLogStream operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteLogStream
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteLogStream(DeleteLogStreamRequest deleteLogStreamRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteLogStreamRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteLogStreamRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteLogStream");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteLogStreamResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteLogStream").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteLogStreamRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteLogStreamRequest));
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);
}
}
/**
*
* Deletes the specified metric filter.
*
*
* @param deleteMetricFilterRequest
* @return A Java Future containing the result of the DeleteMetricFilter operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteMetricFilter
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteMetricFilter(DeleteMetricFilterRequest deleteMetricFilterRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteMetricFilterRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteMetricFilterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteMetricFilter");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteMetricFilterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteMetricFilter").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteMetricFilterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteMetricFilterRequest));
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);
}
}
/**
*
* Deletes a saved CloudWatch Logs Insights query definition. A query definition contains details about a saved
* CloudWatch Logs Insights query.
*
*
* Each DeleteQueryDefinition
operation can delete one query definition.
*
*
* You must have the logs:DeleteQueryDefinition
permission to be able to perform this operation.
*
*
* @param deleteQueryDefinitionRequest
* @return A Java Future containing the result of the DeleteQueryDefinition operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteQueryDefinition
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteQueryDefinition(
DeleteQueryDefinitionRequest deleteQueryDefinitionRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteQueryDefinitionRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteQueryDefinitionRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteQueryDefinition");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteQueryDefinitionResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteQueryDefinition").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteQueryDefinitionRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteQueryDefinitionRequest));
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);
}
}
/**
*
* Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log
* events to this account.
*
*
* @param deleteResourcePolicyRequest
* @return A Java Future containing the result of the DeleteResourcePolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteResourcePolicy
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture deleteResourcePolicy(
DeleteResourcePolicyRequest deleteResourcePolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteResourcePolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteResourcePolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteResourcePolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteResourcePolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteResourcePolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteResourcePolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteResourcePolicyRequest));
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);
}
}
/**
*
* Deletes the specified retention policy.
*
*
* Log events do not expire if they belong to log groups without a retention policy.
*
*
* @param deleteRetentionPolicyRequest
* @return A Java Future containing the result of the DeleteRetentionPolicy operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteRetentionPolicy
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteRetentionPolicy(
DeleteRetentionPolicyRequest deleteRetentionPolicyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteRetentionPolicyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteRetentionPolicyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteRetentionPolicy");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteRetentionPolicyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteRetentionPolicy").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteRetentionPolicyRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteRetentionPolicyRequest));
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);
}
}
/**
*
* Deletes the specified subscription filter.
*
*
* @param deleteSubscriptionFilterRequest
* @return A Java Future containing the result of the DeleteSubscriptionFilter operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DeleteSubscriptionFilter
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture deleteSubscriptionFilter(
DeleteSubscriptionFilterRequest deleteSubscriptionFilterRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(deleteSubscriptionFilterRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, deleteSubscriptionFilterRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DeleteSubscriptionFilter");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DeleteSubscriptionFilterResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DeleteSubscriptionFilter").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DeleteSubscriptionFilterRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(deleteSubscriptionFilterRequest));
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);
}
}
/**
*
* Returns a list of all CloudWatch Logs account policies in the account.
*
*
* @param describeAccountPoliciesRequest
* @return A Java Future containing the result of the DescribeAccountPolicies operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeAccountPolicies
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeAccountPolicies(
DescribeAccountPoliciesRequest describeAccountPoliciesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeAccountPoliciesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeAccountPoliciesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeAccountPolicies");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeAccountPoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeAccountPolicies").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeAccountPoliciesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeAccountPoliciesRequest));
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);
}
}
/**
*
* Retrieves a list of the deliveries that have been created in the account.
*
*
* @param describeDeliveriesRequest
* @return A Java Future containing the result of the DescribeDeliveries operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceUnavailableException The service cannot complete the request.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ValidationException One of the parameters for the request is not valid.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeDeliveries
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeDeliveries(DescribeDeliveriesRequest describeDeliveriesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeDeliveriesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDeliveriesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDeliveries");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeDeliveriesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDeliveries").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeDeliveriesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeDeliveriesRequest));
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);
}
}
/**
*
* Retrieves a list of the delivery destinations that have been created in the account.
*
*
* @param describeDeliveryDestinationsRequest
* @return A Java Future containing the result of the DescribeDeliveryDestinations operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceUnavailableException The service cannot complete the request.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ValidationException One of the parameters for the request is not valid.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeDeliveryDestinations
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeDeliveryDestinations(
DescribeDeliveryDestinationsRequest describeDeliveryDestinationsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeDeliveryDestinationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDeliveryDestinationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDeliveryDestinations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeDeliveryDestinationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDeliveryDestinations").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeDeliveryDestinationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeDeliveryDestinationsRequest));
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);
}
}
/**
*
* Retrieves a list of the delivery sources that have been created in the account.
*
*
* @param describeDeliverySourcesRequest
* @return A Java Future containing the result of the DescribeDeliverySources operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - ServiceUnavailableException The service cannot complete the request.
* - ServiceQuotaExceededException This request exceeds a service quota.
* - ValidationException One of the parameters for the request is not valid.
* - ThrottlingException The request was throttled because of quota limits.
* - 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeDeliverySources
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeDeliverySources(
DescribeDeliverySourcesRequest describeDeliverySourcesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeDeliverySourcesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDeliverySourcesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDeliverySources");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeDeliverySourcesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDeliverySources").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeDeliverySourcesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeDeliverySourcesRequest));
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 all your destinations. The results are ASCII-sorted by destination name.
*
*
* @param describeDestinationsRequest
* @return A Java Future containing the result of the DescribeDestinations operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeDestinations
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeDestinations(
DescribeDestinationsRequest describeDestinationsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeDestinationsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeDestinationsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeDestinations");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeDestinationsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeDestinations").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeDestinationsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeDestinationsRequest));
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 specified export tasks. You can list all your export tasks or filter the results based on task ID or
* task status.
*
*
* @param describeExportTasksRequest
* @return A Java Future containing the result of the DescribeExportTasks operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeExportTasks
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeExportTasks(
DescribeExportTasksRequest describeExportTasksRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeExportTasksRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeExportTasksRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeExportTasks");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeExportTasksResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeExportTasks").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeExportTasksRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeExportTasksRequest));
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 specified log groups. You can list all your log groups or filter the results by prefix. The results are
* ASCII-sorted by log group name.
*
*
* CloudWatch Logs doesn’t support IAM policies that control access to the DescribeLogGroups
action by
* using the aws:ResourceTag/key-name
condition key. Other CloudWatch Logs actions do support
* the use of the aws:ResourceTag/key-name
condition key to control access. For more
* information about using tags to control access, see Controlling access to Amazon Web
* Services resources using tags.
*
*
* If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and
* view data from the linked source accounts. For more information, see CloudWatch cross-account observability.
*
*
* @param describeLogGroupsRequest
* @return A Java Future containing the result of the DescribeLogGroups operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeLogGroups
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeLogGroups(DescribeLogGroupsRequest describeLogGroupsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLogGroupsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLogGroupsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLogGroups");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeLogGroupsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeLogGroups").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeLogGroupsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeLogGroupsRequest));
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 streams for the specified log group. You can list all the log streams or filter the results by
* prefix. You can also control how the results are ordered.
*
*
* You can specify the log group to search by using either logGroupIdentifier
or
* logGroupName
. You must include one of these two parameters, but you can't include both.
*
*
* This operation has a limit of five transactions per second, after which transactions are throttled.
*
*
* If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and
* view data from the linked source accounts. For more information, see CloudWatch cross-account observability.
*
*
* @param describeLogStreamsRequest
* @return A Java Future containing the result of the DescribeLogStreams operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeLogStreams
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeLogStreams(DescribeLogStreamsRequest describeLogStreamsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeLogStreamsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeLogStreamsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeLogStreams");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeLogStreamsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeLogStreams").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeLogStreamsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeLogStreamsRequest));
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 specified metric filters. You can list all of the metric filters or filter the results by log name,
* prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.
*
*
* @param describeMetricFiltersRequest
* @return A Java Future containing the result of the DescribeMetricFilters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeMetricFilters
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeMetricFilters(
DescribeMetricFiltersRequest describeMetricFiltersRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeMetricFiltersRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeMetricFiltersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeMetricFilters");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeMetricFiltersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeMetricFilters").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeMetricFiltersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeMetricFiltersRequest));
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);
}
}
/**
*
* Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this
* account. You can request all queries or limit it to queries of a specific log group or queries with a certain
* status.
*
*
* @param describeQueriesRequest
* @return A Java Future containing the result of the DescribeQueries operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeQueries
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture describeQueries(DescribeQueriesRequest describeQueriesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeQueriesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeQueriesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeQueries");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeQueriesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeQueries").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeQueriesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeQueriesRequest));
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);
}
}
/**
*
* This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can
* retrieve query definitions from the current account or from a source account that is linked to the current
* account.
*
*
* You can use the queryDefinitionNamePrefix
parameter to limit the results to only the query
* definitions that have names that start with a certain string.
*
*
* @param describeQueryDefinitionsRequest
* @return A Java Future containing the result of the DescribeQueryDefinitions operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeQueryDefinitions
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeQueryDefinitions(
DescribeQueryDefinitionsRequest describeQueryDefinitionsRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeQueryDefinitionsRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeQueryDefinitionsRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeQueryDefinitions");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeQueryDefinitionsResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeQueryDefinitions").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeQueryDefinitionsRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeQueryDefinitionsRequest));
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 resource policies in this account.
*
*
* @param describeResourcePoliciesRequest
* @return A Java Future containing the result of the DescribeResourcePolicies operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeResourcePolicies
* @see AWS
* API Documentation
*/
@Override
public CompletableFuture describeResourcePolicies(
DescribeResourcePoliciesRequest describeResourcePoliciesRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeResourcePoliciesRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeResourcePoliciesRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeResourcePolicies");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeResourcePoliciesResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeResourcePolicies").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeResourcePoliciesRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeResourcePoliciesRequest));
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 subscription filters for the specified log group. You can list all the subscription filters or filter
* the results by prefix. The results are ASCII-sorted by filter name.
*
*
* @param describeSubscriptionFiltersRequest
* @return A Java Future containing the result of the DescribeSubscriptionFilters operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DescribeSubscriptionFilters
* @see AWS API Documentation
*/
@Override
public CompletableFuture describeSubscriptionFilters(
DescribeSubscriptionFiltersRequest describeSubscriptionFiltersRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(describeSubscriptionFiltersRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, describeSubscriptionFiltersRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DescribeSubscriptionFilters");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DescribeSubscriptionFiltersResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams()
.withOperationName("DescribeSubscriptionFilters").withProtocolMetadata(protocolMetadata)
.withMarshaller(new DescribeSubscriptionFiltersRequestMarshaller(protocolFactory))
.withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler)
.withRequestConfiguration(clientConfiguration).withMetricCollector(apiCallMetricCollector)
.withInput(describeSubscriptionFiltersRequest));
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);
}
}
/**
*
* Disassociates the specified KMS key from the specified log group or from all CloudWatch Logs Insights query
* results in the account.
*
*
* When you use DisassociateKmsKey
, you specify either the logGroupName
parameter or the
* resourceIdentifier
parameter. You can't specify both of those parameters in the same operation.
*
*
* -
*
* Specify the logGroupName
parameter to stop using the KMS key to encrypt future log events ingested
* and stored in the log group. Instead, they will be encrypted with the default CloudWatch Logs method. The log
* events that were ingested while the key was associated with the log group are still encrypted with that key.
* Therefore, CloudWatch Logs will need permissions for the key whenever that data is accessed.
*
*
* -
*
* Specify the resourceIdentifier
parameter with the query-result
resource to stop using
* the KMS key to encrypt the results of all future StartQuery
* operations in the account. They will instead be encrypted with the default CloudWatch Logs method. The results
* from queries that ran while the key was associated with the account are still encrypted with that key. Therefore,
* CloudWatch Logs will need permissions for the key whenever that data is accessed.
*
*
*
*
* It can take up to 5 minutes for this operation to take effect.
*
*
* @param disassociateKmsKeyRequest
* @return A Java Future containing the result of the DisassociateKmsKey operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - InvalidParameterException A parameter is specified incorrectly.
* - ResourceNotFoundException The specified resource does not exist.
* - OperationAbortedException Multiple concurrent requests to update the same resource were in conflict.
* - ServiceUnavailableException The service cannot 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.
* - CloudWatchLogsException Base class for all service exceptions. Unknown exceptions will be thrown as
* an instance of this type.
*
* @sample CloudWatchLogsAsyncClient.DisassociateKmsKey
* @see AWS API
* Documentation
*/
@Override
public CompletableFuture disassociateKmsKey(DisassociateKmsKeyRequest disassociateKmsKeyRequest) {
SdkClientConfiguration clientConfiguration = updateSdkClientConfiguration(disassociateKmsKeyRequest,
this.clientConfiguration);
List metricPublishers = resolveMetricPublishers(clientConfiguration, disassociateKmsKeyRequest
.overrideConfiguration().orElse(null));
MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector
.create("ApiCall");
try {
apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "CloudWatch Logs");
apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "DisassociateKmsKey");
JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(false)
.isPayloadJson(true).build();
HttpResponseHandler responseHandler = protocolFactory.createResponseHandler(
operationMetadata, DisassociateKmsKeyResponse::builder);
HttpResponseHandler errorResponseHandler = createErrorResponseHandler(protocolFactory,
operationMetadata);
CompletableFuture executeFuture = clientHandler
.execute(new ClientExecutionParams